Jump to content

Help distance and azimuth lisp


Madruga_SP

Recommended Posts

Don't worry about it. We're just teasing you is all. :)

 

Whatever. I want my money's worth for "_non".

Link to comment
Share on other sites

  • Replies 46
  • Created
  • Last Reply

Top Posters In This Topic

  • pBe

    15

  • Madruga_SP

    14

  • hmsilva

    5

  • alanjt

    4

Top Posters In This Topic

Posted Images

  • 3 years later...

My unit settings are decimal , grads ,clock wise ,and direction noth and i use annotation texts.

 

I update the code but i have the same problems

 

1) I change the rad to grad but the angle is in dregrees (i dont know why)

2) the direction is clockwise

3)I try to change the direction to north but i am not sure if is correct . I want to calculate the angle a

4)I add a layer

5)I add annotate text style (but is not working with the text , something is missing). I want the paper text height to be 2.5 not the text height in model space

 

Can any one help ?

thanks

 

;;; ROTINA PARA COTAR E OU AZIMUTAR POLYLINES - TEXTO NO DESENHO = 2.34 ou 2.34 - Az 23°15΄7" 
;;; AS MEDIDAS APARECEM COMO FORAM DIGITADAS NO DESENHO (METROS, MILΝMETROS, ETC) 
;;; A ALTURA DO TEXTO Ι SOLICITADA NA EXECUΗΓO DA ROTINA E O STYLE Ι O CORRENTE 
;;; ACERTAR ALTURA DO TEXTO DE ACORDO COM A ESCALA DE PLOTAGEM. PARA DEIXAR EM DEFAULT USE O COMMAND: TEXTSIZE 
;;; Forum www.autolisp.com.br - Nome da rotina original: AZPOL - Autor: Orlei 29/08/2006 
;;; Adaptaηγo: Rogιrio Zanini e Mαrcio 
;;;---------------------------------------------------------- ------------------------ 

(defun C:AZI () 
(command "undo" "begin")
;---------------Sub-functions - Start------------- 
(defun Radtograds () 
(/ (* (angle A B) 200) Pi) 
) 
;------------------------------------------------- 
(defun Gradstorad (AZIMUTE) 
(* (/ AZIMUTE 200) Pi) 
) 
;------------------------------------------------- 
(defun PARALELO () 
(setq A1 (polar A (+ (/ pi 2)(angle B A )) (+ (* 0.15 htext))))  
(setq B1 (polar B (+ (/ pi 2)(angle B A )) (+ (* 0.15 htext))))
(setq ptx (/ (+ (car B1) (car A1)) 2)) 
(setq pty (/ (+ (cadr B1) (cadr A1)) 2)) 
(setq ponto_meio (list ptx pty)) 
(if (< (car A1)(car B1)) 
(setq inicio B1) 
(setq inicio A1) 
) 
) 
;------------------------------------------------- 
(defun MUDAR () 
(setq XL 2) 
(setq J "d") 
(setq COM1 (substr D 1 1)) 
(while (< XL 5) 
(setq LETRAT (substr D XL 1)) 
(setq RESTOT (substr D (+ 1 XL) )) 
(if (= LETRAT J) 
(progn (setq J "%%d") 
(setq XL 6) 
(setq PALAV (strcat COM1 J RESTOT)) 
) 
) 
(setq COM1 (strcat COM1 LETRAT )) 
(setq XL (1+ XL)) 
) 
) 
;----------------Sub-functions - End ------------- 
(setq tsize (getvar "textsize")) 
(setq htext 2.5) 
(COMMAND "_layer" "_m" "_AZIMUTH" "_c" "150" "" "")
(command "_.-style" "_TopoCad" "arial.ttf" "_annotative" "_yes" "_no" 2.5 1.0 0.0 "_no" "_no" "_no")
(setvar"cmdecho" 0) 
(command "osmode" 0) 
(command "angbase" 300) 
(command "angdir" 1) 
(setq flagv "falso") 
(setq controle 0) 
(setq controle1 0) 
(setq contador 0) 
(while (= flagv "falso") 
(setq mostre (entsel "\nSelecione a Polyline <2d> : ")) 
(setq linha (entget (car mostre ))) 
(setq verificador (cdr(assoc 0 linha))) 
(if (= verificador "LWPOLYLINE") 
(progn 
(setq verif (cdr (assoc 70 linha))) 
(setq flagv "verdade") 
) 
(Princ "\ nIt is not Polyline !!") 
) 
) 
(setq controle1 (length linha)) 
(setq amostra '()) 
(repeat controle1 
(setq x (caar linha)) 
(if (= x 10) 
(progn 
(setq item (car linha)) 
(setq amostra (cons item amostra)) 
(setq contador (1+ contador)) 
) 
) 
(setq linha (cdr linha)) 
) 
(setq amostra1 (reverse amostra)) 
(if (= verif 1) 
(setq amostra (cons (car amostra1) amostra)) 
(setq contador (1- contador)) 
) 
(setq controle contador) 
(repeat controle 
(setq PTO1 (cdr(car amostra))) 
(setq PTO2 (cdr(car(cdr amostra)))) 
(AZIMUTAR) 
(setq amostra(cdr amostra)) 
) 
(command "undo" "end") 
(princ) 
) 
(defun AZIMUTAR () 
(setq padroes (getvar "osmode")) 
(setvar"cmdecho" 0) 
(command "osmode" 0) 
(setq A PTO1) 
(setq B PTO2) 
(setq C " - Az ")
(setq D (angtos (angle A B) 1 4))
(MUDAR) 
;------------- MODIFICAΗΓO ROGΙRIO OPΗΓO AZIMUTE ---------------- 
(setq E (Strcat(rtos (distance A B) 2 2)"m"))   
(setq DADO (strcat E C PALAV)) 
;---------------------------------------------------------- ------ 
(PARALELO) 
(entmake 
(list 
(cons 0 "TEXT") 
(cons 7 (getvar "textstyle")) ;STYLE DE TEXTO CORRENTE DO DESENHO 
(cons 100 "AcDbText") 
(cons 10 ponto_meio) 
(cons 11 ponto_meio) 
(cons 40 htext) ;ALTURA DO TEXTO CORRENTE NO DESENHO 
(cons 1 dado) 
(cons 50 (angle ponto_meio inicio)) ;TEXTO PARALELO A LINHA 
(cons 72 1)
(cons 73 1) 
) 
) 
(setvar "textsize" tsize) 
(command "osmode" padroes) 
(command "osmode" "37") ; ACRESCENTADO MΑRCIO - OSNAP END/INT/CEN 
(princ) 
)

1.jpg

Link to comment
Share on other sites

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