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

script file - how to write

6 REPLIES 6
Reply
Message 1 of 7
sbsmith
958 Views, 6 Replies

script file - how to write

where do you go to learn about using and writing script files to create layers with linetypes and colors you want.
6 REPLIES 6
Message 2 of 7
Tom Smith
in reply to: sbsmith

Search this group on "layers." A lot of different approaches to this have been discussed in great detail already.

Probably the simplest non-programming approach is to use the built-in layer states capability. Create a drawing with layers the way you want, then export its layer state to a file. Then you can import that layer state into any other drawing.
Message 3 of 7
Dommy2Hotty
in reply to: sbsmith

It's really simple...Fire up Notepad and type your commands. Each line represents an entry into the command prompt. So however you would type out the entire command is how you would write the script file. There needs to be a blank line at the end, otherwise the last entry won't be entered. For example:

-layer
new
NewLayerName
(blank line here)

Save the file with a .scr extension, and you're good to go!

Now to take it a step further, you can use spaces to represent a return, otherwise script files can become quite lengthy...Here's the same script file, condensed to a single line

-layer new NewLayerName

There are TWO spaces after "NewLayerName." There are two because the first space is a return to input "NewLayerName" into the layer command. The second is to exit out of the layer command's main menu. There is no blank line, because we now used a space instead. So now you can group each command sequence into a single line for each command. Easier to maintain. For example:

-layer make NewLayerName
line 0,0 @12<45

ONE space now after the layer command, because the return to the next line for the Line command is the return. TWO spaces after the line command, first one to input "@12<45" and the second one to end the line command. NO blank lines at the end.

Hope that shed some light on the subject...
Message 4 of 7
Anonymous
in reply to: sbsmith

Lisp Version
;;;;-------------------------------------------------------------------
(setq c (tblsearch "ltype" "HWC2"))
(if (= c nill)
(progn
(command "-LINETYPE" "Load" "HWC2" "hbhu.lin" "")
)
)
(if (/= c nil)
(progn
(prompt " HWC2 already loaded ")
(terpri)
)
)
;;;;-------------------------------------------------------------------
(setq d (tblsearch "ltype" "CENTER2"))
(if (= d nil)
(progn
(command "-LINETYPE" "Load" "CENTER2" "acad.lin" "")
)
)
(if (/= d nil)
(progn
(prompt " CENTER2 already loaded ")
(terpri)
)
)

Script Version
-layer Make M-LET C 3 M-LET l continuous M-LET
-layer Make Mview OFF Y Mview
-layer Make RMNO C 4 RMNO L CONTINUOUS RMNO
-layer Make xref C 7 xref L CONTINUOUS xref lock xref
-layer Make P-CW C 5 P-CW L CENTER P-CW
-layer Make P-HW C 1 P-HW L PHANTOM P-HW
-layer Make P-HWC C 1 P-HWC L HWC P-HWC
-layer Make P-VENT C 6 P-VENT L DASHED P-VENT
-layer Make P-WASTE C 1 P-WASTE L CONTINUOUS P-WASTE
-layer Make P-GAS C 6 P-GAS L CONTINUOUS P-GAS
-layer Make P-MGAS C 6 P-MGAS L CONTINUOUS P-MGAS

wrote in message news:4908114@discussion.autodesk.com...
where do you go to learn about using and writing script files to create
layers with linetypes and colors you want.
Message 5 of 7
SBoudreau
in reply to: Anonymous

How would the script file address a "space" in the layer name? My script files stalls on layer names that have spaces in them even when I place quotes around the layer name "title block" for instance. Any ideas how to create a series of layers that have spaces in them using a script file?

 

scotty 

Message 6 of 7
ВeekeeCZ
in reply to: SBoudreau


@SBoudreau wrote:

How would the script file address a "space" in the layer name? My script files stalls on layer names that have spaces in them even when I place quotes around the layer name "title block" for instance. Any ideas how to create a series of layers that have spaces in them using a script file?

 

scotty 


As you said, put quotes around. See and load attached script file, no issue with that. (get rid of .txt)

Message 7 of 7
Kent1Cooper
in reply to: SBoudreau


@SBoudreau wrote:

.... My script files stalls on layer names that have spaces in them even when I place quotes around the layer name "title block" for instance. ....


Yes, putting double-quotes around them should work.  Can you post some relevant part(s) of such a Script?  There may be something obvious.

Kent Cooper, AIA

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

Post to forums  

Autodesk Design & Make Report

”Boost