Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Flex Duct Routine

18 REPLIES 18
SOLVED
Reply
Message 1 of 19
krowley
3875 Views, 18 Replies

Flex Duct Routine

Hello to all, this is my first post on here so please be kind!

 

I am no stranger to AutoCAD having been using it since 2000, I am however completely clueless when it comes to LISP routines...

 

I am currently using ACAD 2021 and I have in my possession a fairly old Flex Duct routine created in 2008 by Tim Spangler that I have attempted (and failed) to modify to my own liking. I have managed to get it to work within one particular drawing, which I have attached, but am unable to get it to work in any other.

 

I'll never work out what the problem is on my own, but I was hoping that somebody with more knowledge and patience than myself would be able to cast their eye over it to see where it's going astray.

 

Any and all input will be gratefully received.

 

K.R.

Labels (1)
18 REPLIES 18
Message 2 of 19
hak_vz
in reply to: krowley

I just skimmed through the lisp code and made some sligth changes (didn't run it in Acad). Original code is well writte, and it should work wit minore changes I've done. I hope it will work. 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 3 of 19
krowley
in reply to: hak_vz

Thanks for taking a look at it hak_vz,

 

I've just downloaded and ranit in AutoCAD and it returned the below message:

 

*** Program Error: AUTOCAD.APPLICATION: KEY NOT FOUND ***
Cannot invoke (command) from *error* without prior call to (*push-error-using-command*).
Converting (command) calls to (command-s) is recommended.

 

It did allow me to select the flex width and draw start/endpoints but that was all.

I'm not sure what the message above means exactly but hopefully it may mean something to yourself!

Message 4 of 19
hak_vz
in reply to: krowley

I'll check it later in Acad.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 5 of 19
hak_vz
in reply to: krowley

Here you have fixed code in attachment. It is written ok, but I guess it is designed to work with accompanying dwg file that has preloaded linetypes (ZIGZAG, CENTER2, HIDDEN,DOT). I have added linetype loading and fixed work with system variables. It should now work correctly with an empty dwg.

If it works, select this as final solution.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 6 of 19
krowley
in reply to: hak_vz

Perfect!

 

Thanks for your input hak_vz, much appreciated 👍

 

 

[Edit: Is it possible to edit the routine so that once created AutoCAD then groups the flex duct into a grouped item, similar to the way that it would appear if one were to group it manually?]

Message 7 of 19
hak_vz
in reply to: krowley

You're welcome!

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 8 of 19
krowley
in reply to: hak_vz

Just as an afterthought, is it possible to edit the routine so that once created AutoCAD then groups the flex duct into a grouped item, similar to the way that it would appear if one were to group it manually?

Message 9 of 19
hak_vz
in reply to: krowley


@krowley wrote:

Just as an afterthought, is it possible to edit the routine so that once created AutoCAD then groups the flex duct into a grouped item, similar to the way that it would appear if one were to group it manually?


I think it should not be a problem,  let me finish some work and I'll do it.

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 10 of 19
krowley
in reply to: hak_vz

Thanks again for your time...

 

I have noticed that if a drawing already has those linetypes loaded then it returns the below message:

 

Bad linetype name on line 757 of file C:\Users\<NAME>\AppData\Roaming\Autodesk\AutoCAD 2021\R24.0\enu\support\acadiso.lin
; error: Automation Error. Duplicate record name

 

This then disables the routine.

Message 11 of 19
hak_vz
in reply to: krowley

Here is updated code that creates flex pipes and groups them into a unanimous groups. I have also fixed error related to reupload of linetype definitions.

To turn object grouping on and off use (setvar 'pickstyle 1) or (setvar 'pickstyle 0)

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Message 12 of 19
krowley
in reply to: hak_vz

That is the Mutt's Nuts! 😎

 

Many thanks once again 👍

Message 13 of 19
Sea-Haven
in reply to: krowley

Tharwat at his website has some good duct programs as well. May be worth looking at.

Message 14 of 19
krowley
in reply to: Sea-Haven

Thanks for the tip sea.haven 👍

 

Message 15 of 19
TROYDYALL
in reply to: krowley

How does this work? whats the command to run the lisp?

Message 16 of 19
Kent1Cooper
in reply to: TROYDYALL

The command name is always what immediately follows:

(defun C:

[the C can be upper- or lower-case].  In this case:

(defun c:FLEX

Kent Cooper, AIA
Message 17 of 19
TROYDYALL
in reply to: Kent1Cooper

Thats what i thought but it didnt work.

 

Has anyone used this on autocad25?

Message 18 of 19
Kent1Cooper
in reply to: TROYDYALL


@TROYDYALL wrote:

.... it didnt work. ....


That's never enough information.  Go into detail.

Kent Cooper, AIA
Message 19 of 19
hak_vz
in reply to: krowley

@TROYDYALL My modified code works correctly in acad 2024 so it should also in new version. Give further details about your problems with it!

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report