Metasequoia BBS

| 新規投稿 | 通常表示 | ツリー表示 |
状態
タグ
キーワード
[9668] Change object's local axis via plugin or script / d4rt
対応済み [質問,local axis] 返信
I have a few objects consisting of 1 face each. I need a way to automatically align the local axis of these objects with the faces' normal vector. Is it possible to do so via a plugin or a python script?
2023-02-11 01:20
[9672] Re: Change object's local axis via plugin or script / 管理者
Not sure if it already exists, but at least that functionality could be implemented as a plugin or script.
2023-02-13 11:02
[9675] Re: Change object's local axis via plugin or script / d4rt
Ok, I wrote a python script that calculates the normal, forward and right unit vectors and centroid of a face. But I still have to rotate the object's local axis. However I don't know how to convert these 3 axes to euler angles to be used by MQObject.rotation. Could you help me out?
2023-02-13 23:14
[9676] Re: Change object's local axis via plugin or script / d4rt
The object's local axis should be aligned like so: https://i.imgur.com/hPRGBbM.gif
2023-02-14 00:22
[9678] Re: Change object's local axis via plugin or script / 管理者
The three axes can be stored in a matrix and then converted to an euler angle. The pseudo code is thus.

mtx = MQSystem.newMatrix()
mtx.set(row, col. value) # x9 for each row&col
obj.rotation = mtx.getRotation()
2023-02-14 10:45
[9682] Re: Change object's local axis via plugin or script / d4rt
It worked like a charm! Thank you so much! :)
2023-02-14 20:15
[9683] Re: Change object's local axis via plugin or script / cant mirror in code dsnt let me select mirrored fa
>It worked like a charm! Thank you so much! :) can u give me small snipet how the code should look like ? :)
2023-02-15 01:50
[9684] Re: Change object's local axis via plugin or script / cant mirror in code dsnt let me select mirrored fa
>I have a few objects consisting of 1 face each. I need a way to automatically align the local axis of these objects with the faces' normal vector. Is it possible to do so via a plugin or a python script?

need snippet to move object down and rotate 180.
2023-02-15 02:16
[9689] Re: Change object's local axis via plugin or script / no error in code.
>I have a few objects consisting of 1 face each. I need a way to automatically align the local axis of these objects with the faces' normal vector. Is it possible to do so via a plugin or a python script?

need snipped to move Obj1 to up bit and rotate 180  in 3dview port with py script ! :S
2023-02-15 17:28