Author Topic: AutoCAD DUCT Tool  (Read 11351 times)

0 Members and 1 Guest are viewing this topic.

KewlToyZ

  • Guest
AutoCAD DUCT Tool
« on: September 24, 2008, 06:35:36 PM »
I'm working with some older routines trying to make them into one system for drafting duct.
MEP while it has many bells and whistles consumes too many resources and training for adoption within our company.

I still need to make allowances for length entries in ft like: 12'
And finish structuring the error catch properly.

Let me know if you have a few fitting tools as well.

Attached is the tool thrown together so far.
Too long to post as code. :ugly:

GDF

  • Water Moccasin
  • Posts: 2081
Re: AutoCAD DUCT Tool
« Reply #1 on: September 25, 2008, 09:53:16 AM »
First thing I see is that you need to create the layers first and load the line types.


I'm an architect so I don't do mechanical work, however I have dabbled in it....
For ducts I use a modified version of autocad's dline.lsp routine; in a dialog box interface.

Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

jbuzbee

  • Swamp Rat
  • Posts: 851
Re: AutoCAD DUCT Tool
« Reply #2 on: September 25, 2008, 10:38:37 AM »
Sounds like a suite of dynamic blocks would be easier?
James Buzbee
Windows 8

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: AutoCAD DUCT Tool
« Reply #3 on: September 25, 2008, 10:43:39 AM »
I just got a bunch of error messages.   :|
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

KewlToyZ

  • Guest
Re: AutoCAD DUCT Tool
« Reply #4 on: September 25, 2008, 11:40:55 AM »
Yeah I have to run a repair routine for it to run on a drawing at times.
Trying to nail down the exact variables causing the measurements to error.
The repair.lsp has a ton of variable settings I use in house for our files to keep standard environments for everyone. There are many other ways to do it, but this is how I've been handling it.

The qduct.lsp does automatically load the layers and our linetypes so that may be the first error your getting, not having the lin file. That is how the LRM routine works. Give me a minute, I may have other files referenced by it. Have to read through it again and try to nail down the exact variables so I don't need the repair.
« Last Edit: September 25, 2008, 12:12:26 PM by KewlToyZ »

KewlToyZ

  • Guest
Re: AutoCAD DUCT Tool
« Reply #5 on: September 25, 2008, 11:59:32 AM »
Here is the package of tools I use with it, lintype files, a repair routine to set the drawing variables, the reactor for the cannoscale tool, the scalelistedit updates for SetScale.lsp & dvb.

KewlToyZ

  • Guest
Re: AutoCAD DUCT Tool
« Reply #6 on: September 25, 2008, 11:59:59 AM »
Ooops forgot to attach

KewlToyZ

  • Guest
Re: AutoCAD DUCT Tool
« Reply #7 on: September 25, 2008, 12:41:28 PM »
One of the things killing me is with the while loop making sure the selected EndCapPt is cleared from the last routine then set from the next selection. I thought I had it fixed yesterday, ran it a dozen times after tweaking a few things beleiving I had it fixed, then I shut down, start back up and it doesnt work again.

But the Radius and rAngle keep dying again today, worked yesterday when I shut down, now it won't read and still gets ambiguous responses for the selection letters between initget & getkword. Everytime I fixed the Elle & eanGle the Radius & rAngle quit working and vice versa. Really not sure why.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: AutoCAD DUCT Tool
« Reply #8 on: September 25, 2008, 03:29:01 PM »
I assume you have looked at this thread.
http://www.theswamp.org/index.php?topic=13556.0
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

KewlToyZ

  • Guest
Re: AutoCAD DUCT Tool
« Reply #9 on: September 25, 2008, 03:42:50 PM »
Interesting, but I'm not in the UK and only available to those in the UK? They all seem to be in Metric libraries?
I am playing around with your FLEX_DUCT_17.lsp file though. Awesome tool CAB !!
I wish I really had as good a handle on the code as that.

Any chance you might know why my inputs accept ft every other fitting with my routine?
i.e. 20' is accepted on one fitting loop for (getpoint "Next Point:"), the next fitting (same one) it says invalid input, the next it accepts it again? It's always fitting loop after the first one, never works the first loop.
« Last Edit: September 25, 2008, 04:01:53 PM by KewlToyZ »

