2021-09-1807:37 AM - last edited on 2021-09-1911:18 PM by Noemi Balogh
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 .
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);
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