I'm making tests with the 'Writing to a .skp file'-sample http://www.sketchup.com/intl/en/developer/su-api/index.html.
Is there a way to determine the Sketchup versionthe saving with SUModelSaveToFileshould be done?
Thanks.
I'm making tests with the 'Writing to a .skp file'-sample http://www.sketchup.com/intl/en/developer/su-api/index.html.
Is there a way to determine the Sketchup versionthe saving with SUModelSaveToFileshould be done?
Thanks.
The following Code makes groups in groups.
width = 200
depth = 100
pts = []
pts[0] = [0, 0, 0]
pts[1] = [width, 0, 0]
pts[2] = [width, depth, 0]
pts[3] = [0, depth, 0]
model = Sketchup.active_model
g1 = model.entities.add_group
g1.entities.add_face pts
g1.transformation = Geom;;Transformation.new([10,0,10])
g2 = g1.entities.add_group
g2.entities.add_face pts
g2.transformation = Geom;;Transformation.new([20,0,20])
g3 = g2.entities.add_group
g3.entities.add_face pts
g3.transformation = Geom;;Transformation.new([30,0,30])
puts "model; " + model.entityID.to_s
puts "g1; " + g1.entityID.to_s
puts "g2; " + g2.entityID.to_s
puts "g3; " + g3.entityID.to_s
puts "g3.parent; " + g3.parent.entityID.to_s + ", " + g3.parent.class.name
puts "g3.parent.parent; " + g3.parent.parent.entityID.to_s + ", "
+ g3.parent.parent.class.name
puts "g3.parent.parent.parent; "
+ g3.parent.parent.parent.entityID.to_s + ", "
+ g3.parent.parent.parent.class.name
And results in
model; Model
g1; 25
g2; 49
g3; 73
g3.parent; 40, Sketchup;;ComponentDefinition
g3.parent.parent; 3, Sketchup;;DefinitionList
g3.parent.parent.parent; Model, Sketchup;;Model
Now question:
Given g3, how can I get the owning/creating group g2 by code? g3.parent is not the right way.
The
@source_entity
was the key. No echo!
And get_attribute should only read values and not mess the dictionary.
I found it. With
@source_entity.get_attribute("dynamic_attributes", "somekey")
you can access the dictionary-values.
Whith the DC function CURRENT you can access the dynamic dictionary value 'LenX' of the component:
=CURRENT("LenX")/2
How can I make a similar function and access the dictionary?
class DCFunctionsV1
protected
def mycurrent(param_array)
# Question:
# WHAT CODE IS NEEDED HERE TO ACCESS THE DICTIONARY?
#
end
end
I want to modify the value of a dynamic component not via property dialog but by ruby code.
How can do that and enforce afterwards a recalculation of the component instances?
Eg.: The Component makes the attribute 'copies' user-changeable. I want to define this value and the component should rebuild the instances.