GDL
About building parametric objects with GDL.

Extracting Building Material Properties with a GDL

Jeroen
Booster

Hi Guys,

 

Is it possible to extract Properties from Building Materials?

Jeroen_0-1673603286762.png

 

I want to use this in a Label and process the data further as part of my Temperature Label:
https://www.linkedin.com/posts/debruinbimproductspecialist_archicad-activity-7016077546198818816-0Kz...

With kind regards,
Jeroen de Bruin 

 

 

7 REPLIES 7
A_ Smith
Expert

try BUILDING_MATERIAL_INFO 

 

AC 22, 24 | Win 10
Peter Baksa
Graphisoft
Graphisoft

Hi,

 

BUILDING_MATERIAL_INFO is only for (old) physical properties.

Other properties can be read with COMPONENT_PROPERTY_VALUES_OF_PARENT.

The code needs to know the IDs of the requested properties, currently the only way is that the user must select them on the UI. You can show a list on the UI using  COMPONENT_PROPERTY_TREE_OF_PARENT. You also need to get the list of building materials in the labelled object with COMPONENT_IDS_OF_PARENT.

For an example see Archicad Library's Component Classification and Properties Label.

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
Jeroen
Booster

Hi Peter, 
Thanks. I looked into this Component Classification and Properties Label, but that is next level GDL-stuff. Could you help me out a bit?
For Instance, I would like to get the number out of the Building Material Property 'Vapour Pressure'. How would you build that?

thanks in advance!
Jeroen 

Hi,

 

  1. GDL doesn't know properties by name, so the user has to select it from all of the available properties. The user selection can then be stored in a string parameter, the value will be a technical GUID.
    1. Get the list with "Component_Property_Tree_Of_Parent"
    2. Get the name of the property GUID stored in the parameter using "Property_Name"
    3. Show it on the UI using UI_CUSTOM_POPUP_INFIELD
  2. Get the value of the selected property for each component. AC knows which building material is used for which component. Note: components include all parts of the profile for profiled walls, I don't see any possibility to get the information only for cut parts.
    1. Get the list of components with "Component_IDs_Of_Parent"
    2. Get the property values for each component in a loop using "Component_Property_Values_Of_Parent"
    3. Check the returned propertyValues[].value_status and propertyValues[].type to decide how to handle propertyValues[].value[]

With a parameter called "prop":

UI:

 

DICT propFilter, propTree
propFilter.propertyType = "ACPROPERTY"
n = REQUEST ("Component_Property_Tree_Of_Parent", propFilter, propTree)

if n > 0 then 
	_propertyName = ""
	n = REQUEST ("Property_Name", prop, _, _, _propertyName)
	ui_custom_popup_infield "prop", 0, 0, 300, 19,
		1, propTree.treeDepth, 1, _propertyName,
		propTree.propertyTree									
endif

ui_outfield prop, 0, 20, 300, 20

 

2D:

 

dict collectComponents
	collectComponents.collectMode = 1
dict outputCompIds
n = REQUEST ("Component_IDs_Of_Parent", collectComponents, outputCompIds)
if n > 0 then
	for i = 1 to vardim1(outputCompIds.componentIds)
		dict compPropInput, compPropVals
		compPropInput.componentId.id = outputCompIds.componentIds[i].id
		compPropInput.propertyIds[1].id = prop
		n = REQUEST ( "Component_Property_Values_Of_Parent", compPropInput, compPropVals)
		if n > 0 & compPropVals.propertyValues[1].value_status = 1 then
			text2 0, i, compPropVals.propertyValues[1].value[1]
		else
			text2 0, i, "no value"
		endif
	next i
endif

 

 

Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest
Mathias Jonathan
Advocate

Hello,

I have a question about the Temperature Label: is the position of the object automatic or do you have to place it by hand?

I was wondering about the ability of a GDL label to find the geometry of a wall and position itself in relation to it.

Peter Baksa
Graphisoft
Graphisoft

Hi,

 

the wall reference line is available as LABEL_ASSOC_ELEM_GEOMETRY .

A label can draw at given coordinates if the pointer is turned off, otherwise the drawing will be moved to the end of the pointer.

Use this code to transform from label coordinate system to project coordinate system:

! ------------------------------------------------------------------------------
! Transform from label local coordinate system to plan orientation and origin
! ------------------------------------------------------------------------------
rotBy = -LABEL_ROTANGLE
_unused = REQUEST ("View_Rotangle", "", angleViewRot)		

corr = 0
if AC_bLabelAlwaysReadable & (AC_LabelOrientation = 1 | AC_LabelOrientation = 2 | AC_LabelOrientation = 5) then
	summarot = (LABEL_ROTANGLE + angleViewRot) % 360
	if summarot > 90 & summarot <= 270 then corr = 180
endif

rot2 rotBy + corr
add2 -LABEL_POSITION [1][1], -LABEL_POSITION [1][2]
Péter Baksa
Software Engineer, Library as a Platform
Graphisoft SE, Budapest

Hi  @Peter Baksa. Your script 

dict collectComponents
	collectComponents.collectMode = 1
dict outputCompIds
n = REQUEST ("Component_IDs_Of_Parent", collectComponents, outputCompIds)
if n > 0 then
	for i = 1 to vardim1(outputCompIds.componentIds)
		dict compPropInput, compPropVals
		compPropInput.componentId.id = outputCompIds.componentIds[i].id ! THIS ARRAY ORDER IS DIFFERENT FROM Profile_component_info REQUEST RESULT.
		compPropInput.propertyIds[1].id = prop
		n = REQUEST ( "Component_Property_Values_Of_Parent", compPropInput, compPropVals)
		if n > 0 & compPropVals.propertyValues[1].value_status = 1 then
			text2 0, i, compPropVals.propertyValues[1].value[1]
		else
			text2 0, i, "no value"
		endif
	next i
endif

 How to make UI where user can choose  component  of which some properties will be displllayed.

for complex structure it works with WALL_SKINS_BMAT_NAMES[i][1]

I mean order of collected bmats in compPropInput.propertyIds is the same like in WALL_SKINS_BMAT_NAMES[i][1]

but for Complex profile when request (Profile_component_info)  order of collected bmats is based on bmat index number so its different.

Hence its impossible to use it in ie ui_radiobutton or option value list.
Is that clear?  I attached Label object based on Your code. Hope You can help me. I got stuck with a job 😕