MoI discussion forum
MoI discussion forum

Full Version: Axis lock

From: Barry-H
10 Jun 2018   [#1]
Is there a script that locks the axis when moving parts.
ie: pressing X will only allow movement on X axis ?

Barry
From: Michael Gibson
10 Jun 2018   [#2] In reply to [#1]
Hi Barry, that's what "Straight Snap" on the bottom toolbar is for. If straight snap is enabled, then when you move if you keep your mouse near the x axis direction it will snap onto it and you'll see a dashed line going in that direction with an axis letter label at the base point.

You can also hold down the Shift key to force straight snap to engage to the closest axis line no matter how far away you are from it.

If you're having difficulty with keeping the regular straight snap engaged though it's probably due to your high screen density. Try increasing the values under Options > Snaps > "Straight snap options" for "Activate distance" and "Keep active distance".

The "Activate distance" is how many pixels you need to be away from the actual axis line for straight snap to engage, and the "Keep active distance" is how many pixels you can be away from it to keep it on after it has started.

- Michael
From: Barry-H
10 Jun 2018   [#3] In reply to [#2]
Hi Michael,
I have tried that and it helps but think being able to lock the axis by pressing the X/Y or Z buttons when moving in the 3D view would be helpful.
Thanks
Barry
From: Michael Gibson
10 Jun 2018   [#4] In reply to [#3]
Hi Barry, try setting these scripts up on shortcut keys for the X, Y, Z keys:

script: /* Snap to x direction */ var pp = moi.ui.getActivePointPicker(); if ( pp && pp.basePt ) { pp.restrictToLinePtDir( pp.basePt, moi.vectorMath.createPoint(1,0,0), true ); }

script: /* Snap to y direction */ var pp = moi.ui.getActivePointPicker(); if ( pp && pp.basePt ) { pp.restrictToLinePtDir( pp.basePt, moi.vectorMath.createPoint(0,1,0), true ); }

script: /* Snap to z direction */ var pp = moi.ui.getActivePointPicker(); if ( pp && pp.basePt ) { pp.restrictToLinePtDir( pp.basePt, moi.vectorMath.createPoint(0,0,1), true ); }

- Michael
From: Barry-H
10 Jun 2018   [#5] In reply to [#4]
Hi Michael,
thank you works great.
Many Thanks

Barry
From: Barry-H
11 Jun 2018   [#6] In reply to [#4]
Hi Michael,
I have been using the axis lock scripts and works fine but found this error report ( see photo) when selecting the move command and pressing an axis key without selecting a base point or bounding box. Would it be possible to have a prompt box reminding to pick base point rather than an error ?
Having the ability to lock axis when moving objects in the 3D view is a good feature and perhaps may become a standard part of Moi.

Again many thanks

Barry

Image Attachments:
Screenshot (114).png 


From: Michael Gibson
11 Jun 2018   [#7] In reply to [#6]
Hi Barry,

re:
> found this error report ( see photo) when selecting the move command and pressing an axis key
> without selecting a base point or bounding box.

That's actually a bug in the point picker script interface. The JavaScriptCore engine doesn't like it if a property value of 'undefined' is returned if we've told it a particular property name exists, it needs to return null instead.

I've got it fixed up so the next v4 beta shouldn't show that error anymore.

- Michael