Jump to content

Recommended Posts

Posted

Hi All,

 

I hope everyone is fine,

 

i am looking for a LISP code that will open the purge command before closing and turn off SNAP and GRID before saving whenever a drawing is closed in autoCAD.

 

Many Thanks

 

Simon

  • Replies 20
  • Created
  • Last Reply

Top Posters In This Topic

  • ReMark

    7

  • SimonC

    7

  • BlackBox

    4

  • dbroada

    3

Popular Days

Top Posters In This Topic

Posted

And what purge option(s) were you thinking of using?

 

Are you going to run an Audit too?

 

How about a zoom > extents before saving?

 

I didn't think anyone was using Snap and Grid anymore.

Posted
I didn't think anyone was using Snap and Grid anymore.
that's what mechanoids keep saying. Try drawing electrical diagrams with them and you will see how easy it is with them on.
Posted

I draw P&IDs all day long without using snap and grid. It's a schematic. LoL

Posted

Hi ReMark, Dbroada,

 

Thank You for the prompt replies, and yes we still use snap and grid we find it easier for our electrical layout drawings :)

 

In answer to your questions,

 

And what purge option(s) were you thinking of using? Purge All

 

Are you going to run an Audit too? Not Something we use

How about a zoom > extents before saving? Didnt think of that, good idea would be great

 

Hope that helps,

 

Simon

Posted

I'd recommend doing a Purge of Regapps first followed by a Purge > All. An Audit checks for errors and will correct any it finds if you choose that option.

Posted

Wow ..... Bells and whistles .... i am totally under your guidance, from my origianl question i have now been offered more, that is great ..... sad but true i never knew about RegApps till 5 minutes ago and i have just read up about them, so BIG thank you for the sugestion, as for the audit command i am still uncertain so think for now may leave that out... i will look into the exact function and decide later .... if that is ok

 

But otherwise all excluding Audit would be Awesome...

 

Thanks

 

Simon

Posted

Have you given any consideration to handling all this with a script?

Posted

Script? ????

 

Dont know what Script is, Sorry, Newbe lol ...

Posted

A script is just a text file that instructs AutoCAD on what the user wants done with a drawing (or a whole folder of drawings) just as if the CAD tech was inputting the commands at the command line. Another option might be to use the Action Recorder feature which is basically just a macro. I use this method just prior to finishing up with a drawing. It does a purge of regapps first, followed by a purge > all, then an audit, a zoom > extents then finally a save.

Posted

Sorry for the long delay..... Lunchtime.....

 

I have just been reviewing Script and it would appear this may do the job, so when i have finishe withe the drawing i enter scr in the command line and locate the appropriate script. Job Done ...

 

How and where do i create the script is my next learning curve, is it like using macro recorder in Excel?

Posted

Is there no Action Recorder in Electrical 2010?

 

Scripts are created using ASCII text editors and can be saved to any location the user prefers.

Posted

Ahhhhh action recorder, then use command promt -purge, regapp, *, N..... -purge, All, *, N..... grid, off..... snap, off.... z, e.... ctrl s close action recorder?

 

I think ythe above is what i need to do?

Posted

there is an action recorder in 2010 but in my opinion its really not worth the effort. The biggest drawback is that it is impossible to modify! :facepalm: Make a mistake near the end and you have to re-record the whole thing.

 

I use notepad to create a text file with no "special" characters so loved by most word processors. Once you have creted and saved your script you can create a palette button and place code similar to this on it. Then a click of the button and your code will run.

 

'_script;"C:/ACAD_Settings/plot";

 

Your script should contain all the commands you need as though you typed them on the keyboard. If you normally use menus press F2 to check what the real name should be. Don't use command shortcuts, use the complete command name.

Posted
Ahhhhh action recorder, then use command promt -purge, regapp, *, N..... -purge, All, *, N..... grid, off..... snap, off.... z, e.... ctrl s close action recorder?

 

I think ythe above is what i need to do?

 

try

-purge
regapp
*
N

-purge
All
*
N

grid
off
snap
off
zoom
e
save

Posted

Thank You so much for the input and advice, i see what you meant about the mistake near the end, while you were writing back to me i was experimenting, i managed to get the recorder right after my third atempt :notworthy:

 

I have also created a button in a pre existeng toolbar i created some time back so i now hav it on my workspace...

 

Thank You Both for the advice and knowledge

 

simon

Posted

This could all be done really efficiently using the .NET API... Not sure if that's an option for everyone here, due to implied proficiency required.

 

I haven't published this yet, as I was hoping to incorporate this into my 'purge' plug-in, which uses the .NET API to purge all regapps at drawing open (so it loads and runs smoothly), and also prior to any SAVE* Command invocation.

 

The reason I chose the .NET API for this, is that it is +/-30% faster than the -PURGE Command call (which cannot be called from Visual LISP Reactor Callback), which is faster than iterating the RegisteredApplications Collection Object via Visual LISP Reactor Callback.

 

Again, not as efficient per-se, but overall done most simply by a Visual LISP Reactor (if .NET is not possible), IMO... Let me know if you need help coding it (I'm at home, job hunting today).

 

Also, if the .NET API alternative is of interest to anyone, Kean's article here should get you started... Note the Database.Purge() call (it doesn't do what you think).

 

Cheers

Posted

OK...if someone could translate the above post I'd appreciate it. Thanks! LoL

Posted
OK...if someone could translate the above post I'd appreciate it. Thanks! LoL

 

... Sorry, Mark... We are in a coding forum thread... Sometimes I forget to 'switch off' like Detective Officer Nicholas Angel. :geek:

 

 

 

:: Summary Translation ::

 

"This might not apply to everyone here, but for one who is adept at coding, this same series of tasks can be done via Visual LISP Command Reactor, or even more efficiently in .NET API particularly... Without requiring a manual call to Script, Toolbar button, menu, or even keyboard command prior to save. This would all be done as the user normally saves the Document using Event-driven code."

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...