ReMark Posted January 8, 2009 Share Posted January 8, 2009 All very good points Dave. Makes a lot of sense. Quote Link to comment Share on other sites More sharing options...
MiGo Posted March 26, 2009 Share Posted March 26, 2009 Can you write an IF statement into a script? I am currently working on a big script to dumb down all drawings required for a client. The final drawings will all be model space drawings only, will contain no yellow, and will have all xrefs bound exploded and trimmed. So my script will be run Using ScriptPro so I can just run it on all drawings selected. As of now script pro opens drawing, my scrip will then save the drawing as the same name but with "acad-" on the front, take and explode all dimensions (i know it's horrible but it's required), burst all blocks in modelspace with atributes, then expload all blocks (repeats 2x for any blocks of blocks of blocks...), then will copy all in model, then will go into first viewport, draws outline of viewport extents, uses that to trim everything outside that viewing area, scales the line up a smidge to erase any text touching the line that may exceed the limits of the viewport, erases that line, then chspace all items withing that viewport, erases all that's left in model, pastes original model space objects, and repeats for up to 10 viewports (I create a dummy viewport so after the normal layout viewport max has been met all of the chspace goes to a dummy one that is deleted later), then it will copy all in paper from 0,0,0, and paste it into model, purge and udit save and script pro will exit drawing at end of script. So what i'm hoping to do is at the end of each section if the max # of viewports has been met it will finish the drawing conversion to model, and exit. To eleminate having to do the process over and over past the initial # of viewports. The IF line that I have in there now (that doesn't work) is: (if (eq (length (vports)) "1") ...do something here ) I get a syntax error. Any help would be great. Quote Link to comment Share on other sites More sharing options...
ReMark Posted March 26, 2009 Share Posted March 26, 2009 MiGo: I see your question has gone unanswered. I suggest you post it as a new thread and see if that attracts any replies. Quote Link to comment Share on other sites More sharing options...
dbroada Posted March 26, 2009 Share Posted March 26, 2009 in general you can only do in a script what you can do at the keyboard, therefore no branches etc.. It is possible to call a LISP statement but just using what you have will give you a missing parenthesis error. Try it with the whole statement on a single line and see if it works then. Quote Link to comment Share on other sites More sharing options...
MiGo Posted April 8, 2009 Share Posted April 8, 2009 I have sucessfully put my If statement into my script as well as many others, and it has grown guite a bit. I wanted to make it to automate a lengthy process on all of a partictular clients drawings. so far the script saves a copy of the original explodes dims in paperspace, explodes all dims in model, bursts all blocks in model (multiple times), trimms and deletes everything outside each viewport, converts thepaperspace contents to model at the original paper size, then removes all yellow from everything. The only snag that I ran into was the fact of putting instances of Extrim, Burst, and other Lisps that require a selection and points inside the if, so for now I just run the routine up to 20 viewports and it performs finishing commands upon completing the last viewport for the layout tab. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.