elfert Posted February 14, 2012 Share Posted February 14, 2012 Hello i found this: http://cad-notes.com/2010/12/autolisp-exercise-using-block-and-conditional-if/ And i modified it some of my needs, but i can't make the osnap endpoint and intersection function to work at the line (setvar "OSMODE" 33), why? ;;Level0 put in level arrow in level 0 in different direktions. (defun c:Level0 (/ oldcmdecho oldosnap cnglobalscale labelposition levelarrowtype y x zerolevelposition y1 x1) ;;setting up before the real work is going on (setq oldcmdecho (getvar "cmdecho")) (setq oldosnap (getvar "osmode")) (setvar "cmdecho" 0) ;;checking the scale (if (= cnglobalscale nil) ; this will check if user already has defined the drawing scale (setq cnglobalscale (getreal "\nSet Global Scale for CN Annotation <1/1>: ")) ) (if (= cnglobalscale nil) ; this will check if the user choose default value (setq cnglobalscale 1) ) (initget 1) (while (setq labelposition (getpoint "\nPick Label Position for zerolevel: ")) (setvar "OSMODE" 33) (setq levelarrowtype (getpoint "\nPick Direction of level arrow")) (setvar "OSMODE" 0) ;;setting up the zerolevel position (setq y 0) (setq x (car labelposition)) (setq zerolevelposition (list x y)) ;;getting direction on level arrow (setq y1 (cadr levelarrowtype)) (setq x1 (car levelarrowtype)) ;;Labelling the level (setq label "%%p 0.00") ;;setting conditions (cond ((and(>= y1 0) (> x1 x)) (command "_-insert" "kote3" zerolevelposition cnglobalscale cnglobalscale 0 label)) ((and(<= y1 0) (> x1 x)) (command "_-insert" "kote4" zerolevelposition cnglobalscale cnglobalscale 0 label)) ((and(>= y1 0) (< x1 x)) (command "_-insert" "kote1" zerolevelposition cnglobalscale cnglobalscale 0 label)) ((and(<= y1 0) (< x1 x)) (command "_-insert" "kote2" zerolevelposition cnglobalscale cnglobalscale 0 label)) ) (setvar "osmode" oldosnap) (setvar "cmdecho" oldcmdecho) (princ) ) ) Thx in advance Quote Link to comment Share on other sites More sharing options...
pBe Posted February 15, 2012 Share Posted February 15, 2012 (edited) Not sure what you mean though its either you wrap both getpoint prompt on the while condtion with (setvar 'osmode 33) then set it to 0 after after picking the points (while [color=blue][b](progn[/b][/color] [b][color=blue] (setvar "OSMODE" 33) [/color][/b] [b][color=blue] (setq labelposition (getpoint "\nPick Label Position for zerolevel: "))[/color][/b] [b][color=blue] (setq levelarrowtype (getpoint labelposition "\nPick Direction of level arrow")))[/color][/b] (setvar "OSMODE" 0) ..... or leave the osmode setting as it is and just add "_non" within the call for command "insert" (command "_-insert" "kote3" [color=blue][b]"_non"[/b][/color] zerolevelposition cnglobalscale cnglobalscale 0 label) Edited February 15, 2012 by pBe Quote Link to comment Share on other sites More sharing options...
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.