Jump to content

Recommended Posts

Posted

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..:oops:

 

 

 

;;
(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")

cadtutor1.jpg

Posted

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")

Posted
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.

Posted
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.

Posted

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)  

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...