Jump to content

Advice on a simple door tool


Clifford169

Recommended Posts

I need something that will allow me to choose a door opening, either by line selecting or choosing two points, and then decide the door swing and side of the line.

Also, I need the lines to be essentially a quarter circle with a polyline drawn out to the quadrant. Simple single lines is all I need.

 

Per your request- Pick an origin point, door opening width, and then swing angle. Simple lines. Let me know if it works for you.

 

(defun c:door (/ pt1 pt2 an1 ang2 dis pt3 a_object a_length )
 (initget 1)
 (setq pt1 (getpoint "\nInsertion Point:   ")
       pt2 (getpoint "\nDoor Opening Width:     ")
       an1 (getangle pt1 "\nSwing Direction:   ")
       an2 (angle pt1 pt2)
       dis (distance pt1 pt2)
       pt3 (polar pt1 an1 dis))     

 (command "line" pt1 pt3 "")
 (entmake (list (cons 0 "ARC")
     	 (cons 10 pt1)
     	 (cons 40 dis)
     	 (cons 50 an2)
     	 (cons 51 an1)))
 (setq a_object (vlax-ename->vla-object (entlast)))
 (setq a_length (vlax-curve-getdistatparam a_object 
                     (vlax-curve-getendparam a_object )))
 (cond ((>= a_length (* dis pi))
 (vla-delete a_object)
 (entmake (list (cons 0 "ARC")
     	 (cons 10 pt1)
     	 (cons 40 dis)
     	 (cons 50 an1)
     	 (cons 51 an2)))
 ))
 (princ))

Link to comment
Share on other sites

  • Replies 31
  • Created
  • Last Reply

Top Posters In This Topic

  • Clifford169

    9

  • David Bethel

    7

  • ReMark

    4

  • tzframpton

    4

Top Posters In This Topic

Posted Images

I like the door jambs David, it was the next thing to do to "Cadarc" its like your program started life 1990's

 

Thanks ! I looked at my current 3D door program for starters. Even as my newest, it was started 2008.

door.jpg

Link to comment
Share on other sites

Thanks guys !

 

The Revit-ish probably comes from the fact I used a R13 SHADE and then SAVEIMG. From what I've seen of Revit, the screen can look like this

 

2.5D LOL. It's kind of amazing the changes in the definition of the term extrusion in CAD has changed over the years

 

-David

 

I updated post #22 with few fixes and options

Link to comment
Share on other sites

The Revit-ish probably comes from the fact I used a R13 SHADE and then SAVEIMG. From what I've seen of Revit, the screen can look like this
I was referring to the parametric program as well as the look of the door. :)

 

-TZ

Link to comment
Share on other sites

I was referring to the parametric program as well as the look of the door. :)

 

-TZ

 

OH I don't think that I have seen a Revit parametric.

 

This could be done in DCL, but what a lot of work ! NOT today, or anytime soon ;)

Link to comment
Share on other sites

OH I don't think that I have seen a Revit parametric.
Everything in Revit is parametric. :)

 

All of the examples of your kitchen equipment remind me of Revit. You've been using AutoCAD like Revit for a long time, actually.

 

*EDIT*

Sorry to derail. Please continue normal topic.

 

-TZ

Link to comment
Share on other sites

  • 1 month later...
Here's one to try until something better comes along. Not elegant, not error trapped, but seems to work as you indicated.

 

(defun c:door (/ len ln1 pt1 pt2 pt3 pt4 pt5)

(setq pt1 (getpoint "\nSelect Hinge Point: ")
     pt2 (getpoint "\nSelect Jam Point: ")
     len (distance pt1 pt2)
     pt4 (polar pt1 (+ (angle pt1 pt2) (/ pi 2)) len)
     pt5 (polar pt1 (- (angle pt1 pt2) (/ pi 2)) len)
)

(command "._LINE" pt4 pt5 "")

(setq ln1 (entlast))

(setq pt3 (getpoint "\nPick End Of Line On Swing Side: "))

(if
 (equal pt3 pt4 0.000001)
   (command "._ARC" pt2 "_C" pt1 pt3)
   (command "._ARC" pt3 "_C" pt1 pt2)
)

(command "._PLINE" pt1 pt3 "")

(entdel ln1)

(princ)
)

 

Really happy with the code provided above - does exactly what I was hoping it would do.

 

Was just hoping that I could tweak it so that it draws into layer 'DOOR' (continuous, colour 8) that is already set-up in our template drawing. I've tried to control it with Lee Mac's layer director, but it doesn't keep the layer once the 'door' command is completed.

 

Thanks!

Link to comment
Share on other sites

Really happy with the code provided above - does exactly what I was hoping it would do.

 

Was just hoping that I could tweak it so that it draws into layer 'DOOR' (continuous, colour 8) that is already set-up in our template drawing. I've tried to control it with Lee Mac's layer director, but it doesn't keep the layer once the 'door' command is completed.

 

Thanks!

 

If you already have the layer created, you could add some code to change the current layer to "door", place the door, then change back to the original layer:

 

(defun c:door (/ len ln1 pt1 pt2 pt3 pt4 pt5)

(setvar "CMDECHO" 0)

(setq pt1 (getpoint "\nSelect Hinge Point: ")
     pt2 (getpoint "\nSelect Width Point: ")
     len (distance pt1 pt2)
     pt4 (polar pt1 (+ (angle pt1 pt2) (/ pi 2)) len)
     pt5 (polar pt1 (- (angle pt1 pt2) (/ pi 2)) len)
)

(command "._LINE" pt4 pt5 "")
(setq ln1 (entlast))
(command "._CHPROP" ln1 "" "C" "Red" "")

(setq pt3 (getpoint "\nPick End Of RED LINE On Swing Side: "))

[color=red](setq cly (getvar "CLAYER"))
(setvar "CLAYER" "door")[/color]

(if
 (equal pt3 pt4 0.000001)
   (command "._ARC" pt2 "_C" pt1 pt3)
   (command "._ARC" pt3 "_C" pt1 pt2)
)

(command "._PLINE" pt1 pt3 "")

(entdel ln1)

[color=red](setvar "CLAYER" cly)[/color]

(princ)
)

Link to comment
Share on other sites

If you already have the layer created, you could add some code to change the current layer to "door", place the door, then change back to the original layer:...

 

Works like a dream! Thanks for this.

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