Skip to content

Commit

Permalink
Правка размеров
Browse files Browse the repository at this point in the history
Исправлено #133
  • Loading branch information
kuvbur committed Feb 22, 2025
1 parent 70fb00a commit e677538
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 85 deletions.
19 changes: 11 additions & 8 deletions Sources/AddOn/CommonFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1019,6 +1019,7 @@ bool UniStringToDouble (const GS::UniString & var, double& x)
Int32 ceil_mod (Int32 n, Int32 k)
{
if (!k) return 0;
if (!n) return 0;
Int32 tmp = abs (n % k);
if (tmp) n += (n > -1 ? (abs (k) - tmp) : (tmp));
return n;
Expand All @@ -1030,9 +1031,11 @@ Int32 ceil_mod (Int32 n, Int32 k)
Int32 ceil_mod_classic (Int32 n, Int32 k)
{
if (!k) return 0;
Int32 tmp = abs (n % k);
if (tmp) n += (n > -1 ? (abs (k) + tmp) : (tmp));
return n;
if (!n) return 0;
double n_real = n / 1.0;
double k_real = k / 1.0;
double param_real = round (n_real / k_real) * k;
return (GS::Int32) param_real;
}
// --------------------------------------------------------------------
// Перевод метров, заданных типом double в мм Int32
Expand Down Expand Up @@ -1382,7 +1385,7 @@ void GetGDLParametersHead (const API_Element & element, const API_Elem_Head & el
break;
}
return;
}
}

// -----------------------------------------------------------------------------
// Возвращает список параметров API_AddParType из memo
Expand Down Expand Up @@ -1444,7 +1447,7 @@ GSErrCode GetGDLParameters (const API_ElemTypeID & elemType, const API_Guid & el
if (err != NoError) {
msg_rep ("GetGDLParameters", "APIAny_OpenParametersID", err, elemGuid);
return GetGDLParametersFromMemo (elemGuid, params);
}
}
#if defined(AC_27) || defined(AC_28)
err = ACAPI_LibraryPart_GetActParameters (&apiParams);
#else
Expand Down Expand Up @@ -1509,8 +1512,8 @@ GSErrCode GetRElementsForCWall (const API_Guid & cwGuid, GS::Array<API_Guid>&ele
if (memo.cWallFrames[idx].hasSymbol && !memo.cWallFrames[idx].deleteFlag && memo.cWallFrames[idx].objectType != APICWFrObjectType_Invisible) {
elementsSymbolGuids.Push (std::move (memo.cWallFrames[idx].head.guid));
}
}
}
}
const GSSize nWallJunctions = BMGetPtrSize (reinterpret_cast<GSPtr> (memo.cWallJunctions)) / sizeof (API_CWJunctionType);
if (nWallJunctions > 0) {
for (Int32 idx = 0; idx < nWallJunctions; ++idx) {
Expand All @@ -1529,7 +1532,7 @@ GSErrCode GetRElementsForCWall (const API_Guid & cwGuid, GS::Array<API_Guid>&ele
}
ACAPI_DisposeElemMemoHdls (&memo);
return err;
}
}

// --------------------------------------------------------------------
// Получение списка GUID элементов ограждения
Expand Down Expand Up @@ -1793,7 +1796,7 @@ bool ElemHead_To_Neig (API_Neig * neig,
case API_HotlinkID:
default:
return false;
}
}

return true;
} // ElemHead_To_Neig
Expand Down
91 changes: 22 additions & 69 deletions Sources/AddOn/Dimensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ bool DimReadPref (DimRules& dimrules, GS::UniString& autotext)
// -----------------------------------------------------------------------------
bool DimParsePref (GS::UniString& rawrule, DimRule& dimrule, bool& hasexpression)
{
if (rawrule.IsEmpty ()) return false;
if (!rawrule.Contains ("-")) return false;
bool flag_find = false;
GS::Array<GS::UniString> partstring_1;
if (StringSplt (rawrule, "-", partstring_1) == 2) {
bool flag_find = false;
//Проверяем - что указано в правиле: слой или номер пера
// Слой указываем в кавычках, в regexp формате
if (partstring_1[0].Contains ('"')) {
Expand All @@ -110,106 +112,57 @@ bool DimParsePref (GS::UniString& rawrule, DimRule& dimrule, bool& hasexpression
} else {
dimrule.pen_original = std::atoi (partstring_1[0].ToCStr ());
}
if (partstring_1[1].IsEqual ("DeleteWall")) {
if (partstring_1[1].Contains ("DeleteWall")) {
dimrule.flag_change = true;
dimrule.flag_deletewall = true;
dimrule.pen_rounded = dimrule.pen_original;
flag_find = true;
}
if (partstring_1[1].IsEqual ("ResetText")) {
if (partstring_1[1].Contains ("ResetText")) {
dimrule.flag_change = true;
dimrule.flag_reset = true;
dimrule.pen_rounded = dimrule.pen_original;
flag_find = true;
}
if (partstring_1[1].IsEqual ("CheckCustom")) {
if (partstring_1[1].Contains ("CheckCustom")) {
dimrule.flag_change = false;
dimrule.flag_custom = true;
flag_find = true;
}
if (partstring_1[1].Contains ("ClassicRound")) {
dimrule.classic_round_mode = true;
flag_find = true;
}
if (!partstring_1[1].Contains (",")) return flag_find;
GS::Array<GS::UniString> partstring_2;
if (StringSplt (partstring_1[1], ",", partstring_2) > 1) {
dimrule.round_value = std::atoi (partstring_2[0].ToCStr ());
dimrule.pen_rounded = std::atoi (partstring_2[1].ToCStr ());
if (partstring_2.GetSize () == 3) {
if (partstring_2[2].IsEqual ("Delete_Wall")) {
dimrule.flag_change = true;
dimrule.flag_deletewall = true;
flag_find = true;
}
if (partstring_2[2].IsEqual ("ResetText")) {
dimrule.flag_change = true;
dimrule.flag_reset = true;
flag_find = true;
}
if (partstring_2[2].IsEqual ("CheckCustom")) {
dimrule.flag_change = false;
dimrule.flag_custom = true;
flag_find = true;
}
if (partstring_2[2].Contains ("{") && partstring_2[2].Contains ("}")) {
ParamDictValue paramDict;
GS::UniString expression = partstring_2[2];
expression.ReplaceAll ("<MeasuredValue>", "{MeasuredValue}");
ParamHelpers::ParseParamName (expression, paramDict);
dimrule.paramDict = paramDict;
dimrule.expression = expression;
if (!hasexpression) hasexpression = !paramDict.IsEmpty ();
} else {
dimrule.flag_change = (std::atoi (partstring_2[2].ToCStr ()) > 0);
}
if (!partstring_2[0].IsEmpty ()) {
dimrule.round_value = std::atoi (partstring_2[0].ToCStr ());
flag_find = true;
}
if (partstring_2.GetSize () == 4) {
if (partstring_2[3].IsEqual ("Delete_Wall")) {
dimrule.flag_change = true;
dimrule.flag_deletewall = true;
flag_find = true;
}
if (partstring_2[3].IsEqual ("ResetText")) {
dimrule.flag_change = true;
dimrule.flag_reset = true;
flag_find = true;
}
if (partstring_2[3].Contains ("{") && partstring_2[3].Contains ("}")) {
ParamDictValue paramDict;
GS::UniString expression = partstring_2[3];
expression.ReplaceAll ("<MeasuredValue>", "{MeasuredValue}");
ParamHelpers::ParseParamName (expression, paramDict);
dimrule.paramDict = paramDict;
dimrule.expression = expression;
if (!hasexpression) hasexpression = !paramDict.IsEmpty ();
}
if (!partstring_2[1].IsEmpty ()) {
dimrule.pen_rounded = std::atoi (partstring_2[1].ToCStr ());
flag_find = true;
}
if (partstring_2.GetSize () == 5) {
if (partstring_2[4].IsEqual ("Delete_Wall")) {
dimrule.flag_change = true;
dimrule.flag_deletewall = true;
flag_find = true;
}
if (partstring_2[4].IsEqual ("ResetText")) {
dimrule.flag_change = true;
dimrule.flag_reset = true;
flag_find = true;
}
if (partstring_2[4].Contains ("{") && partstring_2[4].Contains ("}")) {
for (UInt32 k = 2; k < partstring_2.GetSize (); k++) {
if (partstring_2[k].IsEmpty ()) continue;
if (partstring_2[k].Contains ("{") && partstring_2[k].Contains ("}")) {
ParamDictValue paramDict;
GS::UniString expression = partstring_2[4];
GS::UniString expression = partstring_2[k];
expression.ReplaceAll ("<MeasuredValue>", "{MeasuredValue}");
ParamHelpers::ParseParamName (expression, paramDict);
dimrule.paramDict = paramDict;
dimrule.expression = expression;
if (!hasexpression) hasexpression = !paramDict.IsEmpty ();
} else {
if (k == 2) {
dimrule.flag_change = (std::atoi (partstring_2[k].ToCStr ()) > 0);
flag_find = true;
}
}
}
return flag_find;
}
}
return false;
return flag_find;
}

// -----------------------------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions Sources/AddOn/Roombook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ void SetSyncOtdWall (UnicElement& subelementByparent, ParamDictValue& propertyPa
parentelementhead.guid = guid;
syncguids.Append (subguids);
SyncSetSubelementScope (parentelementhead, subguids, propertyParams, paramToWrite);
}
}
if (!paramToWrite.IsEmpty ()) {
ACAPI_CallUndoableCommand ("SetSubelement",
[&]() -> GSErrCode {
Expand Down Expand Up @@ -238,9 +238,9 @@ void ClearZoneGUID (UnicElementByType& elementToRead, GS::Array<API_ElemTypeID>&
zoneGuids.Push (zoneGuid);
}
elementToRead.Get (typeelem).Set (guid, zoneGuids);
}
}
}
}
}
return;
}
// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -803,9 +803,9 @@ void DrawEdges (const Stories& storyLevels, GS::HashTable < API_Guid, OtdRoom>&
for (UInt32 i = 0; i < otd.otd.GetSize (); i++) {
DrawEdge (storyLevels, otd.otd[i], wallelement, subelementByparent);
}
}
}
return NoError;
});
});
}

void DrawEdge (const Stories& storyLevels, OtdWall& edges, API_Element& wallelement, UnicElement& subelementByparent)
Expand Down
1 change: 1 addition & 0 deletions Sources/AddOn/Roombook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ bool FindEdge (Sector& edge, GS::Array<Sector>& edges);

void DrawEdges (const Stories& storyLevels, GS::HashTable < API_Guid, OtdRoom>& zoneelements, UnicElement& subelementByparent);
void DrawEdge (const Stories& storyLevels, OtdWall& edges, API_Element& wallelement, UnicElement& subelementByparent);

// -----------------------------------------------------------------------------
// Связывание созданных элементов отделки с базовыми элементами
// -----------------------------------------------------------------------------
Expand Down
8 changes: 6 additions & 2 deletions Sources/AddOnResources/RINT/AddOn.grc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'STR#' ID_ADDON_INFO "Add-on Name and Description" {
/* [ 1] */ "SomeStuff"
/* [ 2] */ "Синхронизация свойств и параметров GDL элементов v1.76 2025-02-03-20 https://github.com/kuvbur/AddOn_SomeStuff"
/* [ 2] */ "Синхронизация свойств и параметров GDL элементов v1.76 2025-02-19-10 https://github.com/kuvbur/AddOn_SomeStuff"
}

'STR#' 32500 "Strings for the Menu" {
Expand Down Expand Up @@ -61,6 +61,7 @@
/* [ 15] */ "Обновить геометрию фасонки по выбранному^E3^ES^EE^ED^EW^EL^S^R^T^32614"
/* [ 16] */ "Построить профиль по линии^E3^ES^EE^ED^EW^EL^S^R^T^32615"
/* [ 17] */ "Выронять выделенные чертежи^E3^ES^EE^ED^EW^EL^S^R^T^32616"
/* [ 18] */ "Ведомость отделки^E3^ES^EE^ED^EW^EL^32602"
}

'STR#' 30502 "Strings for the Menu" {
Expand All @@ -82,6 +83,7 @@
/* [ 15] */ "Обновить геометрию фасонки по выбранному"
/* [ 16] */ "Построить профиль по линии"
/* [ 17] */ "Выронять выделенные чертежи"
/* [ 18] */ "Ведомость отделки"
}


Expand Down Expand Up @@ -126,7 +128,7 @@

'STR#' ID_ADDON_INFO_ENG "Add-on Name and Description" {
/* [ 1] */ "SomeStuff"
/* [ 2] */ "Sync of GDL properties and parameters v1.76 2025-02-03-20 https://github.com/kuvbur/AddOn_SomeStuff"
/* [ 2] */ "Sync of GDL properties and parameters v1.76 2025-02-19-10 https://github.com/kuvbur/AddOn_SomeStuff"
}

'STR#' 33500 "Strings for the Menu" {
Expand Down Expand Up @@ -184,6 +186,7 @@
/* [ 15] */ "Обновить геометрию фасонки по выбранному^E3^ES^EE^ED^EW^EL^S^R^T^32614"
/* [ 16] */ "Построить профиль по линии^E3^ES^EE^ED^EW^EL^S^R^T^32615"
/* [ 17] */ "Выронять выделенные чертежи^E3^ES^EE^ED^EW^EL^S^R^T^32616"
/* [ 18] */ "Ведомость отделки^E3^ES^EE^ED^EW^EL^32602"
}


Expand All @@ -206,6 +209,7 @@
/* [ 15] */ "Обновить геометрию фасонки по выбранному"
/* [ 16] */ "Построить профиль по линии"
/* [ 17] */ "Выронять выделенные чертежи"
/* [ 18] */ "Ведомость отделки"
}


Expand Down
2 changes: 1 addition & 1 deletion Tools/build_ac.bat
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
cd ..
"c:\program files\python310\python.exe" Tools/BuildAddOn.py --configFile config.json --acVersion 25
"c:\program files\python385\python.exe" Tools/BuildAddOn.py --configFile config.json --acVersion 25

0 comments on commit e677538

Please sign in to comment.