VisDak Posted June 25, 2009 Posted June 25, 2009 Hi all, Good day to all, i have some problem with my Lisp route, When i used on a rotated UCS view the block is jumping away, please see attached code: (Defun C:IBRK (/ aps pbs bs ss os oss sc entline elist pt angrad angdeg f s bk) (setq bs (getvar "BLIPMODE")) (setq ss (getvar "SNAPMODE")) (setq os (getvar "ORTHOMODE")) (setq oss (getvar "OSMODE")) (setq aps (getvar "APERTURE")) (setq pbs (getvar "PICKBOX")) (setvar "blipmode" 0) (setvar "cmdecho" 0) ; (setvar "snapmode" 0) (setvar "orthomode" 0) (setvar "osmode" 0) (setvar "aperture" 6) (setvar "pickbox" 6) (setq sc (getvar "dimscale")) (setq bk (getstring "Select Valve to Insert - <B>all/<G>ate/<P>lug ")) (setq bk (strcase bk)) (if (= bk "B") (setq bk "BALLVLV")) (if (= bk "G") (setq bk "GATEVLV")) (if (= bk "P") (setq bk "PLUGVLV")) (setq entline (entsel "\nPick line to break: ")) (setq elist (entget (car entline)) pt (osnap (cadr entline) "quick,near") angrad (angle (cdr (assoc 10 elist)) (cdr (assoc 11 elist))) ) (setq angdeg (/ (* 180.00 angrad) pi)) (setq f (polar pt angrad (* sc 140.00))) (setq s (polar pt (+ angrad pi) (* sc 140.00))) (command "BREAK" entline "F" f s) (command "INSERT" bk pt sc sc angdeg) (setvar "cmdecho" 1) (setvar "blipmode" bs) (setvar "snapmode" ss) (setvar "orthomode" os) (setvar "osmode" oss) (setvar "aperture" aps) (setvar "pickbox" pbs) (print) ) Please if you can help me to fix with it or change the route if you have similar Lisp route with this that already arrange that i needed, Many thanks Quote
Freerefill Posted June 25, 2009 Posted June 25, 2009 Try transforming the point using the (trans) function. That should let you get a point from your WCS to a UCS. Quote
Lee Mac Posted June 25, 2009 Posted June 25, 2009 Also, instead of using loads of: (setq oldvar (getvar "SYSVAR")) You could make it much more concise using MAPCAR: (setq varlist '("BLIPMODE" "SNAPMODE"...)) (setq oldvar (mapcar 'getvar varlist) Then to reset: (mapcar 'setvar varlist oldvar) Lee Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.