Retrieving bounding-box-value from a component instance ?
-
hi,
how ever i define the component instance,
if i retrieve the boundary box from an INSTANCE,i get back the values from the DEFINITION.
which syntax is necessery to call the instance-parameters (especially highest "z" of its BB)
..... elsif entity.is_a?(Sketchup;;ComponentInstance) @definition=entity.definition @auswahl=entity.name puts "auswahl_name ; " + @auswahl #puts "selection = component" calculation_top_nested_component else #puts"other element type then face or group or component" end and so on.... calling the method [b]calculation_top_nested_component[/b] def calculation_top_nested_component bbox = @definition.bounds z = bbox.max puts z selection = @definition.entities() selection.each { |entity| @auswahl = entity and so on
so @definition always gives the same values for different comonents.
any idea?
thanx in advance
stanEDIT: while retrieving information about faces from different instances of a component i found out, that
always informations from the definition-face will be given back, means: x,y,z is always the same, regardles, where the INSTANCE is placed.
so probably some transformation parameter have to be added to [x,y,z] to find the real position.but how can i read out the transformation of the daughter component (= instance) ???
-:)
-
The
Sketchup::ComponentInstance
class inherits a bounds() method from its superclass,Sketchup::Drawingelemnt
, just as theSketchup::ComponentDefinition
class does.Yes you need to understand transformations.
TIG has posted many how tos. Use the forum search, or check the Code Snippets index.
-
hi dan,i willk take a look at it.
yes, i was searching in the forum in the mean time a lot and found a topic from 2009 whit good ideas.
i can now identify the component instance and retrieve its own height, especially when it is nested.
there are still some minor problems , but the ruby returns the informations needed now.thanx for helping me!
stan
Advertisement