cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
License Delivery maintenance is expected to occur on Saturday, October 19, between 4 and 6 PM CEST. This may cause a short 60-minute outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool may not function properly. We apologize for any inconvenience.
Archicad C++ API
About Archicad add-on development using the C++ API.

Connection type value in API_ChangeParamType

Emkave
Contributor

Hello everyone,

I'm encountering an issue while setting parameters for certain objects using the Archicad API.

I have an instance of the API_ChangeParamType class (let's refer to it as object). This object has some crucial attributes, specifically name and uStrValue.

I've correctly assigned object.name as "connectionType". However, I'm facing difficulties with object.uStrValue, which is being cast into an unsigned short pointer through this conversion: (GS::unchar_t*)connection_type_str.ToUStr().Get(). This conversion returns either 102 or 115.

I'm not entirely sure what these values represent, but I suspect there might be an internal mapping of connection type strings to these unsigned short values within the Graphisoft API. For example, how would the connection type "spigot-spigot" be mapped in this context?

The problem I'm encountering is that when I inspect the object's property in Archicad, the connection type consistently shows as "flat-flat" regardless of what I set.

Has anyone else experienced this issue? If so, how did you resolve it?

 

Operating system used: Windows 10

5 REPLIES 5

Hi,
I wouldn't say that the conversion returns 102 or 115. Those are the values pointed to by the pointer (the first letter of the string). They are ascii/unicode codepoints. 102 = f and 115 = s. Which is consistent to the two entries you've mentioned (flat-flat and spigot-spigot). Just assigning that pointer to uStrValue won't work, because of ownership/memory issues (What happens to values in memory where the pointer points to if the connection_type_str goes out of context and is destroyed?)

You'll need GS::ucscpy to actually copy the content to uStrValue.

 

Something like this:

 

GS::ucscpy(object.uStrValue, "spigot-spigot");

 

 

Hope that helps,
Bernd

 

Thank you for the help! I have checked once again and implemented your solution which compiled well.
So I carefully checked and made sure that the variable, storing uchar_t * will not get out of the scope so it could be properly used in the changing the pipe property.
Yet, however, when I try to change the parameter of the structure using ACAPI_LibraryPart_ChangeAParameter() that accepts a data structure that basically looks like:
{
char[] name = "connectionType",
...
...
...
unsigned short * uStrValue = 0x00000044434f9724 {115}
...
}

Could it also be possible that after the change I need to execute some other form of the command so the change values are, kinda, emplaced fully into the graphisoft element?



Ralph Wessel
Mentor

Have you seen the example code using API_ChangeParamType here: ACAPI_LibraryPart_OpenParameters

This might help. If not, can you post some of your code so we can see what you've done so far?

Ralph Wessel BArch
Software Engineer Speckle Systems

Hello. Thank you for sharing the link. Yes, I have checked it. However, something still is wrong. Do you know by any chance is there exists kind of a list of properties that can be changed and to what are they mapped? For example, is "Connection type" mapped to "connectionType" or "connection_type" or else, and what about other properties?

I don't understand the question. I recommend that you post some code showing what you've done so far, pinpointing:

- where something appears to be wrong;

- what you expected to happen;

- what has actually happened.

I think it should be possible to solve the problem then.

Ralph Wessel BArch
Software Engineer Speckle Systems

Setup info provided by author