We value your input! Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey
2016-11-29 09:56 AM - last edited on 2023-07-12 09:03 PM by Doreena Deng
2016-12-02 03:50 AM
void CreateLevelDimension(API_Element& i_elemParent) { API_Element elem; GSErrCode err = NoError; BNZeroMemory(&elem, sizeof(elem)); elem.header.typeID = API_LevelDimensionID; err = ACAPI_Element_GetDefaults(&elem, nullptr); if (err != NoError) { DBGPrintlnf("["__FUNC__"] ERROR %s - ACAPI_Element_GetDefaults", ErrId2Name(err)); return; } // get the center of the element tdv_Coord coordList = GetMemoCoords(i_elemParent, false); API_Coord centerPoly = GetPolyCentroid(coordList, false); elem.levelDimension.loc = centerPoly; // elem.levelDimension.dimForm = 4; // static type elem.levelDimension.staticLevel = true; // attached to parent // elem.levelDimension.staticLevel = false; // elem.levelDimension.parentGuid = i_elemParent.header.guid; // elem.levelDimension.parentType = i_elemParent.header.typeID; ACAPI_CallUndoableCommand("Create Level Dimension", [&] () -> GSErrCode { err = ACAPI_Element_Create(&elem, nullptr); return NoError; }); if (err != NoError) { DBGPrintlnf("["__FUNC__"] ERROR %s - ACAPI_Element_Create", ErrId2Name(err)); return; } // Get the newly created element then change the text position err = ACAPI_Element_Get(&elem); if (err != NoError) { DBGPrintlnf("["__FUNC__"] ERROR %s - ACAPI_Element_Get()", ErrId2Name(err)); return; } // elem.levelDimension.dimForm = 14; // Adjust the text elem.levelDimension.note1.pos.x += 0.125; elem.levelDimension.note1.pos.y += -0.375; API_Element elemMask; ACAPI_ELEMENT_MASK_CLEAR(elemMask); ACAPI_ELEMENT_MASK_SET(elemMask, API_LevelDimensionType, note1.pos); // ACAPI_ELEMENT_MASK_SET(elemMask, API_LevelDimensionType, dimForm); ACAPI_CallUndoableCommand("Change Element", [&] () -> GSErrCode { err = ACAPI_Element_Change(&elem, &elemMask, nullptr, NULL, true); return NoError; }); if (err != NoError) { DBGPrintlnf("[Error] %s "__FUNC__" - ACAPI_Element_Change()", ErrId2Name(err)); } }
2017-02-09 02:00 PM
2017-07-04 06:45 AM
2017-07-04 02:15 PM
Erenford wrote:Hi Erenford,
Hello again, I found some issues about Dimensions this time and it looks like its related to this so I'll just post it here.
This is when creating Elevation Dimensions (dimension.dimAppear = APIApp_Elev😞
1. OnACAPI_Element_Create, dimension.ed_dimFormaccepts values 1-5 but not 0, 6, 7 (see left image for reference). If those values are passed it reverts back to symbol 1.
2. Whendimension.ed_dimForm = 5, I've tried looking up which of API_DimensionTypevariables corresponds to the settings dialog (see right image for ref) and I can't figure out which one affects the "Level Dimension Marker Style" (green circled on the image). If I pick the 1st one then displayed the struct's values, it's the same values when I then pick the 2nd or 3rd style.
On creation though it doesn't revert to a default value, it uses whatever the chosen style on the default settings dialog, even ifed_dimForm = 5is not currently the default.
Any help on this?
Thanks for the help.
2017-07-06 07:39 AM