cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

Creating assosiative dimensions

yahavsa
Contributor

Hello,

I'm trying to create an associated dimensions in a wall, without success yet...

I'm following the "Do_CreateAssociativeDimensions" under "Element_Basic" in the Element_Test example, and I saw there that the function creates a dimension on the narrow part of the wall while I try to create a dimension on the long part of the wall. In addition, I tried to change the inindex which didn't help me too much... I did not understand why the numbers 11 and 21 were used inside the inindex function (in the example), what these specific numbers represent, and how I am supposed to understand what numbers I should use to create a dimension on the long part of the wall?
Thanks!

Windows 11, Visual Studio 2019, ArchiCAD 26, C++

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Hi Yahavsa,

 

To get the information you need, I think it's best to make the element you want manually and then do ACAPI_Element_Get and ACAPI_Element_GetMemo to investigate the data of which it is composed. This way I found that you can make a dimension along the wall reference line the following way.

 

  1. In function AssociativeDimensionsOnWallThickness::Create () replace the relevant lines with:
    // length dim
    const API_Coord dimRefPoint { 0, 0 };
    const API_Vector dimDirection { 0, 1 };	// parallel to wall
  2. In function CreateDimension change the following lines to:
    dimElem.base.base.line = false;
    dimElem.base.base.inIndex = (dimElemIdx == 0) ? 1 : 2;
    dimElem.base.base.special = 1;

 

This also fits with the documentation of the Wall Neigs.

Unfortunately I wasn't able to figure out why numbers 11 and 21 are used for inIndex for the wall thickness.



Hope that helps!

Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com

View solution in original post

1 REPLY 1
Solution

Hi Yahavsa,

 

To get the information you need, I think it's best to make the element you want manually and then do ACAPI_Element_Get and ACAPI_Element_GetMemo to investigate the data of which it is composed. This way I found that you can make a dimension along the wall reference line the following way.

 

  1. In function AssociativeDimensionsOnWallThickness::Create () replace the relevant lines with:
    // length dim
    const API_Coord dimRefPoint { 0, 0 };
    const API_Vector dimDirection { 0, 1 };	// parallel to wall
  2. In function CreateDimension change the following lines to:
    dimElem.base.base.line = false;
    dimElem.base.base.inIndex = (dimElemIdx == 0) ? 1 : 2;
    dimElem.base.base.special = 1;

 

This also fits with the documentation of the Wall Neigs.

Unfortunately I wasn't able to figure out why numbers 11 and 21 are used for inIndex for the wall thickness.



Hope that helps!

Bernd

Bernd Schwarzenbacher - Archicad Add-On Developer - Get Add-Ons & Archicad Tips on my Website: Archi-XT.com