Author Topic: I can't fix it my problem  (Read 694 times)

0 Members and 1 Guest are viewing this topic.


  • Mosquito
  • Posts: 2
I can't fix it my problem
« on: April 02, 2019, 05:53:11 AM »
hi everyone
i trying to get distance from start point or end point by given distance, but an error occurred and break line also not work where i insert the door. kindly help this issue. I attached here my doorlisp as your reference.
thanks advance

(defun c:door ()

  (setq dw (getdist    "\nWidth of panel swing door: "))
  (setq hin (getdist "\nOffset of wall hinge from adjacent wall: "))
  ;(initget 1 "hin")
  (setq ss (car(entsel  "\nselect inside wall : ")))
  (setq se (entget ss))
  (setq sf (cdr (assoc 10 se)))
 ;(setq sc (cons 11 hin))

  (setq ip (getpoint sc "\nselect outside wall: "))

  (setq p1 (polar sc (dtr 0.00)0.05))
  (setq p2 (polar p1 (dtr 90.00)dw))
  (setq p3 (polar p2 (dtr 180.0)0.05))
  (setq p4 (polar sc (dtr 270.0)0.2))
  (setq p5 (polar sc (dtr 0.00)dw))
  (setq p6 (polar p5 (dtr 270.0)0.2))
  (command "pline" "none" sc "none" p1 "none" p2 "none" p3  "cl")
  (command "line" sc p4 "")
  (command "line" p5 p6 "")
  (command "_arc" p2   "e" p5 "none" "d" 0  )
  ;(command "layer" "m" "door" "c" red "")
  (command "break" ip "f" p4 p6 )



  • Bull Frog
  • Posts: 335
  • I exist therefore I am!
Re: I can't fix it my problem
« Reply #1 on: April 02, 2019, 09:00:18 AM »

Here is a snippet from my door routine that you can modify to your needs.

Code: [Select]
(defun c:dooropening()
(setq pt0 (getpoint "\nSelect offset point: "))
   (princ "\nDistance from offset point <")
   (princ *drof)
   (setq drof (getdist ">: "))
   (if (not drof) (setq drof *drof) (setq *drof drof))
   (setvar "osmode" 512)
   (setvar "orthomode" 1)
   (setq pt2 (getpoint pt0
        "\nSelect approximate strike location on same wall: "))
   (setq ang2 (angle pt0 pt2)
         pt1  (polar pt0 ang2 drof)
   (setvar "osmode" 128)
   (setq *doorw 36.0)
   (setq pt3 (getpoint pt1
        "\nSelect opposite face of wall to be opened: "))
        (princ "\nEnter door width <")
        (princ *doorw)
        (setq doorw (getdist ">: "))
        (if (not doorw) (setq doorw *doorw) (setq *doorw doorw))
        (setq doorwn (* -1.0 doorw)
   (setvar "osmode" 0)
   (setq ang1 (angle pt1 pt3)
         ang3 (fix (- ang1 ang2))
         dst1 (distance pt1 pt3)
         dst2 (distance pt1 pt2)
   ;(if (> dst2 54.0)
   ;  (setq pt4 (polar pt1 ang2 doorw)))
   ;(if (< dst2 54.0)
     (setq pt4 (polar pt1 ang2 doorw));)
     (setq pt5 (polar pt4 ang1 dst1))

; Swap break points to match the wall angle
    (if (minusp (sin (- ang2 (angle pt1 pt3))))
     (setq temp pt1 pt1 pt3 pt3 temp TEMP1 PT4 PT4 PT5 PT5 TEMP1)
        ".break" pt4 pt1
        ".break" pt5 pt3)
(command ".line"  pt1 pt3 "")
(command ".line"  pt4 pt5 "")
AutoCAD 2010 64-bit, AutoCADMap 2008, 2010, Revit 2012


  • Mosquito
  • Posts: 2
Re: I can't fix it my problem
« Reply #2 on: April 03, 2019, 03:12:06 AM »
thank you so much for your email
i tried your lisp,but it is very hard to understand your door lisp.i can't understand this function "(if (not doorw) (setq doorw *doorw) (setq *doorw doorw)" and for what using this function
"(if (minusp (sin (- ang2 (angle pt1 pt3)))"
i just ask how to get the distance from start point or end point by given distance. kindly try my lisp and modified.

thanks advance


  • Bull Frog
  • Posts: 452
  • 30 + years of using Autocad
Re: I can't fix it my problem
« Reply #3 on: April 13, 2019, 01:04:59 AM »
A door has 4 answers in/out left/right, to get around this in the past we ask pick near corner this sets up start - end pts then door width, hinge side, in or out, then draw door, full 3d with 4 line walls, sorry copyrite.
« Last Edit: April 14, 2019, 02:09:27 AM by BIGAL »
A man who never made a mistake never made anything