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

Accessing properties & attributes of an element

Anonymous
Not applicable
I can find an element by it's GUID and identify it's type. Now I'd like to enumerate and list all its properties or attributes. I can see the various data I want to get at by selecting an element and right clicking on it and looking at its settings.

So, for example, for a door, I can see it has an ID, it has a setting that says whether its load bearing, external etc. I can also see that there are Materials and other parameters associated with the door.

How do I get at these via API. I tried listing the parameters and it always tells me the parameter count is 0.
8 REPLIES 8

Ralph Wessel
Mentor
LesWoolsey wrote:
I can see it has an ID, it has a setting that says whether its load bearing, external etc. I can also see that there are Materials and other parameters associated with the door. How do I get at these via API. I tried listing the parameters and it always tells me the parameter count is 0.
I assume you want the parameters derived from the GDL door object? If so, you need to look in a memo structure linked to the element. This data is not automatically loaded with the rest of the element for efficiency, so it has to be loaded independently. There are 2 ways to approach this:
  • 1. The easiest method is APIAny_OpenParametersID (and related functions). Refer to the documentation for more information.

    2. The former approach may not be flexible enough - if so, take a look at the API_ElementMemo structure (specifically the params field) and the function that retrieves the data, ACAPI_Element_GetMemo.
Ralph Wessel BArch

Anonymous
Not applicable
Still not getting it. I've tried both methods and indeed I can something back but not anything helpful. The API docs both refer to a list of parameters but then return nothing that looks like a list. So for example, if I get the memo data:
API_ElementMemo memo;
if (element.header.hasMemo) {
err = ACAPI_Element_GetMemo(element.header.guid, &memo);
if (err == NoError) {
the memo object has a value for param called "A". But where are the rest of the parameters?

I did try the APIAny_OpenParametersID and APIAny_GetActParametersID functions following the example code and I just got the same result. There didn't seem to be a way to get a parameter count, parameter list or parameter array anywhere.

I'm clearly missing something pretty obvious but I can't see what based on the documentation & examples.

I'll continue digging to but any suggestions would be appreciated.

Les

Ralph Wessel
Mentor
LesWoolsey wrote:
the memo object has a value for param called "A". But where are the rest of the parameters?
The 'A' parameter is simply the first item in the array, i.e.
(*memo.params)[0]
The 'B' parameter would be:
(*memo.params)[1]
...and so on. You could get the total number of parameters by dividing the memory allocation by the size of the parameter structure:
		UInt32 totalParams = BMGetHandleSize(memo.params) / sizeof(API_AddParType);
Ralph Wessel BArch

Anonymous
Not applicable
Thanks - that at least gets me a bunch of data that I can look at. Unfortunately it doesn't seem to relate in any obvious way to the building. For example, if I select a door and check its selection properties, I get a whole lot of properties, For example, under Tags & Categories & I can see, ID, Structural Function, Position etc. But I don't see any of that in the list I get back in the memo params. I also don't get back the door's type. I can't see where the various materials and finished are defined.

My goal is to be able to see the various properties that get exposed in the IFC file and be able to view (and in some cases change them). So I'm trying to relate standard property names (eg from PSET_DOORCOMMON]) back to the definition in the model.

Am I looking in the wrong place to find this, or am I missing something obvious. I have to admit that doing this as a plug-in for Revit was pretty straight forward.

Your advice/suggestoins are appreciated.
[/img]

Anonymous
Not applicable
HMM. Maybe I'm trying too hard. I'm looking at the IFC parameter & attribute calls (new in v16) to see whether they will do the job for me. stand by...

Ralph Wessel
Mentor
LesWoolsey wrote:
it doesn't seem to relate in any obvious way to the building. For example, if I select a door and check its selection properties, I get a whole lot of properties, For example, under Tags & Categories & I can see, ID, Structural Function, Position etc. But I don't see any of that in the list I get back in the memo params. I also don't get back the door's type. I can't see where the various materials and finished are defined. My goal is to be able to see the various properties that get exposed in the IFC file
The data is stored in different locations - some it is in the element, some in the parameters, and some in the IFC properties/attributes. And yes, the new functions in AC16 will allow you to extract the IFC properties. However, the IFC properties may not relate to anything you see in the model, e.g. the materials of a door. Objects cannot use (or even see) IFC properties, so materials will largely be driven by parameters.

Could you describe the functionality you are aiming to develop at a higher level? It might be easier to suggest a way forward.
Ralph Wessel BArch

Anonymous
Not applicable
Is there a way to communicate off the message board? I'm not comfortable sharing that information in a public forum - at least until the product is released. You could send me your email address at les@leswoolsey.com which would allow private communication without exposing your email address publicly. (I don't mind sharing mine since I don't expect a lot of people to come to me for help!)

Ralph Wessel
Mentor
LesWoolsey wrote:
Is there a way to communicate off the message board?
Sure, I'll contact you by email. The best starting point from this forum is PM first - then you don't need to expose your email address. Spammers trawl these forums for target addresses unfortunately.
Ralph Wessel BArch

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!