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.
Solved! Go to Solution.
Solved by hak_vz. Go to Solution.
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
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!
I'll check it later in Acad.
Miljenko Hatlak
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
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?]
You're welcome!
Miljenko Hatlak
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?
@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
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.
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
The command name is always what immediately follows:
(defun C:
[the C can be upper- or lower-case]. In this case:
(defun c:FLEX
Thats what i thought but it didnt work.
Has anyone used this on autocad25?
@TROYDYALL wrote:
.... it didnt work. ....
That's never enough information. Go into detail.
@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
Can't find what you're looking for? Ask the community or share your knowledge.