sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Retrieving bounding-box-value from a component instance ?

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 250 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.
    • artmusicstudioA Offline
      artmusicstudio
      last edited by

      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
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        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
        • artmusicstudioA Offline
          artmusicstudio
          last edited by

          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
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement