PDA

View Full Version : Accessing Custom Attributes Paramblock


Teirz
01-14-2009, 09: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. :)

ZeBoxx2
01-14-2009, 12:03 PM
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

Teirz
01-23-2009, 02:46 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.

Polimeno
01-23-2009, 08:53 AM
Custom Attributes Definition Values

mapped fn custAttribute_showPBlockDefs obj =

(

format "%\n" obj.name

for objDef in (custAttributes.getDefs obj) do

(

format "\t%\n" objDef

format "\tname: %\n" objDef.name

format "\tattribute id: %\n" objDef.attribID



format "\tParameter Blocks:"


pbArray = custAttributes.getPBlockDefs objdef

for a = 1 to pbArray.count do

(

itms = pbArray[a]



format "\n\t\tname = %\n" itms[1]

format "\t\tid = %\n" itms[2]

format "\t\towners reference number = %\n" itms[3]

keywordParams = itms[4]

format "\t\tparameter block keywords:\n"

for x = 1 to keywordParams.Count/2 do

(

format "\t\t\t% = %\n" keywordParams[x] keywordParams[x+1]

x = x+1

)

format "\t\tparameters:"

for y = 5 to itms.Count do

(

format "\n\t\t\t#name = %\n" itms[y][1]

for z = 1 to itms[y][2].Count by 2 do

(

format "\t\t\t% = %\n" itms[y][2][z] itms[y][2][z+1]

)

)

)

)

)

CGTalk Moderation
01-23-2009, 08:53 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.