Set system variable xclipframe to 0 (zero) in multiple drawings

Set system variable xclipframe to 0 (zero) in multiple drawings

josue777torsan
Advocate Advocate
3,106 Views
28 Replies
Message 1 of 29

Set system variable xclipframe to 0 (zero) in multiple drawings

josue777torsan
Advocate
Advocate

Is there a way to set system variable xclipframe to 0 (zero) in multiple drawings?

 

@Lee_Mac 

@Kent1Cooper 

Architect, CAD Manager in Mexico City
0 Likes
3,107 Views
28 Replies
Replies (28)
Message 2 of 29

Kent1Cooper
Consultant
Consultant

Doing things to multiple drawings is not something I find myself needing to do often enough to have a ready answer, but others have raised similar questions before.  Put "multiple drawings" in the Search window and you'll find many threads with ways to do it, some of which you should be able to adapt to that particular setting.

Kent Cooper, AIA
0 Likes
Message 3 of 29

pbejse
Mentor
Mentor

@josue777torsan wrote:

Is there a way to set system variable xclipframe to 0 (zero) in multiple drawings?

 

@Lee_Mac 

@Kent1Cooper 


 

Think the rest of us should sign up..

 

 speechless_o_2899449.jpg

... where do we register @josue777torsan ? 

 

😊

 

 

Message 4 of 29

roland.r71
Collaborator
Collaborator

@pbejse wrote:

@josue777torsan wrote:

Is there a way to set system variable xclipframe to 0 (zero) in multiple drawings?

 

@Lee_Mac 

@Kent1Cooper 


 

Think the rest of us should sign up..

 

 speechless_o_2899449.jpg

... where do we register @josue777torsan ? 

 

😊

 

 


Yes, where indeed. I actually know the answer to this one. (it's one of my expertises on this forum as it would seem 😁

 

Although I wasn't called for, might i suggest a few threads or even my own lisp-program to do all the fileselecting and running the commands or lisp needed? - or would that be out of line?

Message 5 of 29

pbejse
Mentor
Mentor

@roland.r71 wrote:

 

Although I wasn't called for, might i suggest a few threads or even my own lisp-program to do all the fileselecting and running the commands or lisp needed? - or would that be out of line?

 

If it helps the OP go on ahead @roland.r71  👍

0 Likes
Message 6 of 29

roland.r71
Collaborator
Collaborator

Alright, then lets start with the absolute basics:

My example (proof of concept) code

(defun C:MF (/ filelist file)
   ; create list with filenames
   (setq filelist
      (list "C:/Lisp/TestDWG/Drawing1.dwg"
            "C:/Lisp/TestDWG/Drawing2.dwg"
            "C:/Lisp/TestDWG/Drawing3.dwg"
      )
   )
   ; activate single document mode (required for sequential processing, using a script or lisp)
   (setvar "SDI" 1)
   ; Turn off the (re)intialisation of lisp with each drawing. Meaning: lisp functions will stay loaded.
   (setvar "LISPINIT" 0)
   ; for each file in the list
   (foreach file filelist
      ; Open and process it.
      (command "_.fileopen" file) ; open it. (note: this is where things can get ugly)
      (setvar 'xclipframe 0)      ; <- The requested sys var change
      (command "Qsave")           ; save it. (note: which too can be a problem. (if read-only))
   )
)

 

Add (& replace) the filenames inside the list and this piece of code will already suffice.

IF there are no 'complications'. Like read-only files and such.

 

If you where to expand on that, to fit EVERY situation, you get something like my "Multi File Tool".

I'll ellaborate on that in my next post.

0 Likes
Message 7 of 29

roland.r71
Collaborator
Collaborator

My MFT.LSP or "Multiple File Tool".

This is a lisp-program (its to big to just call it a function, imho) that will allow you to select files (in pretty much any way you might think off) & select a lisp file and/or enter a macro, script code or just 1 or more commands (command ...) to be executed on each file.

 

When starting the function you get the main dialog:

mft-main.png

Here you can set the various options how to handle certain situations, progress bar on/off & logfile.

supply a .lsp file to load and/or supply the code you wish to run.

 

For the example i already added the requested sysvar change as code. Which should be enough in this case.

The code can be edited inside its own edit window:

mft-code.png

Short of full fledged lisp functions you can enter almost anything. (including macro's !)

Which came to be with some help from @john.uhden 

MFT-editscr.jpg

After (or before) that you can select your files:

mft-select.png

You can add files in any way possible. Add (all) currently open, read a single dir, a tree or even from a file (Note: This would require import filters for most applications, like excel). You can save/load/edit the filelist. Change the order or just sort it alphanumeric. It allows for filename wildcards too. (only for adding. Not to filter the list itself)

 

During the process it will check each file real-time (read-only? open? openByOther? ...) and allow you to take action.

 

There is only one minor 'downside' to it all (if you can call it that): it requires DOSlib to run.

 

You can find some more information on the function and how it works >here<

 

Message 8 of 29

pbejse
Mentor
Mentor

You can alos consider this is five star tip from  Andrea Andreetti , Use Publish To Batch Run Commands 

Once you are aware of this capability, you cannot get this out of your head.

0 Likes
Message 9 of 29

pbejse
Mentor
Mentor

@roland.r71 wrote:

My MFT.LSP or "Multiple File Tool".

.....

You can find some more information on the function and how it works >here<


That looks awesome @roland.r71 , I think you got a winner there 😊

 

 

0 Likes
Message 10 of 29

andkal
Collaborator
Collaborator

Im afraid line "(setvar 'xclipframe 0) " will be performed still the session you run the your defined MF command.
You can go this way too:
1) write and save such short lisp file :

 

(setvar 'xclipframe 0) (command "_qsave") (command "_close")

 

2) add it to Startup Suit in Load Applications dialog window (APPLOAD command).
3) select all dwg files in which you want to set Xclipvariable and drag and drop it to opened autocad.
4) after process is done delete Lisp file so it wont be found when autocad opens a file
5) delete the path from Startup Suit

