Spreadsheet from dynamic componets


#1

Is there a way to get a spreadsheet from dynamic components.
For example, can I extract the X,Y,Z coordinates (or other attributes) of all instances of a particular dynamic component?
Can it go both ways? i.e. back in to the sketchup file?

Huck


#2

Hi Huck,

Generating an Attribute Report — SketchUp Help (This is a Pro only feature.)


#3

Thanks.
Worked beautifully. Generate Report gives the option to immediately open with Excel.


#4

There is a plugin for this. I cannot renember the name if it. But google excel for sketchup. The guy who is working on it is a french fellow. It controls your sketchup model from excel and visa versa


#5

I needed to generate a report that contained all of the attributes in a dynamic component so that I could see all the formulas, not just the values. Garry K, a plugin developer over at the SketchUcation site suggested the following to be run from the Ruby Console window:

model = Sketchup.active_model
definitions = model.definitions

definitions.each{ |defs|
dicts = defs.attribute_dictionaries()
next if dicts == nil

dicts.each{ |dict|
next if dict.name != 'dynamic_attributes’
puts ‘’, "dictionary: #{dict.name}, definition #{defs.name}"
dict.each_pair{ |key, value|
puts “key: #{key}, value: #{value}”
}
}
}

A portion of the output looks like this:

dictionary: dynamic_attributes, definition Group#5
key: _formatversion, value: 1.0
key: _has_movetool_behaviors, value: 0.0
key: _hasbehaviors, value: 1.0
key: _inst___iscollapsed_access, value:
key: _inst___iscollapsed_formlabel, value:
key: _inst___iscollapsed_formula, value:
key: _inst___iscollapsed_formulaunits, value:
key: _inst___iscollapsed_label, value:
key: _inst___iscollapsed_options, value:
key: _inst___iscollapsed_units, value:
key: _inst__iscollapsed, value: false
key: _lastmodified, value: 2015-10-10 14:36
key: _lengthunits, value: INCHES
key: _lenx_error, value: 0.032258"
key: _lenx_formula, value: 0.032258"
key: _lenx_label, value: LenX
key: _leny_error, value: 3
key: _leny_formula, value: 3
key: _leny_label, value: LenY
key: _lenz_label, value: LenZ
key: _name, value: Group#5
key: lenx, value: 0.032258
key: leny, value: 3.0
key: lenz, value: 75.0

dictionary: dynamic_attributes, definition Group#1
key: _formatversion, value: 1.0
key: _has_movetool_behaviors, value: 0.0
key: _hasbehaviors, value: 1.0
key: _lastmodified, value: 2015-10-11 23:33
key: _lenx_error, value: 4"
key: _lenx_formula, value: 4"
key: _lenx_label, value: LenX
key: _leny_error, value: 0.0625"
key: _leny_formula, value: 0.0625"
key: _leny_label, value: LenY
key: _lenz_error, value: 3"
key: _lenz_formula, value: 3"
key: _lenz_label, value: LenZ
key: _onclick_label, value: onClick
key: lenx, value: 4.0
key: leny, value: 0.0625
key: lenz, value: 3.0
key: onclick, value: SET(“Blade!material”,“MyWhite”,“MyBeige”,“MyBlack”,“MyBlue”,“MyBrown”,“MyBrown1”,“MyCharcoal”,“MyDarkBrown”,“MyDodgerBlue”,“MyGreen”,“MyHotPink”,“MyJeanBlue”,“MyPurple”,“MyRed”,“MyTan”,“MyTeal”,“MyYellow”,“My_Translucent_Glass_Blue”,“My_Translucent_Glass_Gray”)

dictionary: dynamic_attributes, definition Valence
key: _formatversion, value: 1.0
key: _has_movetool_behaviors, value: 1.0
key: _hasbehaviors, value: 1.0
key: _inst__x_access, value:
key: _inst__x_formlabel, value:
key: _inst__x_formula, value: 0
key: _inst__x_formulaunits, value:
key: _inst__x_label, value: X
key: _inst__x_options, value:
key: _inst__x_units, value:
key: _inst__y_access, value:
key: _inst__y_formlabel, value:
key: _inst__y_formula, value:
key: _inst__y_formulaunits, value:
key: _inst__y_label, value: Y
key: _inst__y_options, value:
key: _inst__y_units, value:
key: _inst_x, value: 0.0
key: _inst_y, value: 0.0
key: _lastmodified, value: 2015-10-12 11:07
key: _lengthunits, value: INCHES
key: _lenx_error, value: 4.125"
key: _lenx_formula, value: 4.125"
key: _lenx_label, value: LenX
key: _leny_error, value: 24.0
key: _leny_formula, value: Vertical Blinds!LenY
key: _leny_label, value: LenY
key: _lenz_error, value: 3.0625"
key: _lenz_formula, value: 3.0625"
key: _lenz_label, value: LenZ
key: _name, value: Valance
key: _onclick_label, value: onClick
key: lenx, value: 4.125
key: leny, value: 24.0
key: lenz, value: 3.0625
key: onclick, value: animateslow(“Blade!Placement”,.5,3)

dictionary: dynamic_attributes, definition Blade#2
key: _copies_formula, value: (Valance!LenY)/(LenY+Spacing)-1
key: _copies_label, value: Copies
key: _formatversion, value: 1.0
key: _has_movetool_behaviors, value: 1.0
key: _hasbehaviors, value: 1.0
key: _inst__copies_access, value:
key: _inst__copies_formlabel, value:
key: _inst__copies_formula, value: (Valance!LenY)/(LenY+Spacing)-1
key: _inst__copies_formulaunits, value:
key: _inst__copies_label, value: Copies
key: _inst__copies_options, value:
key: _inst__copies_units, value:
key: _inst__rotz_access, value:
key: _inst__rotz_formlabel, value:
key: _inst__rotz_formula, value: 0+Blade!rotator
key: _inst__rotz_formulaunits, value:
key: _inst__rotz_label, value: RotZ
key: _inst__rotz_options, value:
key: _inst__rotz_units, value:
key: _inst__y_access, value:
key: _inst__y_formlabel, value:
key: _inst__y_formula, value: If(COPY<1,Valance!Y+((LenY-Spacing)/2)+(COPY*(Placement)),(Valance!Y+(LenY+Spacing)/2)+(COPY*(Placement)))
key: _inst__y_formulaunits, value:
key: _inst__y_label, value: Y
key: _inst__y_options, value:
key: _inst__y_units, value:
key: _inst_copies, value: 7.0
key: _inst_rotz, value: 2.0
key: _inst_y, value: 2.0
key: _lastmodified, value: 2015-10-11 16:35
key: _lengthunits, value: INCHES
key: _lenx_error, value: 0.09375"
key: _lenx_formula, value: 0.09375"
key: _lenx_label, value: LenX
key: _lenx_nominal, value: 0.03225800000000013
key: _leny_error, value: 3.5
key: _leny_formula, value: 3.5
key: _leny_label, value: LenY
key: _leny_nominal, value: 3.0
key: _lenz_label, value: LenZ
key: _lenz_nominal, value: 81.35250789196772
key: _material_formula, value:
key: _name, value: Blade
key: _onclick_label, value: onClick
key: _onclick_state1, value: 9
key: _open_error, value: 0
key: _open_formula, value: If(rotator>0,0,1)
key: _open_formulaunits, value: STRING
key: _open_label, value: Open
key: _placement_formula, value:
key: _placement_formulaunits, value: STRING
key: _placement_label, value: Placement
key: _rotator_formula, value:
key: _rotator_label, value: Rotator
key: _rotz_error, value: 0+2
key: _rotz_formula, value: 0+Blade!rotator
key: _rotz_label, value: RotZ
key: _spacing_error, value: 0±.5
key: _spacing_formula, value: -.5
key: _spacing_label, value: Spacing
key: _x_label, value: X
key: _y_error, value: 2.0
key: _y_formula, value: If(COPY<1,Valance!Y+((LenY-Spacing)/2)+(COPY*(Placement)),(Valance!Y+(LenY+Spacing)/2)+(COPY*(Placement)))
key: _y_label, value: Y
key: _z_label, value: Z
key: lenx, value: 0.09375
key: leny, value: 3.5
key: lenz, value: 81.35250789196772
key: material, value: MyGreen
key: onclick, value: animateslow(“Blade!Rotator”,2,90)
key: open, value: 0
key: placement, value: 3
key: rotator, value: 2
key: spacing, value: -0.5

If you want to play with it, the component can be found in the 3D Warehouse here: Vertical Blinds (Animated & Scalable). It’s one of my first efforts, so its really not all that. :wink: