We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.

[SOLVED] Level Dimension dimForm not recognizing symbols

Erenford
Booster
Greetings, I've tried creating a Level Dimension element with 'dimForm' set to 10 and after creation it reverts back to 0. Even if I don't set it thru code (just the ACAPI_Element_GetDefaults) but set the symbol thru ArchiCAD as default it still reverts back to 0 upon creation of element. Further experimentation reveals values 10 and above are not being recognize by API; these are also symbols not in the documentation.

I've attached a picture with all the symbols and respective values along with the documentation with symbol pic. Circled ones are not being accepted.

Any solution for this?

Level Dimension dimForm.PNG
5 REPLIES 5
Erenford
Booster
I've experimented a little bit and found a partial solution and another problem. Since the symbol I need is available from the accepted ones only that the text is different, I just used 'dimForm = 0' (with superscripted text) then adjusted the text position for my liking.

The problem I encountered is that "create -> adjust" only works for static level, for the attached with parent type the ACAPI_Element_Change throws out a APIERR_GENERAL.

I've also notice that the dimForm documentation image is updated on AC20 (same as the options in Lvl Dim settings) unlike before on AC19, but it's still not working though (the testing below is done using AC20 v3012)

Testing:
- Set the Lvl Dim with note1.pos already adjusted then create -> Does not apply the position

- Create the Lvl Dim as static then adjust note1.pos then change -> Success

- Create the Lvl Dim with parent then set (or even nothing, just cleared mask) then change -> APIERR_GENERAL

- Create with dimForm as 10+ -> Will not apply, reverts back to value 0

- Change the element (after creation and as static type) dimForm to 10+ -> Does not also work, reverts to value 0

The code I used:

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));
	}
}
Katalin Borszeki
Graphisoft
Graphisoft
Hi Erenford, this is an error on our end. Thanks for letting us know, we have entered it in the development database and planning to fix it soon.
Best, k
Katalin Borszeki
Implementation Specialist
GRAPHISOFT

http://helpcenter.graphisoft.com - the ArchiCAD knowledge base
Erenford
Booster
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. On ACAPI_Element_Create, dimension.ed_dimForm accepts 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. When dimension.ed_dimForm = 5, I've tried looking up which of API_DimensionType variables 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 if ed_dimForm = 5 is not currently the default.
Any help on this?

Thanks for the help.
Dimension - ElevDim.png
Akos Somorjai
Graphisoft
Graphisoft
Erenford wrote:
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. On ACAPI_Element_Create, dimension.ed_dimForm accepts 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. When dimension.ed_dimForm = 5, I've tried looking up which of API_DimensionType variables 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 if ed_dimForm = 5 is not currently the default.
Any help on this?

Thanks for the help.
Hi Erenford,

The first issue has been fixed in AC20 build 5518, so any update with a higher build number contains the fix.

The second issue is another a bug, thanks for pointing out!

Best, Akos
Erenford
Booster
Thanks Akos I'll update my AC20 then check it again