Purge and Audit lisp

Purge and Audit lisp

Anonymous
Not applicable
16,017 Views
30 Replies
Message 1 of 31

Purge and Audit lisp

Anonymous
Not applicable

Probably a simple lisp request to all of you versed in the language...

 

I'm looking for an easy lisp which can do the following equivalent keystrokes of commands in one call.

 

-PU <ENTER>

R <ENTER>

<*> <ENTER>

<N> <ENTER>

 

-PU <ENTER>

A <ENTER>

<*> <ENTER>

<N> <ENTER>

 

AUDIT <ENTER>

<Y> <ENTER>

 

Essentially I have muscle memorized the following in order to purge all registered applications without verifying names, purge all items without verifying names, and audit the drawing and fix all errors detected.

 

If I could group this into one command it would save on the carpal tunnel and I can easily instill this habit into people to use it as it is very beneficial when it comes to file size and preventing file corruptions from added errors.  If it could group all the result reports of the purges and audits together at the end of the lisp instead of at their sequence points too that would be beneficial but not necessary.

 

Thanks,

Warren

0 Likes
Accepted solutions (2)
16,018 Views
30 Replies
Replies (30)
Message 2 of 31

lando7189
Advocate
Advocate
Accepted solution

This is one of the most basic things you can do with LISP... just enter commands (and easy to write!).

 

Change 'FOO' to whatever you want to type in:

(defun C:FOO
nil   (command "-PU" "R" "*" "N" "-PU" "A" "*" "N" "AUDIT" "Y")   (princ) ;clean exit )

 

Message 3 of 31

Anonymous
Not applicable
Accepted solution

Thanks Lando,

 

I figured there was some way to write "macros" essentially with lisp where u just put in the keystrokes.

 

Only fix I had to do was type out the full command -PURGE as it doesn't recognize command autocomplete which I use.  After that it worked like a charm.

 

Thanks,

Warren

Message 4 of 31

lando7189
Advocate
Advocate

Good to hear. 

 

Remember to mark the post as solved if the solution works.  Cheers!  - Lanny

Message 5 of 31

piyush.parihar24
Advocate
Advocate
I have LISP for:
1. Open Files from given folder
2. Purge All
3. Save in same folder where it was opened from.
4. Close
All these function are done in one folder in desired location which is awesome lisp.
I just want to add few more commands into LISP and the order of Command should be:
1. Open Files from given folder.
2. Go to Model.
3. Turn off Grid.
4. Zoom Extend.
5. Come back to Layout.
6. Purge all.
7. Save in same folder where it was opened from.
8. Close.
Can Anyone help me in this? I am short in learning LISP programming. Please help me.
0 Likes
Message 6 of 31

piyush.parihar24
Advocate
Advocate
I have LISP for:
1. Open Files from given folder
2. Purge All
3. Save in same folder where it was opened from.
4. Close
All these function are done in one folder in desired location which is awesome lisp.
I just want to add few more commands into LISP and the order of Command should be:
1. Open Files from given folder.
2. Go to Model.
3. Turn off Grid.
4. Zoom Extend.
5. Come back to Layout.
6. Purge all.
7. Save in same folder where it was opened from.
8. Close.
Can Anyone help me in this? I am short in learning LISP programming. Please help me.
0 Likes
Message 7 of 31

carartur16
Explorer
Explorer

(Defun C:PAL (/ tilemd0 version)
(Setvar "CMDECHO" 0) ;Apaga Eco
(Setq version (Atof (Getvar "ACADVER"))) ;Número versión de AutoCAD.
(Setq tilemd0 (Getvar "TILEMODE")) ;Variable que define espacio de trabajo
(If (/= tilemd0 1)
(Setvar "TILEMODE" 1) ;Espacio de modelado
)
(Setvar "GRIDMODE" 0) ;Apaga malla
(Command "_.ZOOM" "_E") ;Enfoca todo lo dibujado
(If (/= tilemd0 1)
(Setvar "TILEMODE" tilemd0) ;Regresa a Espacio de presentación, si antes estaba ahí.
)
(Command "_.AUDIT" "_Y") ;Audita, se recomienda antes del Purge ya que crea Capas o Bloques basura al reparar.
(Command "_.-PURGE" "_R" "" "_N") ;Limpia Registros perdidos (Regapps).
(If (>= version 20.0)
(Command "_.-PURGE" "_O") ;Limpia entidades huérfanas.
)
(Command "_.-PURGE" "_A" "" "_N") ;Limpia todo
(Command "_.QSAVE") ;Salva
(Prompt "\n Listo !")
(Prin1)
) ;Fin de C:PAL

0 Likes
Message 8 of 31

piyush.parihar24
Advocate
Advocate

Not Working It is showing Syntex error ref attached pic to get error.

