• Login
sketchucation logo sketchucation
  • Login
Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

Retrieving bounding-box-value from a component instance ?

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 271 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    artmusicstudio
    last edited by 21 Jun 2014, 12:10

    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
    stan

    EDIT: 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) ???

    -:)

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dan Rathbun
      last edited by 22 Jun 2014, 00:20

      The Sketchup::ComponentInstance class inherits a bounds() method from its superclass, Sketchup::Drawingelemnt, just as the Sketchup::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.

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • A Offline
        artmusicstudio
        last edited by 22 Jun 2014, 07:33

        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

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          2/3
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement