Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Create a new Model View Options

Jahidur
Participant

Hi,
In a custom Add-On i try to create a new custom Model View Options. Using the "ACAPI_Attribute_Get" i can get access the API_Attribute properties and in that properties i can get any specific Model View Options related properties. But when i try to use the "ACAPI_Attribute_Create" method to create a new Model View Options. I get an error (-2130313115 "The passed identifier is not a valid one, or valid, but not proper for the given operation.") . Is there any possible way to create a new Model View Options?

 

My current coding approach to do this task is given bellow .

 

 

API_Attribute     attrib;
API_AttributeDef		defs;
API_AttributeIndex ModelIndex;
GSErrCode err;

BNZeroMemory(&attrib, sizeof(API_Attribute));
BNZeroMemory(&defs, sizeof(API_AttributeDef));

attrib.header.typeID = API_ModelViewOptionsID;
attrib.header.index = 3;

err = ACAPI_Attribute_Get(&attrib);

GS::UniString name = attrib.modelViewOpt.head.name;

short temp2 = 0;
char customName[API_AttrNameLen] = "New Custom ";
strcpy(attrib.modelViewOpt.head.name, customName); // Set the new name

err = ACAPI_Attribute_Create(&attrib, &defs); 

 

 

 

1 REPLY 1

bschwb
Booster

Hi Jahidur,

I think to create a new Model View Option, you would also have to change the index. Right now you are retrieving an MVO with index=3 and then you try to create an MVO with index=3. So for the ACAPI_Attribute_Create function you should choose an index that is not already existing. I would try ACAPI_Attribute_GetNum and use an index higher than the count you get from that function.

Another error could be, that it could also be that MVO with index=3 is not existing so your ACAPI_Attribute_Get function already has an error and &attrib doesn't contain sensible data.

Hope this helps

Bernd Schwarzenbacher
Archicad Add-On Developer
AC 24-25, VS 2019

Get free Add-Ons at www.bschwb.com/add-ons

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!