Firstly, it should ask me which folder is it need to be purged then all the drawings inside the folder must go through all the process I have mentioned below in trail.

Secondly, it should save the drawing in same folder from where it has started all.

 

Thank You.

 

0 Likes
Message 9 of 31

carartur16
Explorer
Explorer

Best regard

 

Please check the copied text, because, I copied the text in the NOTEPAD, I saved it as .TXT and I changed the extension to .LSP and loaded it in AutoCAD with the APPLOAD command and it worked fine.

 

The second thing is that I do not know how to make all the files in a folder and clean them. You mentioned that you have a file that does that and my intention is to give you ideas of how you could complete it. If you have the source code and you consider it prudent you can send me the file so I can try to complete it.

 

Anyway, I hope I have given ideas and ways of programming that have been useful for me.

 

Thank you


@piyush.parihar24 wrote:

Not Working It is showing Syntex error ref attached pic to get error.

Firstly, it should ask me which folder is it need to be purged then all the drawings inside the folder must go through all the process I have mentioned below in trail.

Secondly, it should save the drawing in same folder from where it has started all.

 

Thank You.

 


 

Message 10 of 31

piyush.parihar24
Advocate
Advocate

Hello,

Please find the attachment for your ref.  you need to add certain part of process in it so that my problem is solved and you get kudos as solution accepted. Just run the attached file you will get to know my half point which I need and what's need to be added among my list.

0 Likes
Message 11 of 31

carartur16
Explorer
Explorer

Best Regard

 

Thanks for the file sent.


Based on an application called ZALL, which is also very interesting:

 

http://www.caduser.ru/forum/index.php?PAGE_NAME=read&FID=23&TID=38757

 

I made a mix of both programs, which may be the solution it requires, God willing.

Message 12 of 31

piyush.parihar24
Advocate
Advocate
Great Work..!!!
Appreciated all your efforts.. Only problem remains is:
4. Zoom Extend.
5. Come back to Layout.
6. Purge all.
7. Save in same folder where it was opened from.
8. Close.
Among the above 5 steps, 4th and 5th is not followed other looks awesome... Can you please help me in that it will be great help if these two points are also executed in same file..
0 Likes
Message 13 of 31

piyush.parihar24
Advocate
Advocate
Sorry for inconvenience but the link (http://www.caduser.ru/forum/index.php?PAGE_NAME=read&FID=23&TID=38757) you provided me is also not working (blocked) here i guess, can you provide some different link with same application?
0 Likes
Message 14 of 31

carartur16
Explorer
Explorer

Best Regard

 

I adjusted the order of the functions according to their requirements, I also placed twice the order to purge-all to ensure this action in the files and added a small file counter, which I hope can be seen during the process.

 

Thanks for the LIKE, I hope you find this version better.

 

Annex the ZALL program, since the link has a certain fault, from a computer I enter without inconvenience, but from another one it remains thinking.

Message 15 of 31

piyush.parihar24
Advocate
Advocate
Dear carartur16 ,

Thank you So much for your help. You helped like as if this was your personal Issue. This kindness is appreciated. I would like to be in contact with you forever, I truly hope you won't mind that. The only issue in updated one is it is not going to layout again from model space before saving final, drawing is saved in model only and not in layout, i think that is not possible via command to bring drawing in layout from model before saving it... Hence you were not able to do otherwise all looks good.
Apart from that, looking forward to work with you more. Both the files provided by you has some uniqueness, which will be very useful as reference for me in future. I hope i can help someone as you helped me here with same attitude. Cheers to you and to your Sincerity and calmness.

Thank You.
Regards,
Piyush Parihar
0 Likes
Message 16 of 31

Anonymous
Not applicable

Hi Sir,

 

I need help to audit one folder and it has to create a adl/csv of the output for each file after audit

 

For single file i can do it by setting auditctl to 1

 

Kindly help

 

Thank You

0 Likes
Message 17 of 31

carloschantre123
Explorer
Explorer

Regards

 

If you already have AUDITCTL set to value 1, then you can load and execute the file PurgeAuditFiles, it can be loaded with the APPLOAD command, which is in message 14 of this page.

 

I think the ADT files will be generated in the selected folder.

 

 

I'm looking for some concern

0 Likes
Message 18 of 31

Anonymous
Not applicable

yes i have loaded your lisp code, But when I run PurgeAuditFiles it is loading for sometime, but it is not creating any adl files

 

kindly help...

0 Likes
Message 19 of 31

Anonymous
Not applicable

I am getting below error in executing the code, I am using AutoCAD 2019

 

Untitled.png

0 Likes
Message 20 of 31

piyush.parihar24
Advocate
Advocate

Hi,
Please find below attached file for your question. Hope this helps. Please hit accept as solution if it works

0 Likes