How to know component is flipped?

i have a component and some times its necessary to reverse it in X axis and this make
some mistake , how can i find a way to know this component is flipped or not ??

By default (unless you change it during the create component dialog or later by manipulating a ComponentInstance), an instance’s transformation’s x axis will point in the same direction as the Ruby API’s global X_AXIS.

You can get the x axis of a ComponentInstances’s Transformation via

xaxis = the_Instance.transformation.x_axis

and examine which way that xaxis vector points.

Beware, however, that if the ComponentInstance has been rotated its x_axis may not be aligned with the global X_AXIS in either direction. Then you have a more complicated situation to analyze for what “flipped along x” may mean!

1 Like

I think your question is wrong. When you have 2 mirrored components you cannot say this one is main and other one is mirrored. Maybe you should ask your question in different way.

1 Like

If you want to know whether a component is flipped (along any axis) you can use something like:

tr = component.transformation
flipped = !(tr.xaxis * tr.yaxis).samedirection?(tr.zaxis)
3 Likes

bravo @CAUL Cross Product :clap: :clap: :clap: