PDA

View Full Version : Rotate UCS with LISP



Flores
16th Jun 2003, 09:42 pm
I have a problem rotating the ucs with LISP, and keeping the coordinates. I can get it to work in a macro button as follows:




^C^Cpline 0,0 @0,-1.875 @6.8125,0 @0,2.5625 @6.9375,0 @0,4.8125 ;fillet r .25 fillet p l ucs x 90 circle 0,0 .0625 ucs w extrude last path 0,-1;




However, whenever I rotate the UCS in a lisp routine I lose my coordinates, meaning that 0,0 in the world plane has a different location for 0,0 in the frontal plane.
In LISP, I am rotating the plane as follows;




(command "ucs" "x" "90")




I even tried using the ucs with the 3 point option before rotating it, but still no luck.
Any suggestions?
Flores

fuccaro
17th Jun 2003, 06:52 am
Flores
I know just few things about macros. But as I know you can call lisp routines from. I wrote a lisp to generate your...curved pipe (?)
Are you sure that you wish to switch to WCS after you drew the circle? If you call the routine from an other UCS probable you will want to return to that one.
About the coordinates: if your OSNAP is active and you specify a coordinate close to a SNAP point, the returned point will be the “snapped” one. If you have to enter coordinates in lisp it is recommended to deactivate the OSNAP first.

(defun flores()
(setq old (getvar "osmode"))
(setvar "osmode" 0)
(command "pline" '(0 0) "@0,-1.875" "@6.8125,0" "@0,2.5625" "@6.9375,0" "@0,4.8125" "")
(setq pl (entlast))
(command "fillet" "r" 0.25)
(command "fillet" "p" pl)
(command "ucs" "x" "90")
(command "circle" '(0 0 0) 0.025)
(command "extrude" "l" "" "p" pl)
(command "ucs" "w")
(setvar "osmode" old)
)

Flores
17th Jun 2003, 03:10 pm
Thanks Fucarro, now that I see what I was doing wrong, I can apply this to other routines that I am working on. Figuring out what was wrong was a stumbling block for me, but now that I know what was wrong, the other routines should be a piece of cake. I am now learning how to use dialog boxes that have slide images that show what I am drawing and I think that it is pretty cool.

Hasta Luego,
Flores