Visual LISP, AutoLISP and General Customization

Reply
Contributor
sbsmith
Posts: 19
Registered: ‎12-17-2004
Message 1 of 4 (226 Views)

script file - how to write

226 Views, 3 Replies
07-21-2005 12:50 PM
where do you go to learn about using and writing script files to create layers with linetypes and colors you want.
Distinguished Contributor
Tom Smith
Posts: 3,729
Registered: ‎12-17-2003
Message 2 of 4 (226 Views)

Re: script file - how to write

07-21-2005 01:36 PM 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.
Distinguished Contributor
Dommy2Hotty
Posts: 287
Registered: ‎09-20-2003
Message 3 of 4 (226 Views)

Re: script file - how to write

07-21-2005 03:44 PM 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...
*David McReynolds
Message 4 of 4 (226 Views)

Re: script file - how to write

07-21-2005 04:40 PM 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.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community