Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Batch specific lisp problem

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
jahbgd
406 Views, 3 Replies

Batch specific lisp problem

Hi everyone,

 

I am having an issue with scripts and batch functions.

 

I have wrote simple script :

 

PSLTSCALE

0

PURGEALL

ENTER

CLOSE

ENTER

 

PURGE ALL - Being the lisp that i have been using for cleaning the file. I loaded it in Scriptpro and it has a problem to preform on multile files. It does the task on one file and the rest goes bad. 

 

(defun c:purgeall ()
(dictremove (namedobjdict) "ACAD_DGNLINESTYLECOMP")
(command "-purge" "all" "" "n")
(command "-purge" "r" "" "n")
(command "qsave")
)

 

Second thing is that I would like to do a XRCOL.lsp - (return selected xref to original color and layer state) in a batch, but the problem is that it ask to manually select xref... I is possible to insert a line or to and tell hin to selects all layers, or all layers with A_T4 in file name....? 

 

; XRCOL.LSP
; Return selected xref to original color
(defun c:xrcol (/ ent xdwgname choose)
(while (= ent nil)
(setq ent (entsel "\nSelect Xref"))
(if (= (cdr (assoc 0 (entget (car ent)))) "INSERT")
(progn
(setq xdwgname (cdr (assoc 2 (entget (car ent)))))
(setvar "visretain" 0)
(command "-xref" "r" xdwgname)
(princ (strcat "\nFile " xdwgname " reloaded"))
(setvar "visretain" 1)
)
(progn
(princ "\nSelect entity is not an XREF")
(setq ent nil)
)
)
)
(princ)
)

 

Help would ne much appreciated.

Ciao

Jan

 

3 REPLIES 3
Message 2 of 4
Moshe-A
in reply to: jahbgd

Jan Hi,

 

firstly in AutoCAD (old) script terms format ENTER should be an empty line but i do not see that you need to put enter

so the correction to your script code is as follows:-

 

1> PSLTSCALE 0

2> PURGEALL

3> CLOSE

 

on line '1>' there is one character space, in script terms format each space is like pressing spacebar on the KB

just out of curiosity why set psltscale to 0? it better be 1 always.

 

 

secondly you could reload all xrefs like that:-

 

(defun c:XRR ()

 (setvar "visretain" 0)

 

 (command ".xref" "reload" "*") ; "*" means all xrefs

 

 (setvar "visretain" 1)

 (princ)

)

 

 

cheers

Moshe

 

 

 

 

 

 

 

 

 

 

Message 3 of 4
jahbgd
in reply to: Moshe-A

Moshe,

 

Thanks a lot. I have made modifications and it all works as a charm. Also thanks for XRR, it does what it should. 

 

I am slowly getting in logic of scripting and lisps and I cant wait to start producing it. It seems like great deal of tasks we are doing in office can be automatized 🙂 I just hope that we dont become redundant 🙂  

 

Cheers

Jan

Message 4 of 4
Moshe-A
in reply to: jahbgd

Jan,

 

Well come to customization world in AutoCAD   Smiley Very Happy

 

cheers

moshe

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost