s-leger / blender_cad_transforms

Precise CAD like transfoms for blender
GNU General Public License v3.0
75 stars 4 forks source link

"To" and "from" points don't match when rotating on X and Y axes #89

Open danielkrajnik opened 1 year ago

danielkrajnik commented 1 year ago

I'm having a problem with rotations on other axes. These steps result in rotation larger than intended (updated comment with reference images posted below): Picking a pivot point Picking a reference point Choosing axis (very chaotic, model jumps a lot, no idea which axis it is without trying them all, and i mean all of them) Picking a target point

ends up with a model landing at a different, often completely unrelated angle. It would be extremely helpful if this could be addressed.

s-leger commented 1 year ago

Basically when you setup reference axis using a single point z axis (default rotation axis) will point up, y axis will be perpendicular to z axis and lie on xy plane, and x axis perpendicular to both y and z axis.

If you setup the rotation axis using an edge as reference, z axis will follow your edge, y axis will be perpendicular to z axis and lie on xy plane, and x axis perpendicular to both y and z axis.

So for some complex rotations you'll probably need 2 rotations.

You should take a look at Maker Tales tutorials about CAD Transform, could help a lot to figure out what's going on. https://www.youtube.com/watch?v=dSjeqRy3KS0

danielkrajnik commented 1 year ago

Thank you for the prompt reply and for your work on this tool in general - it's been a huge help!

I have watched all the videos from Maker Tales, however this specific problem with rotations hasn't been addressed. Objects may have their origins oriented in different ways and so X Y and Z may be different for different pairs of objects, the only way to know it is to go through all 9 combinations which involves many more steps than if we could just choose a second axis - I don't know if it's technically feasible?

For reference here is a command "scale3d" from Rhino, which does that: http://docs.mcneel.com/rhino/5/help/en-us/commands/rotate3d.htm

danielkrajnik commented 1 year ago

Please see a detailed explanation visualised below:

1 2 3 4 6

On the last image a few tries meant a few times it took to press Z Y and then X to find the correct rotation orientation - I think that it could be "more explicit"/easier if one could pick a second axis instead

s-leger commented 1 year ago

Use "E" in order to setup your Z axis using an edge snap at once, then snap to "from" and "to" should rotate your model the way you like.

danielkrajnik commented 1 year ago

Thanks again, but how do you choose a "from" point? Once "E" edge is chosen it jumps immediately to "to" point.

Images showing the issue: 1 (1) 2 (1)

s-leger commented 1 year ago

In such situation, you'll have to add a temporary vertex on the monkey, so duplicate the eye and move it along local z axis. Then you'll be able to setup your rotation axis using eyes points. This will rotate along 1 axis, you may then adjust rotation along the other axis (using monkey eyes)

s-leger commented 1 year ago

Alternative is to rotate the cube, so it does fith with the monkey, then rotate both back.

danielkrajnik commented 1 year ago

Sorry, what I meant is that without being able to specify a "from" point that rotation couldn't be performed as intended. I'm not quite sure how creating another axis between the eyes would help? An axis was already properly established from the target cube.

Rotating the target cube isn't always possible with more complex target objects.

Is there any other solution that could let you specify four points, two axes or an axis and two points that would be possible within the plugin?

It's a really helpful tool and except for this issue with rotations it would be "pivotal" for all CAD professionals

s-leger commented 1 year ago

Not at this time, the main issue here is that you must specify the axis using the object you want to rotate (as from depends on that axis). The quickest way to add a reference axis when missing (like in the monkey situation) is to actually extrude a verted to add an edge matching with desired "from" axis.

danielkrajnik commented 1 year ago

I have tried that but unfortunately it still doesnt seem to work (monkey is rotated incorrectly). Please see screenshots below.

On the last image rotation goes in an opposite direction to the "to" point. I have tried pressing "I" but it flipped it 180 degrees from the last image, which wasnt the intended rotation.

Please correct me if I got any of the steps wrong. As mentioned above it's quite an important transformation and it would be really helpful to know if there's a way to perform it with the plugin.

1 (2) 2 (2) 3 (1)

s-leger commented 1 year ago

https://user-images.githubusercontent.com/7442572/183929544-e65b97ad-dd29-4638-aa22-0cecc1334ce6.mp4

You may need 2nd rotation if your cube is not aligned with axis, but overall should work with temporary reference point.

danielkrajnik commented 1 year ago

deleted

danielkrajnik commented 1 year ago

Thanks a lot, that clarified that there was a problem with an object - I am not sure what causes it though. If you could take a look at the video below - one monkey isnt rotating like on the video you sent, while another one is. Both have the same orientation of the origins.

Couldn't upload the video, but in summary when making the rotation as you showed this comes as a default axis: ergegeg

danielkrajnik commented 1 year ago

As a follow up question are you aware of any other plugin that allows for a rotation with an arbitrary axis? I can see now that cad transform is meant to work only with the default object axes, but there are situation in professional CAD modelling where this is not enough.

danielkrajnik commented 1 year ago

As mentioned above the transformation on the video wouldn't work if the monkey was rotated 90 degrees on z axis.

If you then try to switch to x axis you should be able to reproduce the problem I mentioned - the "to" target point won't be the same as the final transformation (rotation will be off by what appears to be 90 degrees).

Even when extruding secondary axes for the monkey the same issue appears - "to" and "from" points don't match.

It's the same problem as described with the images in the fourth comment above.

To clarify, the problem appears always whenever pressing any of the axes three times - in this mode the "from" points gets by what appears to be 90 degrees plus the "to" value.

danielkrajnik commented 1 year ago

Sample file - if anyone knew how to rotate that with existing toolkit, that would solve the issue: https://github.com/danielkrajnik/samples/blob/56fd623507e29ce510554621257f5686f677ab47/sample-rotation-problem.blend

danielkrajnik commented 1 year ago

Follow up - still can't find a way to rotate on object's axis...