Search the Community
Showing results for tags 'osmode'.
Found 1 result
tmelancon posted a topic in AutoLISP, Visual LISP & DCLHello all. I have a LISP routine that I have been using forever now so excuse me if it is written sorta outdated to what it could look like if it were updated. It is a balloon(bubble) routine to insert letters or numbers inside a sized bubble with a line and an arrow. The problem I am having is that when running the command after selecting my first point i have to physically turn off OSNAP then after I enter the numbers and finish the command turn OSNAP back on because if I do not it distorts the arrow... I have a mouse with extra programmed buttons that allows me to speed up the process as if it never happens, but still thats not the point. It would be nice to just keep all my snaps on all the time and let the code and just continue to breeze through my drawings. I have tried a few things and I am finished with trying for now. Besides I have others in my cad department that have regular mice and we all believe it could be made better. Figured I would take it to the CAD community, because after all I know this is what some of you live for also. So to sum it up I am basically looking for the code to be revised so that when I start the command it will change OSMODE properly to allow for everything to be entered with no problems. Whether SNAP is turned off/on of OSMODE is altered I do not really care just as long as SNAP IS ON DURING FIRST USER POINT so that my leader is on my pipe and SNAP IS BACK TO ALL ON after the command. THANKS THANKS THANKS IN ADVANCE! Sorry if I am missing it guys, I have tried. Here is the code: ************************ DATAPOINT BUBBLE INSERTION ************************** (defun c:BALLOON (/ oldlayr oldos) (setq oldlayr (getvar "clayer")) (command "._-layer" "s" TEXT "") (initget (+ 1)) (setq pt1 (getpoint "\nDatapoint location on pipe: ")) ; Get 1st loc (initget (+ 1 32)) (command "OSNAP" "NONE") (setq pt2 (getpoint pt1 "\nDatapoint bubble location: ")) ; Get 2nd loc (initget (+ 1 2 4)) (if (= etype "G") (progn (setq dps (strcase (getstring "\nEnter datapoint ID (A1 - A999) or (A1 - AZ99): "))) ; Get DP# (if (< (strlen dps) 3) (setq csize (* (getvar "userr1") 1.2)) ; balloon for A1 (progn (if (< (strlen dps) 4) (setq csize (* (getvar "userr1") 1.9)) ; balloon for A22 (setq csize (* (getvar "userr1") 2.3)) ; balloon for A333 ) ) ) ) (progn (setq dpnum (getreal "\nEnter datapoint number (1.0-999.9): ")) ; Get DP# (setq dps (rtos dpnum 2 1)) (if (< (strlen dps) 4) (setq csize (* (getvar "userr1") 1.6)) ; balloon for 9.9 (progn (if (< (strlen dps) 5) (setq csize (* (getvar "userr1") 2.0)) ; balloon for 99.9 (setq csize (* (getvar "userr1") 2.4)) ; balloon for 999.9 ) ) ) ) ) (command "._circle" pt2 csize) (setq a (angle pt2 pt1)) (setq OLDOS (getvar "OSMODE")) (setvar "OSMODE" 0) (command "._line" pt1 (osnap (polar pt2 a csize) "nearest") "" ) (setvar "OSMODE" OLDOS) (command "._solid" pt1 (polar pt1 (- a 85) (getvar "userr1")) (polar pt1 (+ a 85) (getvar "userr1")) "" "") (command "._text" "m" pt2 (GETVAR "USERR1") 0 dps) (command "._-layer" "s" oldlayr "") (prin1))