Notifications
Clear all
[Closed] Accessing Custom Attributes Paramblock
Jan 14, 2009 10:20 am
Hi all,
I have a problem accessing certain parts of a parameters block within a custom attributes.
For e.g. I want to know the type setting of a parameter inside the parameters block. Is there anyway I can access it? I need this as I need to know if a parameter even thou the value is in float, is it in radian(#float) or degree(#angle).
Thanks in advanced.
3 Replies
Jan 14, 2009 10:20 am
either parse the source, or use the pblock definition?
a = custattributes.getDef $ 1
<AttributeDef:test>
custAttributes.getDefSource a
"attributes test (
parameters main (
rad type:#float
deg type:#angle
)
)
"
custAttributes.getPBlockDefs a
#(#(#main, 0, 0, #(), #(#rad, #(#type, #float)), #(#deg, #(#type, #angle))))
or, if bored, parse the output of showproperties:
showproperties $.test
.rad : float
.deg : angle
false
Jan 14, 2009 10:20 am
Thanks for helping this out. I was hoping there’s some better or more elegant way of doing this. Accessing the Paramblock definition really doesn’t seems that neat to me but oh well, it works.
Jan 14, 2009 10:20 am
Custom Attributes Definition Values[left][/left]
[left]mapped fn custAttribute_showPBlockDefs obj =
[/left]
[left] (
[/left]
[left] format "%
" obj.name
[/left]
[left] for objDef in (custAttributes.getDefs obj) do
[/left]
[left] (
[/left]
[left] format " %
" objDef
[/left]
[left] format " name: %
" objDef.name
[/left]
[left] format " attribute id: %
" objDef.attribID
[/left]
[left]
[/left]
[left] format " Parameter Blocks:"
[/left]
[left]
pbArray = custAttributes.getPBlockDefs objdef
[/left]
[left] for a = 1 to pbArray.count do
[/left]
[left] (
[/left]
[left] itms = pbArray[a]
[/left]
[left]
[/left]
[left] format "
name = %
" itms[1]
[/left]
[left] format " id = %
" itms[2]
[/left]
[left] format " owners reference number = %
" itms[3]
[/left]
[left] keywordParams = itms[4]
[/left]
[left] format " parameter block keywords:
"
[/left]
[left] for x = 1 to keywordParams.Count/2 do
[/left]
[left] (
[/left]
[left] format " % = %
" keywordParams[x] keywordParams[x+1]
[/left]
[left] x = x+1
[/left]
[left] )
[/left]
[left] format " parameters:"
[/left]
[left] for y = 5 to itms.Count do
[/left]
[left] (
[/left]
[left] format "
#name = %
" itms[y][1]
[/left]
[left] for z = 1 to itms[y][2].Count by 2 do
[/left]
[left] (
[/left]
[left] format " % = %
" itms[y][2][z] itms[y][2][z+1]
[/left]
[left] )
[/left]
[left] )
[/left]
[left] )
[/left]
[left] )
[/left]
)