KewlToyZ

  • Guest
Re: AutoCAD DUCT Tool
« Reply #10 on: September 25, 2008, 03:58:50 PM »
Here is where I ended up, I stuck a spline command and a trim command into your flex routine to draw the centerlines on the fly and cleanup the collar ends with trim/extend. I do need to take the LRM routine out of flex since its already part of the while loop. I may break the routines out into their own routines completely like flex. Would make editing a heck of a lot easier.  :ugly:
Perhaps a dcl dialog with radio buttons would make it a better tool than the command line keying..

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: AutoCAD DUCT Tool
« Reply #11 on: September 25, 2008, 04:21:18 PM »
What's going on with this?
Code: [Select]
;(defun endCapCheck()
;(progn
(while

You have the defun commented out so it lookl like this part of the code runs when loaded.

If the units are not set to 3 or 4 then the foot mark may be rejected in the getpoint.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

KewlToyZ

  • Guest
Re: AutoCAD DUCT Tool
« Reply #12 on: September 25, 2008, 05:10:40 PM »
I had trouble with it recognizing the rest of the defun commands or going back to the endcap check when I created it as a separate funtion from the rest of the command loop. Right now it detects the object or a blank space clicked on to get its width for a few of the commands. I'm trying to find a happy medium to break it up into smaller groups of Duct or Fittings. I initialize units to set it to 4 in every loop as far as I can tell, but seems to be skipping it every other time.

(command "cmdecho" 0)
(command "-units" "4" "16" "1" "2" "0" "N")
(command "cmdecho" 1)

Might have to set the units in each command or else in the ductfittings command to be a better suited control.
Now that you mention it, the endcap check is skipping over the units settings.... it jumps straight to ductfittings the first trip through..... doh!

I think this fixed it moving the units into ductfitting & continueduct
Code: [Select]
;======================================================================================================= ductfittings
(defun ductfittings ()
(command "osmode" 767)
(command "polarang" 15)
(command "autosnap" 29)

(command "cmdecho" 0)
(command "-units" "4" "16" "1" "2" "0" "N")
(command "cmdecho" 1)

(initget "Duct,D Radius,R rAngle,A Elle,E eanGle,G Htransition,H Ctransition,C Otransition,O rtakeoFf,F otaKeoff,K fleX,X" )
(setq fitting (getkword "Duct Radius rAngle Elle eanGle Htransition Ctransition Otransition rtakeoFf otaKeoff fleX:  \n< D/R/A/E/G/H/T/O/F/K/X > D = continue Duct:"))
(cond
((= fitting "Duct") (continueduct))
((= fitting "Radius") (radius))
((= fitting "rAngle") (radiusAngle))
((= fitting "Elle") (elle))
((= fitting "eanGle") (elleAngle))
((= fitting "Htransition") (htransition))
((= fitting "cTransition") (ctransition))
((= fitting "Otransition") (otransition))
((= fitting "rtakeoFf") (rtakeoff))
((= fitting "otaKeoff") (otaKeoff))
((= fitting "fleX") (c:flex))
)

;(command "polarang" userpol)
;(command "clayer" userlayer); -----------------------Return User Layer Settings
(*error* "") ; restore variables
(princ "\n Osnaps returned. ductfittings..") ; -----------------------Return User Osmode Settings
)

Now I need to break this up into some logical fitting type groups for a shorter and easier approach.
The Elle & elanGle are essentially identical as well as Radius & rAngle with the exception of the standard ones being 90 degree fittings and the others allow custom angles. Could be better to set 90 as the default if the inclAngle is nil....

So that would reduce 4 commands to 2 commands..
I think I will start it off with Duct / Elbows / Transitions / Fittings for the choices to make the choices more concise.
« Last Edit: September 25, 2008, 05:44:55 PM by KewlToyZ »

KewlToyZ

  • Guest
Re: AutoCAD DUCT Tool
« Reply #13 on: September 26, 2008, 03:57:29 PM »
Hmmm, I'm running into a whole new issue....
How does one structure a series of user condition input queires?

I never tried to drill down through them to make the lists shorter?

I went a roundabout way but it seems to loop back to the original ductfittings line everytime I make a selection:
Code: [Select]
;======================================================================================================= ductfittings
(defun ductfittings ()
(command "osmode" 767)
(command "polarang" 15)
(command "autosnap" 29)
(command "snapang" 0)
(command "cmdecho" 0)
(command "-units" "4" "16" "1" "2" "0" "N")
(command "cmdecho" 1)

(initget "Duct,D Elbow,E Transition,T tAkeoff,A fleX,X" )
(setq fitting (getkword "Duct \ Elbows \ Transitions \ takeOffs \ Flexduct :  \n< D/E/T/O/F > D = continue Duct:"))
(cond
((= fitting "Duct") (continueduct))
((= fitting "Elbows") (elbows))
((= fitting "Transitions") (transitions))
((= fitting "takeOffs") (takeoffs))
((= fitting "Flexduct") (c:flex))
)

;(command "polarang" userpol)
;(command "clayer" userlayer); -----------------------Return User Layer Settings
(*error* "") ; restore variables
(princ "\n Osnaps returned. ductfittings..") ; -----------------------Return User Osmode Settings
)
;======================================================================================================= End of ductfittings

;======================================================================================================= elbows
(defun elbows ()
(command "osmode" 767)
(command "polarang" 15)
(command "autosnap" 29)
(command "snapang" 0)
(command "cmdecho" 0)
(command "-units" "4" "16" "1" "2" "0" "N")
(command "cmdecho" 1)

(initget "Radius,R radiusAngle,A eLle,L Elleangle,E " )
(setq fitting (getkword "Radius / radiusAngle / eLle / Elleangle :  \n< R/A/L/E > L = Elle :"))
(cond
((= fitting "Radius") (radius))
((= fitting "radiusAngle") (radiusAngle))
((= fitting "eLle") (elle))
((= fitting "Elleangle") (elleAngle))
) ; End cond


(*error* "") ; restore variables
(princ "\n Osnaps returned. Elbows..") ; -----------------------Return User Osmode Settings
); End of Elbows
;======================================================================================================= End of Elbows

;======================================================================================================= transitions
(defun transitions ()
(command "osmode" 767)
(command "polarang" 15)
(command "autosnap" 29)
(command "snapang" 0)
(command "cmdecho" 0)
(command "-units" "4" "16" "1" "2" "0" "N")
(command "cmdecho" 1)

(initget " Htransition,H Ctransition,C Otransition,O " )
(setq fitting (getkword "Htransition / Ctransition / Otransition :  \n< H/C/O > C = concentric transition :"))
(cond
((= fitting "Htransition") (htransition))
((= fitting "Ctransition") (ctransition))
((= fitting "Otransition") (otransition))
)


(*error* "") ; restore variables
(princ "\n Osnaps returned. transitions..") ; -----------------------Return User Osmode Settings
)
;======================================================================================================= End of transitions

;======================================================================================================= takeoffs
(defun takeoffs ()
(command "osmode" 767)
(command "polarang" 15)
(command "autosnap" 29)
(command "snapang" 0)
(command "cmdecho" 0)
(command "-units" "4" "16" "1" "2" "0" "N")
(command "cmdecho" 1)

(initget "Rtakeoff,R Otakeoff,O " )
(setq fitting (getkword "Rtakeoff / Otakeoff :  \n< R/O > O = rectangular takeoff:"))
(cond
((= fitting "Rtakeoff") (rtakeoff))
((= fitting "OtaKeoff") (otaKeoff))
)


(*error* "") ; restore variables
(princ "\n Osnaps returned. takeoffs..") ; -----------------------Return User Osmode Settings
)
;======================================================================================================= End of takeoffs




Andrea

  • Water Moccasin
  • Posts: 2372
Re: AutoCAD DUCT Tool
« Reply #14 on: October 01, 2008, 09:18:22 AM »
Comming Soon....

;-)

Keep smile...