Hello everybody,
I posted this yesterday in another forum and was advised to bring it here. 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
I asked a question in the other thread and the OP replied. I'm copying my question and his reply here to make this process clearer.
My question:
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.
His Reply:
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.
Don Ireland
Engineering Design Technician
Hi,
I've tried to utilise this lisp, but can't get it to copy more than once at a time. It's not asking me
(setq layout# (getint "\nHow many copies ?<2>: "))
I type .layout to run it, choose copy, choose which layout to copy & it will only give me 1 copy.
I need 100! 😄 Don't ask, it's what the client wants.
Any sugestions please?
Sorry about this duplication. I was getting an error message, but noted a message down the bottom saying my reply had posted.