TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: bjisa on June 21, 2007, 05:18:36 PM

Title: Program Continuation
Post by: bjisa on June 21, 2007, 05:18:36 PM
Is there a command that will allow a lisp program to continue running (pick up where it leaves off) after a new template is opened?
Title: Re: Program Continuation
Post by: T.Willey on June 21, 2007, 05:33:35 PM
The simple answer No.

But it might be able to be done.  What did you have in mind (specifics)?

Welcome to theSwamp.  :-)
Title: Re: Program Continuation
Post by: bjisa on June 21, 2007, 05:37:00 PM
I'm trying to write a program which will setup my drawing for me but I need to take old information from a different drawing, copy it, open a new template and paste the information onto the model space. I need the new template because it has my standard border and title block on the layout. I'm trying to make it easier to do with all one command.
Title: Re: Program Continuation
Post by: T.Willey on June 21, 2007, 07:05:59 PM
The problem with trying to do this in lisp is you are going into more than one drawing.  Lisp doesn't like that.  One way you might be able to do it is

Change SDI to 1
Change LispInit 1
Issue the copyclip command
Issue the new command, with it defaulting to your template (have to make sure you code for the prompts)
Then make sure you are in model space
Issue pasteclip
Change SDI back to

Does that sound like what you want to do?
Title: Re: Program Continuation
Post by: CAB on June 21, 2007, 09:52:11 PM
I'm trying to write a program which will setup my drawing for me but I need to take old information from a different drawing, copy it, open a new template and paste the information onto the model space. I need the new template because it has my standard border and title block on the layout. I'm trying to make it easier to do with all one command.
This process may not require the template drawing to be opened.
You may want to INSERT the template as a block & gather information from that block, then delete & purge the block.
You may want to open the template using ObjectDBX & gather info that way.
What exactly do you need from the template? Please be specific.


PS  Welcome to TheSwamp.
Title: Re: Program Continuation
Post by: bjisa on June 22, 2007, 12:27:10 PM
The "sdi" and "lispinit" commands work great with only one drawing open but there's a problem when multiple drawings are open. I can't have multiple drawings open at the same time if I'm switching "sdi" to 1 from 0 so the program will error. Is there anyway to get around this?
Title: Re: Program Continuation
Post by: T.Willey on June 22, 2007, 12:44:12 PM
The "sdi" and "lispinit" commands work great with only one drawing open but there's a problem when multiple drawings are open. I can't have multiple drawings open at the same time if I'm switching "sdi" to 1 from 0 so the program will error. Is there anyway to get around this?
Only if you code it up the way CAB says to, or have it check to see if there are more than one drawing open, and if so tell the user to close all but one.
Title: Re: Program Continuation
Post by: ronjonp on June 22, 2007, 01:21:03 PM
Can't you just throw your routine into a script?
Title: Re: Program Continuation
Post by: CAB on June 22, 2007, 01:40:20 PM
I feel like we are all shooting at shadows until bjisa shares with us the data he need from the template & what he is doing with it. :?
Title: Re: Program Continuation
Post by: bjisa on June 22, 2007, 02:12:48 PM
My template is just a border and block title block that is on the layout portion and has all my layers setup inside the model. I'm trying to get the routine to copy an old drawing which is just drawn on the model space and isn't a template and insert or paste the information into my template's model space so I can make the process alot more quick instead of having to manually open the old drawing copy the information and then open my template and paste it into the model.
Title: Re: Program Continuation
Post by: T.Willey on June 22, 2007, 02:19:06 PM
Can you just use the new command, and use your template as the template to create it with?  Then just insert the old drawing, as insert will only bring in what is in model space.
Title: Re: Program Continuation
Post by: bjisa on June 22, 2007, 02:30:00 PM
Yes that could work but do you use the new command to open a .dwt template file?
Title: Re: Program Continuation
Post by: T.Willey on June 22, 2007, 02:41:01 PM
Yes that could work but do you use the new command to open a .dwt template file?
I think so.  I don't use templates, but I just did a little test, and it created a new drawing with the title block in paper space.
Title: Re: Program Continuation
Post by: bjisa on June 22, 2007, 02:46:56 PM
I can't get the new command to open a .dwt file because my company has changed the new command to open up their owned designed menu. I'll just keep working with it and see what happens. Thanks
Title: Re: Program Continuation
Post by: Keith™ on June 22, 2007, 02:48:46 PM
"_.new" should open the built in version
Title: Re: Program Continuation
Post by: ronjonp on June 22, 2007, 03:04:54 PM
How about creating a button with something like this:

Quote
^C^C(setvar 'tilemode 0);(command "_.-INSERT" "yourdrawingnamewithpathusingdoublebackslashes" '(0 0 0) "1" "1" "0");