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

Cannot set properties of curtain walls

dan
Newcomer
Hello ARCHICAD community,

For some reason I cannot successfully set properties for curtain wall elements (error code: -2130313112, "The passed parameters are inconsistent." according to http://archicadapi.graphisoft.com/documentation/error-codes)

It is not a problem for GUIDs of windows, doors, etc. but curtain walls always produce this error code. I am aware that the curtain wall is a composite element, however, shouldn't the property values be attached to a curtain wall element in the same way as a window for example?

Here is the simplified code I am using:

GS::Array<API_PropertyDefinition> propertyDefinitions;
GS::Array<API_Property> properties;

ACAPI_Element_GetPropertyDefinitions(guid, API_PropertyDefinitionFilter_UserDefined, propertyDefinitions);
ACAPI_Element_GetPropertyValues(guid, propertyDefinitions, properties);

ACAPI_Element_SetProperties(guid, properties)
In the real code I modify the property values before writing them again, however even untouched (read properties, write properties) I get this error. For getting the property definitions and values I do not get any error with a curtain wall.

Also I already confirmed that the GUID is really the one of the facade/curtain wall element itself, by printing the ElementID of its property.

Thanks for any help in advance!
- Dan
ARCHICAD 22 (Windows 7 Professional 64-Bit), VS 2017
1 ACCEPTED SOLUTION

Solution
Tibor Lorantfy
Advisor
Hi Dan,

ACAPI_Element_GetPropertyValues returns those expression based properties also which cannot be evaluated for the element (isEvaluated is false). ACAPI_Element_SetProperties/ACAPI_Element_SetProperty functions do not allow to set not evaluable properties, that's why you got APIERR_BADPARS error.
If you filter out those not evaluable properties, then it will work (see example code below).

ACAPI_Element_GetPropertyDefinitions returns the read-only property definitions also (canValueBeEditable is false). If you try to set those read-only properties using ACAPI_Element_SetProperties/ACAPI_Element_SetProperty, then you will get APIERR_READONLY error.

You can easily filter out the non editable and not evaluable properties like this:
for (UIndex ii = properties.GetSize (); ii >= 1; --ii) {
	const API_Property& p = properties.Get (ii - 1);
	if (p.definition.canValueBeEditable == false || p.isEvaluated == false)
		properties.Delete (ii - 1);
}

ACAPI_Element_SetProperties (guid, properties);

Best Regards,
Tibor

View solution in original post

2 REPLIES 2

kzaremba
Newcomer
I haven't tried this particular add. But in my case adding value works for Panels inside CW.. In my case I'm using ACAPI_​Element_​SetProperty. Maybe try this one to test if it's working for one Prop.

Solution
Tibor Lorantfy
Advisor
Hi Dan,

ACAPI_Element_GetPropertyValues returns those expression based properties also which cannot be evaluated for the element (isEvaluated is false). ACAPI_Element_SetProperties/ACAPI_Element_SetProperty functions do not allow to set not evaluable properties, that's why you got APIERR_BADPARS error.
If you filter out those not evaluable properties, then it will work (see example code below).

ACAPI_Element_GetPropertyDefinitions returns the read-only property definitions also (canValueBeEditable is false). If you try to set those read-only properties using ACAPI_Element_SetProperties/ACAPI_Element_SetProperty, then you will get APIERR_READONLY error.

You can easily filter out the non editable and not evaluable properties like this:
for (UIndex ii = properties.GetSize (); ii >= 1; --ii) {
	const API_Property& p = properties.Get (ii - 1);
	if (p.definition.canValueBeEditable == false || p.isEvaluated == false)
		properties.Delete (ii - 1);
}

ACAPI_Element_SetProperties (guid, properties);

Best Regards,
Tibor

View solution in original post

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!