How to use ChangeDefaultsExt to MyDoor Object
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-03-05
03:01 PM
- last edited on
‎2023-08-01
01:34 PM
by
Doreena Deng
‎2015-03-05
03:01 PM
I would like to ChangeDefaults Door and Window(Change Object).
Ex.
- I have 2 door object [MyDoor1.gsm , MyDoor2.gsm].
- And "MyDoor1" is Defaults object then i would like change to "MyDoor2" object.
Ex.
- I have 2 door object [MyDoor1.gsm , MyDoor2.gsm].
- And "MyDoor1" is Defaults object then i would like change to "MyDoor2" object.
Labels:
- Labels:
-
Add-On (C++)
5 REPLIES 5
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-03-06 12:23 AM
‎2015-03-06
12:23 AM
Traro wrote:Traro,
I would like to ChangeDefaults Door and Window(Change Object).
Ex.
- I have 2 door object [MyDoor1.gsm , MyDoor2.gsm].
- And "MyDoor1" is Defaults object then i would like change to "MyDoor2" object.
If i understand you question properly, you can alt-click on an existing object in the floorplan to make that the default object when a new instance is placed.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-03-06 12:00 PM
‎2015-03-06
12:00 PM
Traro wrote:I suggest first getting the object defaults with
I would like to ChangeDefaults Door and Window(Change Object).
Ex.
- I have 2 door object [MyDoor1.gsm , MyDoor2.gsm].
- And "MyDoor1" is Defaults object then i would like change to "MyDoor2" object.
I can't recollect whether it's essential to get the default parameters for this object to set in the tool defaults, but you can get this information using
Ralph Wessel BArch
Central Innovation
Central Innovation
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-03-06 04:10 PM
‎2015-03-06
04:10 PM
Ralph wrote:I absolutely agree with Ralph Wessel using these methods to change the default object. I wrote a code sample based on these methods,Traro wrote:I suggest first getting the object defaults with
I would like to ChangeDefaults Door and Window(Change Object).
Ex.
- I have 2 door object [MyDoor1.gsm , MyDoor2.gsm].
- And "MyDoor1" is Defaults object then i would like change to "MyDoor2" object.ACAPI_Element_GetDefaults. The critical information required for setting the correct library part is the libIndvalue in the API_ObjectTypestructure. This is a temporary index to the object in the loaded libraries. You can find this using ACAPI_LibPart_Searchwith the name of the target object.
I can't recollect whether it's essential to get the default parameters for this object to set in the tool defaults, but you can get this information usingACAPI_LibPart_GetParams(parameters and default size).
which changes the default door object to "Door with Sidelight on Side 1 19". I hope it will be helpfull:
API_LibPart libDoor; API_Element elementDoor; API_ElementMemo memo; GSErrCode err = NoError; // Get defaults for door element BNZeroMemory (&elementDoor, sizeof (API_Element)); elementDoor.header.typeID = API_DoorID; err = ACAPI_Element_GetDefaults (&elementDoor, &memo); if (err != NoError) { WriteReport_Alert ("Cannot get door defaults"); return; } // Get a door object from library using its name BNZeroMemory (&libDoor, sizeof (libDoor)); const GS::UniString uName ("Door with Sidelight on Side 1 19"); GS::ucscpy (libDoor.docu_UName, uName.ToUStr ()); err = ACAPI_LibPart_Search (&libDoor, false); if (err != NoError) { WriteReport_Alert ("No libpart found with that name"); return; } delete libDoor.location; // don't forget to free location // Change libInd of the default door to the new one { API_Element mask; ACAPI_ELEMENT_MASK_CLEAR (mask); ACAPI_ELEMENT_MASK_SET (mask, API_DoorType, openingBase.libInd); elementDoor.door.openingBase.libInd = libDoor.index; err = ACAPI_Element_ChangeDefaults (&elementDoor, &memo, &mask); if (err != NoError) { WriteReport_Alert ("Cannot change door defaults"); return; } } // Check whether defaults were updated { API_Element elementDoor2; elementDoor2.header.typeID = API_DoorID; err = ACAPI_Element_GetDefaults (&elementDoor2, NULL); if (err != NoError) { WriteReport_Alert ("Cannot get door defaults"); return; } if (elementDoor2.door.openingBase.libInd != libDoor.index) { WriteReport_Alert ("Door default settings were not updated"); return; } }This example changes only the default door object nothing more (e.g. not using default parameters of this door object).
Traro,
Is this what you searching for?
Tamás Zolnai
Graphisoft
Graphisoft
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-03-11 09:31 AM
‎2015-03-11
09:31 AM
Thanks to everyone





Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2015-03-13 02:58 PM
‎2015-03-13
02:58 PM
To load also the default parameters (e.g. marker) of the door object from library,
amend the code as the following lines shows ('+' means additions):
amend the code as the following lines shows ('+' means additions):
... // Change libInd of the default door to the new one { API_Element mask; ACAPI_ELEMENT_MASK_CLEAR (mask); ACAPI_ELEMENT_MASK_SET (mask, API_DoorType, openingBase.libInd); elementDoor.door.openingBase.libInd = libDoor.index; + // Set default params of the new door object + { + double a, b; + Int32 addParNum; + API_AddParType **addPars; + + err = ACAPI_LibPart_GetParams (libDoor.index, &a, &b, &addParNum, &addPars); + if (err) { + WriteReport_Alert ("Cannot get libpart params"); + return; + } + memo.params = addPars; + } err = ACAPI_Element_ChangeDefaults (&elementDoor, &memo, &mask); if (err != NoError) { WriteReport_Alert ("Cannot change door defaults"); return; } + ACAPI_DisposeElemMemoHdls (&memo); } ...
Tamás Zolnai
Graphisoft
Graphisoft