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

AC24 how to change rectangle columns section width and height?

Boling1
Contributor

I can create a rectangle column, but don't know how to change section width and height, AC24:

 

 

void Do_CreateColumn (void)
{
  API_Coord point;

  if (!ClickAPoint ("Pick a point", &point)) {
    return;
  }

  API_Element element;
  API_ElementMemo memo;
  BNClear (element);
  BNClear (memo);

  element.header.typeID = API_ColumnID; // set as a column
  GSErrCode err = ACAPI_Element_GetDefaults (&element, &memo); //get current setting

  if (err != NoError) {
    ACAPI_WriteReport ("ACAPI_Element_GetDefaults (Column) has failed with error code %ld!", true, err);
    ACAPI_DisposeElemMemoHdls (&memo);
    return;
  }

  element.column.origoPos = point;
  element.column.bottomOffset = -0.05;
  element.column.topOffset = -0.05;
  element.column.axisRotationAngle = 45; //rotate
  memo.elemInfoString = new GS::UniString("KZ-1"); //uset ID

  err = ACAPI_Element_Create (&element, &memo); //create the column
  if (err != NoError) {
    ACAPI_WriteReport ("ACAPI_Element_Create (Column) has failed with error code %ld!", true, err);
  }

  char buffer[65];
  sprintf(buffer, "%s%d", "Column Segment:", element.column.nSegments); //1 segment in fact

  MessageBox(NULL, buffer, "Grand", 0); //display how many segments 
  //modify section width and height     ACAPI_CallUndoableCommand 进程中-----------------------------

  ????how to change the section width and height of this column ???

  ACAPI_DisposeElemMemoHdls (&memo);
} // Do_CreateColumn

 

ArchiCAD 25
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
poco2013
Mentor

I had to go back and look at my notes and still didn't figure it out. I don't know how the define a segment column and a column without segments.

But you can use a single segment column by using the memo fields and set nsegments as 1;

 then use:

element.header.typeID = API_ColumnID;
	GSErrCode err = ACAPI_Element_GetDefaults (&element, &memo);

element.column.origoPos = point;
	element.column.nSegments = 1;
	memo.columnSegments[0].assemblySegmentData.buildingMaterial = ??;
	memo.columnSegments[0].assemblySegmentData.nominalHeight = ??;
	memo.columnSegments[0].assemblySegmentData.nominalWidth = ??;
	memo.columnSegments[0].assemblySegmentData.modelElemStructureType = API_BasicStructure; or ???

 

For more nsegments change the index of columnsegment in memo

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27

View solution in original post

2 REPLIES 2
Solution
poco2013
Mentor

I had to go back and look at my notes and still didn't figure it out. I don't know how the define a segment column and a column without segments.

But you can use a single segment column by using the memo fields and set nsegments as 1;

 then use:

element.header.typeID = API_ColumnID;
	GSErrCode err = ACAPI_Element_GetDefaults (&element, &memo);

element.column.origoPos = point;
	element.column.nSegments = 1;
	memo.columnSegments[0].assemblySegmentData.buildingMaterial = ??;
	memo.columnSegments[0].assemblySegmentData.nominalHeight = ??;
	memo.columnSegments[0].assemblySegmentData.nominalWidth = ??;
	memo.columnSegments[0].assemblySegmentData.modelElemStructureType = API_BasicStructure; or ???

 

For more nsegments change the index of columnsegment in memo

Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
Boling1
Contributor

thank you very much,it works fine!

Great!

ArchiCAD 25