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!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    Double rotations

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 1 Posters 549 Views 1 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.
    • chrisglasierC Offline
      chrisglasier
      last edited by

      Here is a clip showing two rotations - the first around the z axis, the second the y axis.
      [flash=425,344:15gx62mn]http://www.youtube.com/v/kzs7IqroD6E[/flash:15gx62mn]
      The first rotation obviously gets lost because the script that gets the component file only deals with one axis. Here's the relevant bit of the ruby:

      
      
      @dlg.add_action_callback("find") {|d, p|
      a= p.split(",")
      	
      subDir ="Components/NamesetComponents/"
      fileName = a[0]+".skp"
            
      model = Sketchup.active_model
      entities = model.active_entities
      	
      theX = Integer(a[1]).mm
      theY= Integer(a[2]).mm
      theZ = Integer(a[3]).mm
          
      point = Geom;;Point3d.new theX,theY,theZ
      txyz = Geom;;Transformation.new point
               
      path = Sketchup.find_support_file fileName, subDir
            
      definitions = model.definitions
      componentdefinition = definitions.load path
      instance = entities.add_instance componentdefinition, txyz
      		
      theDegrees = Integer(a[4]).degrees
      theAxis = a[5]
      	
      rv = Geom;;Vector3d.new(0,0,1) if theAxis == "z"
      rv = Geom;;Vector3d.new(0,1,0) if theAxis == "y"
      rv = Geom;;Vector3d.new(1,0,0) if theAxis == "x"
      	
      tr = Geom;;Transformation.rotation(Geom;;Point3d.new(instance.bounds.center), rv, theDegrees)
      	
      instance.transform! tr   }
      
      
      

      Any help gratefully received!

      Chris

      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

      1 Reply Last reply Reply Quote 0
      • chrisglasierC Offline
        chrisglasier
        last edited by

        Sorry to bump this but I have a feeling I've missed something fundamental. In this clip I want to see how many baths I can fit into a given space (20' container) using a regular configuration. The problem comes for me when I need the ruby to turn each product through two rotations - in this case both Z and Y. I am sure there is a simple solution ...

        [flash=425,344:9y9do5xj]http://www.youtube.com/v/ql6j84Vw_9o[/flash:9y9do5xj]

        Chris

        With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

        1 Reply Last reply Reply Quote 0
        • chrisglasierC Offline
          chrisglasier
          last edited by

          Fixed [flash=425,344:3qp1491i]http://www.youtube.com/v/TL8q17qSKrk[/flash:3qp1491i]

          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

          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