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 onso @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::ComponentInstanceclass inherits a bounds() method from its superclass,Sketchup::Drawingelemnt, just as theSketchup::ComponentDefinitionclass 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
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement