Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Categories and Properties Label

Anonymous
Not applicable
Hi,
Has anyone been able to successfully code a custom categories and properties label? We plan on using properties for things like wall types.

What I am having trouble with is accessing the array formed from the following request.
DIM propertyValues[]
REQUEST ("Property_Value_Of_Parent", "id", type, dim1, dim2, propertyValues)

I have not had problem with arrays before, but this seems to be tricky. Not really sure why it needs to be an array as it should be a single field as you need to identify the id?
2 REPLIES 2
sinceV6
Advocate
Tom wrote:
Hi,
Has anyone been able to successfully code a custom categories and properties label? We plan on using properties for things like wall types.

What I am having trouble with is accessing the array formed from the following request.
DIM propertyValues[]
REQUEST ("Property_Value_Of_Parent", "id", type, dim1, dim2, propertyValues)

I have not had problem with arrays before, but this seems to be tricky. Not really sure why it needs to be an array as it should be a single field as you need to identify the id?
Hi.
This is a nice challenge!

As noted in this thread, returned arrays can be of mixed type, so correct handling of data depends on that. As for why it needs to be an array... I guess is because some properties allow you to set a list of values, and in some cases you can have multiple selections, so you need to have a way to retrieve all those values to use in your label.

Best regards.
Anonymous
Not applicable
Thanks for your reply. I was able to work it out stealing some GS code. This is what I have done in case it helps anyone. This gives me two returned values. "Door Type" and "Door Number"

DoorNumber = ""
DoorType = ""
_stPropertyValue = ""

DIM parentProperties[]
tom = REQUEST ("Properties_Of_Parent", "", parentProperties)
_numProperties = vardim1(parentProperties)
for i = 1 to _numProperties
if parentProperties = "Door Number" then
DoorNumberID = parentProperties[i-3]
endif
if parentProperties = "Door Type" then
DoorTypeID = parentProperties[i-3]
endif
next i

_stPropertyID = DoorNumberID
gosub "getPropertyValue"
DoorNumber = _stPropertyValue

_stPropertyValue = ""

_stPropertyID = DoorTypeID
gosub "getPropertyValue"
DoorType = _stPropertyValue


!=============================
!MAIN LABEL CODE.....

end


! ==============================================================================
"getPropertyValue":
! ==============================================================================
dim propertyValues[]
m = REQUEST ("Property_Value_Of_Parent", _stPropertyID, _typeValue, dim1, dim2, propertyValues)

if m > 3 then
for j = 1 to vardim1(propertyValues)
if j > 1 then
_stPropertyValue = _stPropertyValue + "; "
endif

if _typeValue = 4 then
_stPropertyValue = _stPropertyValue + propertyValues
else
if _typeValue = 3 then
_stPropertyValue = _stPropertyValue + str ("%.2", propertyValues)
else
if _typeValue = 2 then
_stPropertyValue = _stPropertyValue + str ("%.0", propertyValues)
else
if propertyValues > 0 then
_stPropertyValue = _stPropertyValue + `TRUE`
else
_stPropertyValue = _stPropertyValue + `FALSE`
endif
endif
endif
endif
next j
else
_stPropertyValue = "<" + `Property Value` + ">"
endif

return