Jump to content

Lisp For Drawing Branch Duct


viviancarvalho

Recommended Posts

To all of the HVAC guys on Cadtutor

 

Does anyone has a lisp to draw a branch duct.

 

 

Thanks in advance

Vivian

branch ductsl.jpg

Link to comment
Share on other sites

Try this out

(defun C:BDUCT (/ ang1 ang2 ent1 ent2 ent3 ep1 ep3 ipt1 ipt2 ipt21
   mp1 mp3 obj1 obj2 obj3 pt1 pt2 pt3 sp1 sp3)
(setq ent1 (entsel "\nSelect first line >>")
     ent2 (entsel "\nSelect second line >>")
     ent3 (entsel "\nSelect third line >>")
     obj1 (vlax-ename->vla-object (car ent1))
     obj2 (vlax-ename->vla-object (car ent2))
     obj3 (vlax-ename->vla-object (car ent3))
     )
(setq sp1  (vlax-curve-getstartpoint obj1)
     ep1  (vlax-curve-getendpoint obj1)
     mp1  (mapcar (function (lambda (a b) (/ (+ a b) 2))) sp1 ep1)
     sp3  (vlax-curve-getstartpoint obj3)
     ep3  (vlax-curve-getendpoint obj3)
     mp3  (mapcar (function (lambda (a b) (/ (+ a b) 2))) sp3 ep3)
     ipt1 (vlax-invoke obj1 'intersectwith obj3 0)
     ipt2 (vlax-invoke obj2 'intersectwith obj3 0)
     ang1 (angle ipt1 mp1)
     ang2 (angle ipt2 ipt1)
     pt1  (polar ipt1 ang1 100)
     pt2  (polar ipt2 ang1 100)
     pt3  (polar ipt1 ang2 100)
     )
    (command "_.break" ent1 "f" "_non" pt1 "_non" ipt1)
    (command "line" "_non" pt1 "_non" pt2 "")
    (command "line" "_non" pt1 "_non" pt3 "")
(princ)
)

 

~'J'~

howtodo.jpg

Link to comment
Share on other sites

Thanks Fixo

It works very well.

 

 

doesn't work for me...

using vanilla acad2008

what are your settings, units, scale, etc.

the "fillet" goes way off and too large

thx

s

Link to comment
Share on other sites

doesn't work for me...

using vanilla acad2008

what are your settings, units, scale, etc.

the "fillet" goes way off and too large

thx

s

 

Steve

Sorry for the late reply.

I m using AutoCad 2010. with metric (mm) units

It works very well for me but does not works with my colleague who is using 2008.

Are you also into HVAC ??

Link to comment
Share on other sites

Steve

Sorry for the late reply.

I m using AutoCad 2010. with metric (mm) units

It works very well for me but does not works with my colleague who is using 2008.

Are you also into HVAC ??

 

I'm not into HVAC, I thought if I could understand and get it to work, I'd pass it onto some of my lisp challenged HVAC colleagues a few desks over. I'm using ac2008, I guess that is why it "tilts".

regards, S

Link to comment
Share on other sites

I'm not into HVAC, I thought if I could understand and get it to work, I'd pass it onto some of my lisp challenged HVAC colleagues a few desks over. I'm using ac2008, I guess that is why it "tilts".

regards, S

 

I tested it on A2008 (eng) with metric only -

it's working good on my machine, FYI

 

~'J'~

Link to comment
Share on other sites

I tested it on A2008 (eng) with metric only -

it's working good on my machine, FYI

 

~'J'~

 

I agree with the above, but when using inch or feet units on the drawing, the "fillet" is HUGE !! and way out of proportion !

S

Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...
  • 2 years later...

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