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

    Change Axes in Sketchup.

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    2 Posts 2 Posters 1.4k 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.
    • V Offline
      vimleshpatel
      last edited by

      How to change the axes of any component in sketchup using code.
      -We can changes axes of any component by right click and select "change axes" menu.
      -I want to change this axes using ruby code.

      Is there any option to do this using ruby code?

      1 Reply Last reply Reply Quote 0
      • G Offline
        Garry K
        last edited by

        This is what I use

        
          # Let 'point' be the new insertion point of the component.
          # Let vector=ORIGIN.point.vector_to(point)
          # Let tr=Geom;;Transformation.translation(vector)
        
          vector = component.transformation.origin.vector_to(new_origin)
          tr = Geom;;Transformation.translation(vector)
        
          component.definition.entities.transform_entities(tr.inverse, component.definition.entities.to_a)
        
          # All of the component's innards jump to suit, so the instance is now in the wrong place relative to its container's contents...
          # To fix any instances so the contents are placed back as they were, inside their individual container...
        
          component.definition.instances.each{ |inst| inst.transform!(tr) }
          component.definition.invalidate_bounds
        
        
        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