TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ELOQUINTET on September 21, 2004, 10:33:19 AM

Title: help with layer
Post 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
Title: help with layer
Post by: M-dub on September 21, 2004, 10:34:09 AM
Script


You can do it!
Title: help with layer
Post by: hudster on September 21, 2004, 10:41:39 AM
yup, script is deffo the way to go on this one...
Title: help with layer
Post by: ELOQUINTET on September 21, 2004, 10:59:41 AM
that's what i was thinking but i have 0 knowledge of how to write one. heeeellllllp  :?
Title: help with layer
Post by: M-dub on September 21, 2004, 11:00:31 AM
Alrighty...
How many drawings are there?  Are they all in the same directory?
Title: help with layer
Post by: ELOQUINTET on September 21, 2004, 11:01:11 AM
i suppose i should make it non printing while i'm at it too since it might appear in some views now
Title: help with layer
Post by: M-dub on September 21, 2004, 11:05:29 AM
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...
Title: help with layer
Post by: ELOQUINTET on September 21, 2004, 11:27:59 AM
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
Title: help with layer
Post by: M-dub on September 21, 2004, 11:36:42 AM
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...
Title: help with layer
Post by: ELOQUINTET on September 21, 2004, 11:42:30 AM
ok should be ready after lunch to jump in
Title: help with layer
Post by: M-dub on September 21, 2004, 11:44:04 AM
Sounds good
Title: help with layer
Post by: Keith™ on September 21, 2004, 11:49:08 AM
From DOS prompt in folder where you want to grab the file names:

Code: [Select]

dir /a /on /b *.dwg > filelist.txt
Title: help with layer
Post by: Jeff_M on September 21, 2004, 01:13:56 PM
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.
Title: help with layer
Post by: whdjr on September 21, 2004, 01:15:35 PM
You could also use ObjectDBX to accomplish your task,
Title: help with layer
Post by: M-dub on September 21, 2004, 02:52:28 PM
Dan?
What's going on?  Are you working on this?
Title: help with layer
Post by: ELOQUINTET on September 21, 2004, 04:22:49 PM
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
Title: help with layer
Post by: hudster on September 22, 2004, 03:58:58 AM
here is a script for locking layers...

Code: [Select]
;;invoke the layer command
-layer
;;select lock
lock
;;enter layer name
(your layer name here)
;;exit layer command

;;end of script
Title: help with layer
Post by: M-dub on September 22, 2004, 08:04:24 AM
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.
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 08:33:17 AM
i tried but not sure if this is the right formatting and not sure how to run it

Code: [Select]
;;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
Title: help with layer
Post by: M-dub on September 22, 2004, 08:38:20 AM
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?
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 08:47:36 AM
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
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 08:58:06 AM
well i figured out how to write the script and run it but it's not working i need some help with formatting this
Title: help with layer
Post by: M-dub on September 22, 2004, 09:02:10 AM
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.

Code: [Select]
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.......
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 09:11:32 AM
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
Title: help with layer
Post by: M-dub on September 22, 2004, 09:15:30 AM
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).
Title: help with layer
Post by: hudster on September 22, 2004, 09:24:51 AM
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.
Title: help with layer
Post by: M-dub on September 22, 2004, 09:26:35 AM
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?
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 10:19:09 AM
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
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 10:38:06 AM
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?
Title: help with layer
Post by: M-dub on September 22, 2004, 10:41:52 AM
I haven't tried it yet, so I can't help you with EZScript....only my own method.  Sorry.
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 10:50:43 AM
mdub i don't really see how directory printer helps me that much. how does it help you?
Title: help with layer
Post by: M-dub on September 22, 2004, 10:57:08 AM
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.
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 11:02:15 AM
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  :?
Title: help with layer
Post by: M-dub on September 22, 2004, 11:03:47 AM
I just sent you an e-mail...
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 11:08:30 AM
yep still here mdub
Title: help with layer
Post by: hudster on September 22, 2004, 11:42:00 AM
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.
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 11:45:18 AM
i believe i did all the setup in ezscript hudster but when i go to run it it doesn't do anything dunno
Title: help with layer
Post by: M-dub on September 22, 2004, 11:49:19 AM
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...
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 12:00:33 PM
you saw structure wow  :lol:
Title: help with layer
Post by: M-dub on September 22, 2004, 12:57:07 PM
Quote from: eloquintet
you saw structure wow  :lol:


...Or lack thereof....;)
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 01:32:47 PM
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

Code: [Select]
;turn layer on
-layer on z-barcode
;;make layer non plotting
p n z-barcode
;;exit layer command

save y

close

;;end of script
Title: help with layer
Post by: M-dub on September 22, 2004, 01:35:35 PM
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"
Title: help with layer
Post by: ELOQUINTET on September 22, 2004, 01:40:35 PM
done