This method will have a disadvantage of that it can ocupy some time for opening and saving each drawing.


• www.autolisps.blogspot.com - Productivity plugins for Autocad and Autocad MEP
• Autodesk AppStore
0 Likes
Message 11 of 29

roland.r71
Collaborator
Collaborator

Thnx!

0 Likes
Message 12 of 29

roland.r71
Collaborator
Collaborator

I would need to test it to be sure, but this here has worked with everything so far.

It isn't even the same session. it opens the files in sequence using SDI. Only the lisp routine keeps running.

Executing lisp code within each drawing. (and the script code entered is EVALuated)

0 Likes
Message 13 of 29

john.uhden
Mentor
Mentor
Huh? What did *I* do?
But it must not have been all that bad since no one has come to arrest me
(yet).

John F. Uhden

0 Likes
Message 14 of 29

roland.r71
Collaborator
Collaborator

Well, actually, you went on a vacation and never came back 😄

0 Likes
Message 15 of 29

roland.r71
Collaborator
Collaborator

...but before that you helped me out on getting my 'script/macro/commands' option running smoothly 👍

0 Likes
Message 16 of 29

john.uhden
Mentor
Mentor

Wait a second.  I DID come back, although it was in the middle of a dark black night, so no one noticed. Thank goodness @scot-65  was around to help you out.  I think you might want to name your work as Scriptify.lsp.

Looks like this year there will be no vacation.  What for?  I haven't been working anyway. But thanks to that extra $600/week I have been better off than when I was working.  I actually spent some of the stimulus money on a robotic pool cleaner.  It's miraculous.

John F. Uhden

0 Likes
Message 17 of 29

Sea-Haven
Mentor
Mentor

Why not just chuck aeccoreconsole into the mix.

 

aeccoreconsole dwg1 script

aeccoreconsole dwg2 script

aeccoreconsole dwg3 script

 

The script would be very simple

(setvar 'xclipframe 0)

qsave

 

Lee-mac has a OBDX wrapper may be usefull also.

close

 

 

 

0 Likes
Message 18 of 29

roland.r71
Collaborator
Collaborator

That actually reminds me i still need to add the option to load the lisp file only ones. as more is not (always) needed.

If it contains a function, which can be called using the supplied script/commands, it would be a waste to load it with each file, as it is still there.

 

& i better remove the term "lisp" from that script dialog. Before people try pasting complete lisp routines in there. (that won't work). Beyond that it can handle pretty much anything. (script, macro, (command ...), (c:myFunc "test" 1))

 

... and the help button isn't going to help much (as there's still nothing "behind" it yet 😗)

 

Time for a version 3.1 😎

0 Likes
Message 19 of 29

john.uhden
Mentor
Mentor
My daughter got me a T shirt that reads "If at first you don't succeed,
call it Version 1.0"

John F. Uhden

0 Likes
Message 20 of 29

Sea-Haven
Mentor
Mentor

Press the "Any key" top right on my laptop.

0 Likes