Set the values of the various system variables to what you require first and then call the PLINE command. You can use a semicolon in place of the spaces to issue enter key (returns) to make it easier to see them. A semicolon does the same as a space in menu macros.
For example, I use the following to set both system and custom variables before hatching using my "Bar Grate" hatch pattern. Notice that you can also load and call a lisp function (hop.lsp does some other custom things with the custom variables I set):
^C^C(setvar"hpang"0)(setvar"hpname""grate")(setvar"hpscale"32)(setq prod "GRTE")(setq modf "PATT")(if hop nil (load"hop"))(c:hop) \bhatch
///////////////////// Below are some of the system variables involved with the setting you mentioned //////////////////////////////
(SETVAR "CELAYER" <existing layer name to use>)
(SETVAR "CECOLOR" <1-256>) ; color number 256=bylayer
(SETVAR "CELWEIGHT" <value>)
Value Description
-1 Sets the lineweight to "BYLAYER."
-2 Sets the lineweight to "BYBLOCK."
-3 Sets the lineweight to "DEFAULT." "DEFAULT" is controlled by the LWDEFAULT system variable.
Other valid values entered in hundredths of millimeters include 0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120, 140, 158, 200, and 211. All values must be entered in hundredths of millimeters. (Multiply a value by 2540 to convert values from inches to hundredths of millimeters.)
(SETVAR "LWDEFAULT" <value>)
Initial value: 25
The default lineweight can be set to any valid lineweight value in hundredths of millimeters, including: 0, 5, 9, 13, 15, 18, 20, 25, 30, 35, 40, 50, 53, 60, 70, 80, 90, 100, 106, 120, 140, 158, 200, and 211. All values must be entered in hundredths of millimeters. (Multiply a value by 2540 to convert values from inches to hundredths of millimeters.)
(SETVAR "LWDISPLAY" <value>)
Value Description
OFF Lineweights are not displayed
ON Lineweights are displayed
Note: You can use 1 and 0 in place of ON and OFF to change the setting.
(SETVAR "LWUNITS" <value>)
Initial value: 1
Value Description
0 Inches
1 Millimeters
AutoCAD User since 1989. Civil Engineering Professional since 1983
Product Version: 13.6.1963.0 Civil 3D 2024.4.1 Update Built on: U.202.0.0 AutoCAD 2024.1.6
27.0.37.14 Autodesk AutoCAD Map 3D 2024.0.1
8.6.52.0 AutoCAD Architecture 2024