Hello everybody,
First time posting on here and not an expert at coding. After some time browsing i have not seen this posted yet. I currently have a Lisp that will duplicate a layout tab. Here is the code.
(defun c:duplayout ( / CTAB LAYOUT# LAYOUTNAME )
(setvar "cmdecho" 0)
(setq ctab (getvar "ctab"))
(setq layoutname (getstring (strcat "\nLayout to duplicate <" ctab ">: ")))
(if (= layoutname "") (setq layoutname ctab))
(initget 6)
(setq layout# (getint "\nHow many copies ?<2>: "))
(if (null layout#) (setq layout# 2))
(repeat layout#
(command ".layout" "copy" layoutname "")
);repeat
(princ)
);defun
As you can see it asks which tab to duplicate then how many copies. I would like to keep those features but modify it so it will take an existing layout with a suffix (such as 201E) and then duplicate that tab the entered number of copies then auto number the tabs in sequenstial order (i.e. 202E, 203E, 204E,...)
First off, is this possible?
If so, what lines do I need to add?
Any input is much appreciated, Thanks
Welcome to the forums!
1) There is a board specifically for Autolisp discusssions. I say this just because there's a greater concentration of people over there who understand it. You will likely find SOME people here on this board that understand it (myself included) but not as many.
http://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/bd-p/130
2) I'll offer a few comments to get you started in the right direction. Will the formatting always be the same? i.e. 201E, 202E. So we take the last character off and have an integer value (201) to which we add 1? If that's the case, you'll want to look at the substr function. This will get a specified portion of a given string. You'll then add 1 to the value and copy the tab.
Don Ireland
Engineering Design Technician
1)Thank you for that input, i will direct this question over on that forum as well.
2) No, there will be a few other formats, we will have other suffix's such as 301D, 302D.... as well as a prefix such as FAB201, FAB202...
These will be in different drawings of course. If need be I guess i can write 3 different Lisp's sepecified for the different characters.
The OP has reposted this question over in the AutoLISP forum. If you'd like to reply, please do so in the other thread to avoid confusion.
Don Ireland
Engineering Design Technician