Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

door macro

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
Anonymous
520 Views, 6 Replies

door macro

hello!

 

I was trying to use this macro : 

 

(defun c:door ()
(setq ponto (getvar "osmode"))
(setvar "osmode" 1)
(setq p1 (getpoint "Indique o ponto onde a porta gira: "))
(setq p2 (getpoint "Indique o ponto onde a porta bate: "))
(setq p3 (getpoint "indique para que lado a porta abre indicando um pont: "))
(command "ucs" "n" "3" p1 p2 p3)
(setq p1t (trans p1 0 1) p2t (trans p2 0 1))
(command "arc" "c" p1t p2t "a" "90")
(command "line" p1t (list (car p1t) (+ (cadr p1t) (distance p1t p2t))) "")
(command "ucs" "world")
(setvar "osmode" ponto)
)

 

But i want to change it and make a doors that is opened only 45º and not 90º as is is in this macro. (see the pic that i add)

Someone help me?

 

Tags (1)
6 REPLIES 6
Message 2 of 7
hmsilva
in reply to: Anonymous

Hello Marta and welcome to the Autodesk Community!

 

Maybe something like this

(defun c:p45 (/ p1 p2 p3 osm)
  (setq osm (getvar "osmode"))
  (setvar "osmode" 1)
  (if (and (setq p1 (getpoint "Indique o ponto onde a porta gira: "))
           (setq p2 (getpoint p1 "Indique o ponto onde a porta bate: "))
           (setq p3 (getpoint "indique para que lado a porta abre indicando um ponto: "))
      )
    (progn
      (command "ucs" "n" "3" p1 p2 p3)
      (setq p1 (trans p1 0 1)
            p2 (trans p2 0 1)
      )
      (command "arc" "c" p1 p2 "a" "45")
      (command "_.line" p1 (polar p1 (* 0.25 pi) (distance p1 p2)) "")
      (command "ucs" "world")
    )
  )
  (setvar "osmode" osm)
  (princ)
)

 

For customization try the Visual LISP AutoLISP and General Customization forum...

 

EDIT: se necessitares de ajude em Português tenta o forum do AutoCAD - Português

 

Hope that helps

Henrique

EESignature

Message 3 of 7
Anonymous
in reply to: hmsilva

thank you!!

can you explain what means 

 (setq p1 (trans p1 0 1) . what "TRANS" means?

 

thank you!

 

 

Message 4 of 7
hmsilva
in reply to: Anonymous


@Anonymous wrote:

can you explain what means 

 (setq p1 (trans p1 0 1) . what "TRANS" means?

 

thank you!


You're welcome, Marta,

 

trans function, translates a point from one coordinate system to another...

 

Henrique

EESignature

Message 5 of 7
hmsilva
in reply to: Anonymous

Marta,

the code with a slight modification, in order to work in UCS/WCS

 

(defun c:p45 (/ p1 p1w p2 p2w p3 osm)
  (setq osm (getvar "osmode"))
  (setvar "osmode" 1)
  (if (and (setq p1 (getpoint "\nIndique o ponto onde a porta gira: "))
           (setq p2 (getpoint p1 "\nIndique o ponto onde a porta bate: "))
           (setq p3 (getpoint "\nIndique para que lado a porta abre indicando um ponto: "))
      )
    (progn
      (setq p1w (trans p1 1 0)
            p2w (trans p2 1 0)
      )
      (command "_.ucs" "_N" "3" p1 p2 p3)
      (setq p1 (trans p1w 0 1)
            p2 (trans p2w 0 1)
      )
      (command "_.arc" "_C" p1 p2 "_A" "45")
      (command "_.line" p1 (polar p1 (* 0.25 pi) (distance p1 p2)) "")
      (command "_.ucs" "_p")
    )
  )
  (setvar "osmode" osm)
  (princ)
)

 

Hope that helps
Henrique

EESignature

Message 6 of 7
Anonymous
in reply to: hmsilva

Hi Henrique,

Sorry, can you help me finihing my command? 

you allready gave me onde door, but i really need the  of them! thank you!!

 

 

pormenor janela.png

Message 7 of 7
hmsilva
in reply to: Anonymous

Hi Marta,

 

as I have said in my first post (see the links there), for AutoLISP try the Customization forum, or in Portugês the Portugês forum...

It will be easier to get help there.

 

This is just a simple amendment to the previous code, If you need the doors with more detail, post in one of those forums

 

(defun c:2p45 (/ p1 p1w p2 p2w p3 osm)
  (setq osm (getvar "osmode"))
  (setvar "osmode" 1)
  (if (and (setq p1 (getpoint "\nIndique o ponto onde a primeira porta gira: "))
           (setq p2 (getpoint p1 "\nIndique o ponto onde a segunda porta gira: "))
           (setq p3 (getpoint "\nIndique para que lado as portas abrem indicando um ponto: "))
      )
    (progn
      (setq p1w (trans p1 1 0)
            p2w (trans p2 1 0)
      )
      (command "_.ucs" "_N" "3" p1 p2 p3)
      (setq p1   (trans p1w 0 1)
            p2   (trans p2w 0 1)
            pmid (polar p1 (angle p1 p2) (/ (distance p1 p2) 2.0))
      )
      (command "_.arc" "_C" p1 pmid "_A" "45")
      (command "_.arc" "_C" p2 pmid "_A" "-45")
      (command "_.line" p1 (polar p1 (* 0.25 pi) (distance p1 pmid)) "")
      (command "_.line" p2 (polar p2 (* 0.75 pi) (distance p2 pmid)) "")
      (command "_.ucs" "_p")
    )
  )
  (setvar "osmode" osm)
  (princ)
)

 

I hope this helps

(espero que ajude)

Henrique

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost