Sign in to follow this  
NathanR

Need help with LDraw/LPub RotStep

Recommended Posts

I'm using Bricksmith and LPub 4 to create instructions for a rather large MOC (~8k pieces), but I need help with angles for a few ROTSTEP commands. Currently, I have two steps set in Bricksmith as:
   Step: Relative to default view: x,y,z = 10, -8, 7
   Step: Additive: x,y,z = 180, 70, 180
This gives the following commands in the LDraw file:
   0 ROTSTEP 10.971 -6.596 8.335 REL.   (Side issue - why is this different to the angles I specified??)
   0 ROTSTEP 180.000 70.000 180.000 ADD

The problem is that Bricksmith does an ADD relative to whatever rotation was used for the previous step, while LPub does an ADD rotation relative to the default step orientation (i.e. ROTSTEP 0 0 0 ADD is identical to a STEP command with no previous rotations).  So LPub shows a different view to the one I set in Bricksmith.

I know xyz rotation angles cannot be directly added, so I tried converting them to quaternions, combined them, then converted back to an x,y,z rotation angle.  Unfortunately (10,-8,7) + (180, 70, 180) gives (-140, -76, -148), which is nothing like what I expected.

Is there any way to convert the ROTSTEP ADD command to a ROTSTEP REL command showing exactly the same rotation?

Edited by NathanR

Share this post


Link to post
Share on other sites

It seems like LPub is where the problem is, as it's applying the incorrect rotation for an ADD ROTSTEP:

Quote

Relative, Absolute, Additive determines how the project will be rotated in the relationship to its current view angle.

  • Relative turns the project relative to the default view angle.
  • Absolute will overwrite the default view angle in the 3D pane and set the view point of the rot-step exactly at the values you enter in the X, Y and fields.
  • Additive turns the project based on the previous rotation steps adding the entered values to the already existing view angles.

- from http://www.holly-wood.it/mlcad/basic6-en.html#rotation_steps

Not sure what the best way of solving this would be, but you could just use an absolute rotation as a workaround...

Share this post


Link to post
Share on other sites
6 hours ago, mocbuild101 said:

Not sure what the best way of solving this would be, but you could just use an absolute rotation as a workaround...

I thought about that, but I'm not sure if this change the projection mode from perspective to orthographic?  I found a Relative rot step that gave the same view as an Absolute top-down view, maybe the relative command didn't cancel out the rotation completely, but the rendered images were very slightly different with lines between bricks more prominent.

Share this post


Link to post
Share on other sites
16 hours ago, NathanR said:

(Side issue - why is this different to the angles I specified??)

Because it uses an awful matrix decomposition code? Just guessing here of course, but most of the time unstable under-the-hood rotation code is to blame for such issues. Otherwise I'd simply observe the value the rotations in LPub produce and then kinda hack my way through the script code with values that appear to make the most sense. The "Regenerate Page" button is your friend...

Mylenium

Share this post


Link to post
Share on other sites

I tried LPub3D a few months back, but on opening a model I couldn't get either LDView or LDGLite to render any step images.  I see a new version got released earlier today, might check that out.

Share this post


Link to post
Share on other sites
10 hours ago, NathanR said:

I tried LPub3D a few months back, but on opening a model I couldn't get either LDView or LDGLite to render any step images.  I see a new version got released earlier today, might check that out.

There are a few quirks to it but I have found that it works really well. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.