HaRDeStWaY Posted May 9, 2010 Posted May 9, 2010 Why is it so, that my code works like one time and then it takes different coordinates. And sometimes, it doesn't even draw anything, except a little circle. How can I make my center line to be Line type? (I did use dimcen with negative value to make it "Line") Would have posted pictures, but the protection kicked in. (DEFUN C:U13_Bukauskas() (setq p (getpoint "\nIveskite apskritimo centro koordinates: ")) (setq x (getint "\nIveskite apskritimo skersmeni: ")) (command "color" "t" "0,0,0") (setq p1 (polar p PI (* x 1.5))) (setq p1 (polar p1 (/ (* 90 PI) 180) (* 0.5 x))) (setq p2 (polar p1 (* 0.5 PI) (* x 1.5))) (setq p3 (polar p2 (* 0 PI) (* x 2))) (setq p4 (polar p3 (* 0 PI) x)) (setq p5 (polar p4 (/ (* 270 PI) 180) (* x 2.5))) (setq p6 (polar p5 (/ (* 270 PI) 180) (* x 1.5))) (setq p7 (polar p6 PI (* x 2))) (setq p8 (polar p7 PI x)) (setq p9 (polar p1 (* 0 PI) (* 2 x))) (setq p10 (polar p5 PI (* x 2))) (setq p11 (polar p PI (* x 0.6))) (setq p12 (polar p 0 (* x 0.6))) (setq p13 (polar p (/ (* 270 PI) 180) (* x 0.6))) (setq p14 (polar p (/ (* 90 PI) 180) (* x 0.6))) (command "Line" p1 p2 "") (setq L (entlast)) (command "Line" p2 p3 p4 p5 p6 p7 p8 p1 "") (command "color" "white" "-hatch" "p" "s" "s" L p2 p3 p4 p5 p6 p7 p8 p1 "" "") (command "color" "t" "0,0,0") (command "circle" p "d" x "") (setq aps (entlast)) (command "color" "blue") (command "dimcen" "-2.5" "") (command "dimcenter" (list (entlast) (polar p 0 x)) "") (command "color" "t" "0,0,0") (command "hatch" "s" aps "") (command "color" "t" "0,0,0") (command "Line" p9 p1 "") (setq E1 (entlast)) (command "Line" p9 p3 "") (setq E2 (entlast)) (command "Line" p10 p5 "") (setq E3 (entlast)) (command "Line" p10 p7 "") (setq E4 (entlast)) (command "fillet" "radius" (* 0.5 x)) (command "fillet" "trim" "T" E1 E2) (command "fillet" "trim" "T" E3 E4) ) Quote
Lee Mac Posted May 9, 2010 Posted May 9, 2010 Object Snap is most likely interfering with your command calls. Perhaps look into using entmake(x) to create your entities: (defun line ( s e ) (entmakex (list (cons 0 "LINE") (cons 10 s) (cons 11 e) ) ) ) (defun circle ( c r ) (entmakex (list (cons 0 "CIRCLE") (cons 10 c) (cons 40 r) ) ) ) Quote
RichardMPH Posted May 9, 2010 Posted May 9, 2010 You can set the Object Snap variable to 0 and then set it back to the current value after. This will require very little editing of your program. Add (setq oldsnap (getvar "OSMODE")) to save the current object snap, add (setvar "OSMODE" 0) to turn the object snap off and then add (setvar "OSMODE" oldsnap) to the end of your code to restore the previous object Snap Settings. DraughtIT Design and Draughting Services Quote
HaRDeStWaY Posted May 9, 2010 Author Posted May 9, 2010 Thanks for the answers. Gosh, how did I miss OSNAP function? And thanks for the code for the OSNAP turn off/ on. Everything is working now. As for the "Line" type center mark, I just had to use -1 instead of -2.5. 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.