TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ELOQUINTET on September 21, 2004, 10:33:19 AM
-
i have a layer in a bunch of drawings i would like to have locked rather than turned off without having to open each one. does anybody have something that could acheive this? thanks
-
Script
You can do it!
-
yup, script is deffo the way to go on this one...
-
that's what i was thinking but i have 0 knowledge of how to write one. heeeellllllp :?
-
Alrighty...
How many drawings are there? Are they all in the same directory?
-
i suppose i should make it non printing while i'm at it too since it might appear in some views now
-
Some may disagree with the method I use to create my scripts, but my way works so that's how I'm going to teach you.
If you have lots of drawings, go download Directory Printer (http://www.galcott.com/dp.htm) and export your directory(ies) to a csv file. In your csv file, delete everything except the file and path info. Actually, I've gotta find out how many files we're talking about first...
-
mdub this actually has to do with discovery. what i am doing is creating a sort of bar code system. i have created a notepad document which has has abbreviated hardware info. i am pasting the info into individual drawings on a barcode layer then was turning it off to try to prevent others from deleting it. the more i thought about it it would be better if i just locked it and made it non printing. there are alot of files, about 2 years worth of jobs at this point i've gone through. they are in 2 main directories with many subfolders. i'll look at your link when i come to a good stopping point. thanks
-
Yes, from what I've read so far, I think creating your script in Excel should work perfectly. You don't NEED to download Directory Printer, but it helps immensely. You can get similar results from the DOS Prompt, but DP has more functionality that will help you and it's easier.
Let me know...
-
ok should be ready after lunch to jump in
-
Sounds good
-
From DOS prompt in folder where you want to grab the file names:
dir /a /on /b *.dwg > filelist.txt
-
Hmmm, other that the small problem of losing the drawing thumbnail preview, I would think VBA & ObjectDBX would be the way to go here. Does not require the loading into the drawing editor of any drawings which would save a heap of time.
Could also be done in vlisp/ObjectDBX, but I think the folder/file selection is easier in VBA.
-
You could also use ObjectDBX to accomplish your task,
-
Dan?
What's going on? Are you working on this?
-
sorry about that mdub haven't gotten around to it will have to try it tomorrow. i know nothing about script writing but have always been curious about how it works. been busy though ya know how it is talk to you tomorrow
-
here is a script for locking layers...
;;invoke the layer command
-layer
;;select lock
lock
;;enter layer name
(your layer name here)
;;exit layer command
;;end of script
-
Scripts basically work the same way as you typing everything in at the command line. If it can be done on the command line, it can be done in a script.
-
i tried but not sure if this is the right formatting and not sure how to run it
;;invoke the layer command
-layer
;;select on
on
;;enter layer name
z-barcode
;;select plot
off
;;enter layer name
z-barcode
;;exit layer command
;;end of script
-
To invoke the script, type SCRIPT at the command line and go find your script file.
Do you have a directory listing of your drawings?
-
ummm ok does my script look like it will work. if so, how do i create the script? i have directories by year then by job number in short
-
well i figured out how to write the script and run it but it's not working i need some help with formatting this
-
If it works, you'll either have to open each drawing individually and run the script or you can do the following...I use Directory Printer to make it easier and create my scripts in Excel...Gimme a call if you want to.
OPEN
C:/DIRECTORY/DRAWING1.DWG
;;invoke the layer command
-layer
;;select on
on
;;enter layer name
z-barcode
;;select plot
off
;;enter layer name
z-barcode
;;exit layer command
;;end of script
OPEN
C:/DIRECTORY/DRAWING2.DWG
;;invoke the layer command
-layer
;;select on
on
;;enter layer name
z-barcode
;;select plot
off
;;enter layer name
z-barcode
;;exit layer command
;;end of script
OPEN
C:/DIRECTORY/DRAWING3.DWG
etc.......
-
yeah that seems way too complicated entering the paths to open. i've done so many drawings that i can't remember which one i've done or not and once i find them i might as well just do it manually. so maybe i outta look at this directory printer sounds like what i need. i'll give ya a call or post here if i get stuck thanks
-
If you have LOTS of drawings, create the script to do ALL of them instead of doing it individually.
You should be alright. You can do this, Dan. When you see it working after you're done, it's awesome. I've created entire drawings using scripts. (1000+ Drawings that were all exactly the same except for the attributes).
-
or you could just download EZscript.
Write one script, assign it to whatever drawings you want, click run script and it'll do them itself.
a whole lot easier.
-
Cool...
I might have to try that out. It's just that I've been doing it the same way for so long that it's hard to change. Google Search or do you have a website to download it?
-
i created a setup script for starters to set variables and got that goin ok. with the ezscript could i just assign it to run on all drawings in our network i.e. p://projects all subfolders and be done with it. see when i pasted my info in i created the layer so other drawings will not be affected. i just wanna make this as quick and easy as possible. i'll check out ezscript now and see if i can answer my own question thanks
-
well i downloaded ezscript pro 3.1 and set it all up and ran my script on a single drawing and it's been showing the progress screen forever not doin anything, am i missing something here? seems like it's setup to do what i'm lookin for but nuttins happnin. any thoughts?
-
I haven't tried it yet, so I can't help you with EZScript....only my own method. Sorry.
-
mdub i don't really see how directory printer helps me that much. how does it help you?
-
It makes it really easy to create a directory listing, then exports it to either a txt file or a csv file. I always export to csv, then open it in Excel and create my scripts there. The reason I create it in Excel is because if I have any numbers I have to change (usually increase by 1 each time), Excel's "Fill Series" makes it quick. Once I have everything done, I concatenate the cells and save it as a txt file. After that, just rename the txt file to .scr and go into Acad and run the script.
Again, you don't NEED Directory Printer...you can use the DOS Prompt and type in what Keith posted on page 1 of this topic.
-
ok my problem i guess is i did so many drawings that i don't remember them all so i just wanna run the script on all and have the aplicable ones update. is there an all option :?
-
I just sent you an e-mail...
-
yep still here mdub
-
with ezscript, you have to start it, set the config parameters, then close it, re-start it, choose your drawings, chose your script, save it and then run it.
It's a bit fiddly at first, but as it can use do all the drawings in one AutoCAD session it's a lot faster than AutoCADs own scriptpro, which loads autocad for each drawing.
I think there is a help file on the EZscript website for setting it up.
-
i believe i did all the setup in ezscript hudster but when i go to run it it doesn't do anything dunno
-
After talking with Dan, I don't think scripts are going to help him yet. First he has to find the drawings that contain the layers he's trying to work with. After he has that list of drawings, scripts might help him. The only thing I was worried about, Dan, was the directory structures...Spaces, decimals and commas can cause problems with scripts. It will have to be tested though...
-
you saw structure wow :lol:
-
you saw structure wow :lol:
...Or lack thereof....;)
-
mdub what i did was i created this script then did a windows search for doors and sidelites opened all those drawings then ran the script on each. it didn't get everything but it helped some. like i said it's not a big deal just trying to learn. thanks
;turn layer on
-layer on z-barcode
;;make layer non plotting
p n z-barcode
;;exit layer command
save y
close
;;end of script
-
Right on...
I was actually just trying a Windows search for layer names. Actually, I'm writing this as I wait for it to finish. It worked for finding Xref's before so I thought I'd try searching for layer names. I even looked on the ol' Cadalog.com for something that would help you, but couldn't find anything. You should start a new topic "Find drawings containing layer"
-
done