teknomatika Posted March 21, 2012 Posted March 21, 2012 Greetings. I have a simple routine that allows to write the Z coordinates in a profile. It works, but if I'm working in an area with a small zoom, it has a behavior that distorts the triangle or does not ensure the removal of the text relative to the upper base of the triangle. If the zoom is further reduced, the triangle is not even designed. Appreciate your help for its optimization. My knowledge is limited. There are not enough to resolve the difficulty.. ;; (defun c:LEVZ(/ factesc cotorig defy defyn p1 p2 p3 cotorigt x1 y1 yf z1 yfinal ) (setq factesc (getreal "INSERT SCALE FACTOR (HIGHT STANDARD 0.20): ")) (if (= factesc nil) (setq factesc 1) ) (setq cotorig (getpoint "SELECT POINT: ")) (setq defy (cdr cotorig)) (setq defyn(car defy)) (setq p1 (polar cotorig 0.785398 (* factesc 0.62))) (setq p2 (polar p1 3.141593 (* factesc 0.88))) (setq p3 (polar p2 -0.785398 (* factesc 0.62))) (command "layer" "new" "Cotas_Nível" "color" "103" "Cotas_Nível" "") (command "layer" "set" "Cotas_Nível" "") (command "_Pline" "_non" p1 p2 P3 "C") (setq cotorigt (polar p2 1.570796 (* factesc 0.05))) (setq x1 (car cotorigt)) (setq y1 (cadr cotorigt)) (setq yf (+ y1 0.05)) (setq z1 (caddr cotorigt)) (setq yfinal (list x1 yf z1)) (command "text" yfinal (* factesc 0.20) 0 (rtos defyn 2 2)) (princ) ) (prompt "\ntYPE: LEVZ") Quote
Lee Mac Posted March 21, 2012 Posted March 21, 2012 I haven't looked over the whole code, but immediately I see this: (command "_Pline" "_non" p1 p2 P3 "C") Change it to: (command "_.pline" "_non" p1 "_non" p2 "_non" p3 "_C") Quote
teknomatika Posted March 21, 2012 Author Posted March 21, 2012 I haven't looked over the whole code, but immediately I see this: (command "_Pline" "_non" p1 p2 P3 "C") Change it to: (command "_.pline" "_non" p1 "_non" p2 "_non" p3 "_C") Tanks, Upgraded, experimented and it seems stable. In the command text also includes "_non" and seems to have solved the issue of distance to the upper base. ;; (defun c:LEVZ(/ factesc cotorig defy defyn p1 p2 p3 cotorigt x1 y1 yf z1 yfinal ) (setq factesc (getreal "INSERT SCALE FACTOR (HIGHT STANDARD 0.20): ")) (if (= factesc nil) (setq factesc 1) ) (setq cotorig (getpoint "SELECT POINT: ")) (setq defy (cdr cotorig)) (setq defyn(car defy)) (setq p1 (polar cotorig 0.785398 (* factesc 0.6223))) (setq p2 (polar p1 3.141593 (* factesc 0.8800))) (setq p3 (polar p2 -0.785398 (* factesc 0.6223))) (command "layer" "new" "Cotas_Nível" "color" "103" "Cotas_Nível" "") (command "layer" "set" "Cotas_Nível" "") (command "_.pline" "_non" p1 "_non" p2 "_non" p3 "_C") (setq cotorigt (polar p2 1.570796 (* factesc 0.05))) (setq x1 (car cotorigt)) (setq y1 (cadr cotorigt)) (setq yf (+ y1 0.05)) (setq z1 (caddr cotorigt)) (setq yfinal (list x1 yf z1)) (command "_.text" "_non" yfinal (* factesc 0.20) 0 (rtos defyn 2 2)) (princ) ) (prompt "\ntYPE: LEVZ") Another thank you. Quote
Lee Mac Posted March 21, 2012 Posted March 21, 2012 Maybe you can draw some inspiration from this program: http://lee-mac.com/elevationmarker.html Quote
teknomatika Posted March 21, 2012 Author Posted March 21, 2012 Maybe you can draw some inspiration from this program: http://lee-mac.com/elevationmarker.html Lee, I already know and use well. It is excellent. In the case of my routine, it is poor, but it is my "daughter". Therefore, the importance that I want to fix and understand what was wrong. Quote
BIGAL Posted March 22, 2012 Posted March 22, 2012 A good habit to stop problems like this to turn of snaps and turn back on at end. The zoom factor can be a problem and I have experienced this also the way to get around it is use zoom Center and a scale draw object then Zoom Previous, it is a bug in Autocad spent a long time trying to work out why program would or would not work till discovered zoom problem. (setq oldsnap (getvar"osmode")) (setvar "osmode" 0) . . . (setvar "osmode" oldsnap) 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.