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

Looking for API function definition

Anonymous
Not applicable
Hi guys,

How can I find, if possible, the definition of ACAPI_Property_CreatePropertyDefinition? I modified Element_Test example to have a menu command to open a text file and import the settings but I got a crash in this function
6 REPLIES 6
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi,

Could you show me please the definition of your PropertyTestHelpers::CreateProperty function?
I think a little mistake in that function causes the crash.

The definitions of ACAPI functions are inside ARCHICAD, so they are not public.

Regards,
Tibor
Anonymous
Not applicable
Here it is, and is working on Mac:

API_PropertyDefinition PropertyTestHelpers::CreateProperty (API_PropertyGroup group, const char * name)
{
API_PropertyDefinition definition;
definition.guid = APINULLGuid;
definition.groupGuid = group.guid;

GS::UniString uniName (name, CC_UTF8);
definition.name = uniName;

definition.description = "Custom property set by ArchiCADImporter";
definition.collectionType = API_PropertySingleCollectionType;
definition.valueType = API_PropertyStringValueType;
definition.defaultValue.singleVariant.variant.type = definition.valueType;
return definition;
}
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
n.mihaylov wrote:
GS::UniString uniName (name, CC_UTF8);
definition.name = uniName;
Are you sure that the "name" string has UTF8 encoding?
Could you replace these two lines with the following one line and retry it please?
definition.name = name;
Anonymous
Not applicable
Thanks but no luck, the same crash
There is "something" different here between Win and Mac (it's working on Mac) and now I'll try to investigate.
dfintha
Graphisoft Alumni
Graphisoft Alumni
Hello,

Could you please provide some example strings, that are used as names for the Property Definitions?
I could not reproduce the same issue yet.

Best regards,
Dénes
Anonymous
Not applicable
Hi,

I fixed the problem several lines further, where I was setting the availability, although the addon crashed "here".