I want to access the local axes for drawings elements

ruby

#1

I want help for the following :slight_smile:
1- is there any way to access the local access for objects ?
2-can I create axes.new object ? or should I manipulate only the global axis?
3-when manipulating the global axis , does the coordinate system change as well relative to transformed axis ?
4- how I can save specific transformation to axis ? normally the transformation object gets the transformation value for the axis object starting from first displacement from the origin till the last displacement location . If I applied several consecutive displacements for the axis , and I want to save one or two in between of these displacements only , how?


#2

Yes, but only for groups and component instances, via their transformations.

Not exactly. You use the set() method to access the singleton instance of the class.

See:

You can manipulate the current drawing axes which by default are set to the same as the global axes. You actually cannot change the global axes, even if you change the current drawing axes. (The global axis remain as they were.)

To reset the current drawing axes back to the global axis, use

Sketchup.active_model.axes.set(ORIGIN, X_AXIS, Y_AXIS, Z_AXIS)

Again, not the global axes, you change the current drawing axes of the active model, (and it is best if we all use “axes” as plural, “axis” as singular.)

Answer is, that the co-ordinate system changes for the GUI only, but not in the API.
In your Ruby code, you will need to apply the axes’ transformation to any of your “UCS local coordinates” before drawing something or placing component instances.

Sketchup.active_model.axes.set(
  trans_1.origin,
  trans_1.xaxis,
  trans_1.yaxis,
  trans_1.zaxis
)