Skip to content

Commit

Permalink
Добавил связывание элементов отделки с базовыми элементами
Browse files Browse the repository at this point in the history
Также поправил #132
  • Loading branch information
kuvbur committed Feb 20, 2025
1 parent 5d7bc07 commit 55fbf29
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 70 deletions.
11 changes: 5 additions & 6 deletions Sources/AddOn/CommonFunction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <limits>
#include <math.h>


Stories GetStories ()
{
Stories stories;
Expand Down Expand Up @@ -533,8 +532,8 @@ void msg_rep (const GS::UniString& modulename, const GS::UniString& reportString
layer.header.typeID = API_LayerID;
layer.header.index = elem_head.layer;
if (ACAPI_Attribute_Get (&layer) == NoError) error_type = error_type + " layer:" + layer.header.name;
}
}
}
}
GS::UniString msg = modulename + ": " + reportString;
if (!show) msg = msg + " " + error_type;
msg = "SomeStuff addon: " + msg + "\n";
Expand All @@ -546,7 +545,7 @@ void msg_rep (const GS::UniString& modulename, const GS::UniString& reportString
#if defined(TESTING)
DBprnt (msg);
#endif
}
}


// --------------------------------------------------------------------
Expand Down Expand Up @@ -929,7 +928,7 @@ bool ReserveElement (const API_Guid & objectId, GSErrCode & err)
}
};
return false; // Не получилось зарезервировать
}
}


// --------------------------------------------------------------------
Expand Down Expand Up @@ -1373,7 +1372,7 @@ void GetGDLParametersHead (const API_Element & element, const API_Elem_Head & el
break;
}
return;
}
}

// -----------------------------------------------------------------------------
// Возвращает список параметров API_AddParType из memo
Expand Down
2 changes: 2 additions & 0 deletions Sources/AddOn/CommonFunction.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ typedef struct
// Словарь с форматированием и округлением
typedef GS::HashTable<API_PropertyMeasureType, FormatString> FormatStringDict;

// Словарь уникальных API_Guid
typedef GS::HashTable<API_Guid, bool> UnicGuid;
// -----------------------------------------------------------------------------
// Читает информацию об этажах в проекте
// -----------------------------------------------------------------------------
Expand Down
58 changes: 31 additions & 27 deletions Sources/AddOn/Helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3506,6 +3506,10 @@ void ParamHelpers::ElementsRead (ParamDictElement& paramToRead, ParamDictValue&
void ParamHelpers::Read (const API_Guid& elemGuid, ParamDictValue& params, ParamDictValue& propertyParams, ClassificationFunc::SystemDict& systemdict)
{
if (params.IsEmpty ()) return;
if (elemGuid == APINULLGuid) {
msg_rep ("ParamDictRead", "elemGuid == APINULLGuid", APIERR_GENERAL, elemGuid);
return;
}
API_Elem_Head elem_head = {};
elem_head.guid = elemGuid;
GSErrCode err = ACAPI_Element_GetHeader (&elem_head);
Expand Down Expand Up @@ -3702,7 +3706,7 @@ void ParamHelpers::Read (const API_Guid& elemGuid, ParamDictValue& params, Param
}
}
}
}
}
#if defined(TESTING)
DBprnt (" ConvertByFormatString");
#endif
Expand Down Expand Up @@ -3757,7 +3761,7 @@ void ParamHelpers::GetLocOriginToParamDict (ParamDictValue& propertyParams)
if (err != NoError) {
msg_rep ("GetLocOriginToParamDict", "APIDb_GetLocOrigoID", err, APINULLGuid);
return;
}
}
#if defined AC_27 || defined AC_28
err = ACAPI_ProjectSetting_GetOffset (&offset);
#else
Expand Down Expand Up @@ -3850,7 +3854,7 @@ void ParamHelpers::GetAllAttributeToParamDict (ParamDictValue& propertyParams)
if (err != NoError) {
msg_rep ("GetAllAttributeToParamDict", "ACAPI_Attribute_GetNum", err, APINULLGuid);
return;
}
}
#if defined(AC_27) || defined(AC_28)
for (UInt32 i = 1; i <= nAttr && err == NoError; i++) {
#else
Expand Down Expand Up @@ -4133,7 +4137,7 @@ void ParamHelpers::AllPropertyDefinitionToParamDict (ParamDictValue & propertyPa
}
}
}
}
}
ParamHelpers::AddValueToParamDictValue (propertyParams, "flag:has_ProperyDefinition");
#if defined(TESTING)
DBprnt (" AllPropertyDefinitionToParamDict end");
Expand Down Expand Up @@ -4352,7 +4356,7 @@ bool ParamHelpers::ReadClassification (const API_Guid & elemGuid, const Classifi
}
}
return flag_find;
}
}

// -----------------------------------------------------------------------------
// Получение аттрибутов элемента
Expand Down Expand Up @@ -4632,7 +4636,7 @@ bool ParamHelpers::ReadGDL (const API_Element & element, const API_Elem_Head & e
}
if (flag_find_name) ParamHelpers::CompareParamDictValue (paramByName, params);
return (flag_find_name);
}
}

// -----------------------------------------------------------------------------
// Поиск по описанию GDL параметра
Expand Down Expand Up @@ -4890,9 +4894,9 @@ bool ParamHelpers::ReadMaterial (const API_Element & element, ParamDictValue & p
#endif
}
}
}
}
}
}
}
bool flag_add = false;

// Если есть строка-шаблон - заполним её
Expand Down Expand Up @@ -5013,7 +5017,7 @@ bool ParamHelpers::ReadMaterial (const API_Element & element, ParamDictValue & p
params.Get (rawName).val.type = API_PropertyStringValueType;
params.Get (rawName).composite = param_composite.composite;
}
}
}
return flag_add;
}

Expand Down Expand Up @@ -5223,19 +5227,19 @@ bool ParamHelpers::ConvertToParamValue (ParamValueData & pvalue, const API_AddPa
#endif
param_real = param_int / 1.0;
pvalue.formatstring = FormatStringFunc::ParseFormatString ("0m");
} else {
} else {
return false;
}
}
}
}
pvalue.boolValue = param_bool;
pvalue.doubleValue = param_real;
pvalue.rawDoubleValue = param_real;
pvalue.hasrawDouble = true;
pvalue.intValue = param_int;
pvalue.uniStringValue = param_string;
return true;
}
}

// -----------------------------------------------------------------------------
// Конвертация параметра-массива библиотечного элемента (тип API_ParArray) в ParamValue
Expand Down Expand Up @@ -5371,7 +5375,7 @@ bool ParamHelpers::ConvertToParamValue (ParamValue & pvalue, const API_Property
pvalue.isValid = property.isEvaluated;
if (property.isDefault && !property.isEvaluated) {
value = property.definition.defaultValue.basicValue;
} else {
} else {
value = property.value;
}
#else
Expand Down Expand Up @@ -5882,7 +5886,7 @@ bool ParamHelpers::ComponentsCompositeStructure (const API_Guid & elemguid, API_
ParamHelpers::GetAttributeValues (constrinxL, params, paramsAdd);
existsmaterial.Add (constrinxL, true);
}
}
}
for (GS::HashTable<GS::UniString, ParamValue>::PairIterator cIt = paramlayers.EnumeratePairs (); cIt != NULL; ++cIt) {
#if defined(AC_28)
paramlayers.Get (cIt->key).composite = param_composite.composite;
Expand All @@ -5893,7 +5897,7 @@ bool ParamHelpers::ComponentsCompositeStructure (const API_Guid & elemguid, API_
ParamHelpers::CompareParamDictValue (paramlayers, params);
ACAPI_DisposeAttrDefsHdls (&defs);
return true;
}
}

// --------------------------------------------------------------------
// Получение данных из сложного профиля
Expand Down Expand Up @@ -6020,16 +6024,16 @@ bool ParamHelpers::ComponentsProfileStructure (ProfileVectorImage & profileDescr
cutline.c2 = segment[j].c2;
min_r = r;
}
}
}
#if defined(AC_28)
lines.Get (cIt->key).cut_start = cutline.c2;
lines.Get (cIt->key).cut_direction = Geometry::SectorVector (cutline);
#else
lines.Get (*cIt->key).cut_start = cutline.c2;
lines.Get (*cIt->key).cut_direction = Geometry::SectorVector (cutline);
#endif
}
}
}
bool hasData = false;
ConstProfileVectorImageIterator profileDescriptionIt1 (profileDescription);
while (!profileDescriptionIt1.IsEOI ()) {
Expand Down Expand Up @@ -6081,18 +6085,18 @@ bool ParamHelpers::ComponentsProfileStructure (ProfileVectorImage & profileDescr
existsmaterial.Add (constrinxL, true);
}
hasData = true;
}
}
}
}
} else {
}
}
}
} else {
#if defined(TESTING)
DBprnt ("ERR == syHatch.ToPolygon2D ====================");
#endif
}
}
}
break;
}
}
++profileDescriptionIt1;
}
if (hasData) {
Expand Down Expand Up @@ -6126,12 +6130,12 @@ bool ParamHelpers::ComponentsProfileStructure (ProfileVectorImage & profileDescr
}
}
ParamHelpers::CompareParamDictValue (paramlayers, params);
}
}
return hasData;
#else
return false;
#endif
}
}
// --------------------------------------------------------------------
// Вытаскивает всё, что может, из информации о составе элемента
// --------------------------------------------------------------------
Expand Down Expand Up @@ -6244,7 +6248,7 @@ bool ParamHelpers::Components (const API_Element & element, ParamDictValue & par
default:
return false;
break;
}
}
ACAPI_DisposeElemMemoHdls (&memo);

// Типов вывода слоёв может быть насколько - для сложных профилей, для учёта несущих/ненесущих слоёв
Expand Down Expand Up @@ -6297,7 +6301,7 @@ bool ParamHelpers::Components (const API_Element & element, ParamDictValue & par
}
#endif
return hasData;
}
}

// --------------------------------------------------------------------
// Заполнение данных для одного слоя
Expand Down
Loading

0 comments on commit 55fbf29

Please sign in to comment.