Change Axes in Sketchup.

Change Axes in Sketchup.

Postby vimleshpatel » Wed Apr 08, 2015 8:27 am

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?
0

vimleshpatel 
 

Re: Change Axes in Sketchup.

Postby Garry K » Wed Apr 08, 2015 11:53 am

This is what I use

Code: Select all
  # 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

Garry K 
Premium Member
Premium Member
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Dynamic Components

Who is online

Users browsing this forum: No registered users and 1 guest

Visit our sponsors: