Any plugin to show object orientation?

Is there any plugin which could show accurate orientation of selected object, component or group (x, y, z)? I’ve finished my project where a lot of components and groups were orientated to different planes and now when I export the project to Keyshot at least I can see here that some of my groups or components are a little bit out of plane like x: 0 y: -0,002 z: 0 (degrees) for example. Then I’m going back to SU and fix this inaccuracy in such groups or components. (snap to angle or length are disabled in my project by the way).

You mean something like this?
It is not an extension, but you may find this code useful…
Select one (only one) component or group. Copy-paste the code to Ruby console. (See the animation below)

[Code Snippet]

def get_angle
    mod = Sketchup.active_model
    sel = mod.selection
    if sel.single_object? && sel.first.respond_to?(:definition)
      tr = sel.first.transformation
      dx = tr.xaxis.angle_between(X_AXIS).radians
      dy = tr.yaxis.angle_between(Y_AXIS).radians
      dz = tr.zaxis.angle_between(Z_AXIS).radians
      return "dx:#{dx}°, dy:#{dy}°, dz:#{dz}°"
    end
    return "No axes"
end
get_angle

_


After selecting another one you can type get_angle to get the next angles…

1 Like

Turn on angle snapping and use the move tool and the rotation crosses to snap to 0,90,180 etc

1 Like

thanks. it works. but it would be more comfortable if someone could make an extension :yum:

Try Dynamic components.
Convert into components for easy Axis realignment
add position and rotation.
Then change.
all existing values relative to the Parent! context.

alignments

I don’t see on your gif (it’s too small) if there is enough accuracy shown, because in DC attributes I get only integers like 56, 24, 7, etc.

it displays the integers, but it works with floats internally. The trick is to have the Axis correct. When you suspect an inaccuracy, type in a divergent number, and then back the correct.
eg. you can typ 44,998, zoom in to see the change, then type 45

as a variant but I’ve got more than 30 components and if some of them have an inaccuracy so I have to watch with scaling for each of them and find if there is it exist or not. agree that it would be much easier if you simply select components and see on some tab exact orientation.

Screenshot_45

I will see what can I do....

…if I’ve got some more free time in a weekend. However for sure, it will be a “quick & dirty” extension… :blush:
Please check if this is something what you looking for?

yes, thanks :wink:

Here is my “quick and dirty” extension. I hope you can use this.
aa1 Dezmo Align Axes
The extension is not signed you must enable “Unrestricted” in Extension manager…
You will get a new menu and toolbar icon.
(Should work if SU version>= 2017 )
The tool is experimental, you may or may not get the desired result. Use your own risk.

Description (See also in Instructor)

(See also in Instructor window during using the extension)

The extension will determine the angles between model axes and instance axes pairs, then align the axes by rotating the instance.

  • By hovering the mouse over the component/group instance in question angles will be shown.

  • Left mouse click on instance will align the instance axes to the direction of the model axes. The instance will not move, but rotate. The rotation origin is the origin (sometimes called insertion point) of instance - In other words it’s axes intersection.

  • Right mouse click will bring a context menu to exit. You can also exit by selecting another tool except the Orbit, Pan, Zoom… Etc.
    E.g.: press Space to select the Selection tool and exit but use the mouse wheel zooming and orbiting as usual.

Notes:

  • The angle in question is calculated simply. It means, just on the plane determined by corresponding model axis and instance axis. E.g. the instance X axis will not be projected to model Z plane to measure angle.

  • The alignment operations are not wrapped as one “undo”. You will find “Undo Move” or “Redo Move” for every and each rotation if you check for undo-redo stack.

  • The tool will not work in nested components. E.g. if you are editing a component and you start the tool, the editing context will jump back to root of the model. (If SU version < 2020 the tool warns you and will not start . Go out from editing to model root manually… and you can start after…)

  • The precision of the lengths and angle in degrees will be same as the Model Info>>Units>>Angle/ Length units: Precision. However, the radians are not rounded.

  • The green “Aligned” text means the angle difference is less than 0.000001 radians. However, you can still click on instance to align….

Sreenshot

Download

Dezmo_Align_Axes_Beta_2020_0828_2050.rbz (9.3 KB)
Note: new bug fixed version in post below:
Bug fix

Note: new bug fixed version in post below
Bug fix

1 Like

Thanks a lot!) I’ll check it some time later and say you results here. :blush:

1 Like

Will the instance’s axes and the model’s axes eventually be “equal” 100% ?

My layman approach (if it’s just for a few groups or components!) is to temporarily borrow the instance’s axes to a new scene > copy instance to clipboard > place instance from clipboard into current drawing axes system (whatever they may be, so not only the system’s axes).
It’s all native so I do have to rely on SketchUp to do it right.

Good question.
As far as I know SketchUp’s built-in tolerance for length is 1/1000". But I’m not sure about the tolerance of angles.
I’m also not sure about copy-paste accuracy.

In my extension I’m using the Ruby API angle_between method bw. vectors of model/instance axes and I displaying the “pure” radians. The degrees are formatted according to “Precision” in Settings

But In my extension I’m using the instance transformation inverse to align the axis pairs…(combined some translation to keep in place.).
The instance transformation is meaning "how far and how the instance rotated " relative to model origin and axes. The inverse transformation therefore should do the trick…

So answering to you question:
Yes after using my method, the instance’s axes and the model’s axes are eventually 100% “equal” . At least within SketchUp’s built-in tolerance.

(Even if the calculated angle difference numerically show zeros you can still apply alignment, therefore you can be sure about the “equality”.)

1 Like

Will the extention work with SketchUp 2018? I see it seems to be for 2020.
I would like to test/try it.
b.t.w. I don’t know anything (or hardly) about Ruby so I always try to find a native answer. I admire how you guys come up with coded solutions. :+1:

Yes. I have been tested for 10 minutes in 2017 Make so 2018 should be ok.
The only difference is that if you are inside the Edit component you will be warned to go out first… but you can start after.
in SU 2020 I can " kick you out " via Ruby … :wink:

1 Like

No measurable linear (zero) difference between both directions (local x axis v.s. system’s X axis direction) at 20km distance from that local origin. What can I say other than that it seems to be safe to use. :+1:
Thank you.

2 Likes
You are welcome!

BTW: Happy Anniversary! :beers:

Thank you again!

Bug fix for Dezmo Align Axes:
I forgot about if the instance is scaled. The scale of the instance will not be reset back to 1 with this fix… :blush:

Download

Dezmo_Align_Axes_Beta_2020_0830_1407.rbz (9.5 KB)

Note: Again some fine tune…
New release