Having a problem with a LISP script

Having a problem with a LISP script

PilonWorks
Participant Participant
939 Views
3 Replies
Message 1 of 4

Having a problem with a LISP script

PilonWorks
Participant
Participant

All,

 

When I run this script:

 

(defun C:ALLFLAT ()
(ssget)
(command "move" "p" "" '(0 0 0) '(0 0 1e99) "move" "p" "" '(0 0 0) '(0 0 -1e99))
)

 

It is only supposed to move all selected objects in the Z axis. This command is moving selected items in the X and Y axis as well. It is only behaving this way for some users. I have done some VBA for autocad scripting but LISP is a bit outside what I know. Could you at least get me pointed in the right direction? Thanks in advance! 

0 Likes
Accepted solutions (1)
940 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant

You should have OSNAPs OFF before you run the code. That could make the difference.

 

Edit: @cadffm  too slooow, again. Sorry!

Message 3 of 4

cadffm
Consultant
Consultant
Accepted solution

VBA or LISP, MOVE is a native command.

I guess you have objects near to 0,0,0

and your running object snaps are ON.

 

You should add (setvar "osnapcoord" 1) as second line 

or add "_none" in front of all coordinates.

 

Quick test: set osnaps off [F3], start the lisp again in this dwg.

 

Sebastian

0 Likes
Message 4 of 4

PilonWorks
Participant
Participant

Yep, having OSNAP turned off fixed the issue, the code is now:

 

(defun C:FLATFLAT ()
(ssget)
(command "move" "p" "" "_none" '(0 0 0) "_none" '(0 0 1e99) "move" "p" "" "_none" '(0 0 0) "_none" '(0 0 -1e99))
)

 

Thanks for the help and this has solved a headache. You guys rock!

0 Likes