AutoLISP - Adding linetype & l
Hi Guys,I'm creating a layer setting pull down menu, in order to migrate my cad to revit I would like to define the linewight. So far I managed to create a command with a dashed line:
(defun c:layA-SEC-LIH-005()
(command "layer" "m" "A-SEC-LIH-005""C" "magenta" "" "l""DASHED2" "" "")
and another one with the lineweight
(defun c:layA-SEC-LIH-005()
(command "layer" "m" "A-SEC-LIH-005""C" "magenta" "" "_LW" 0.10"" "")
but I haven't been able to create one that combines the 2 of them.. any help?
Cheers
Roberto not sure why u couldn't get it to work, but after entering the linetype, instead of exiting the command continue by giving the lineweight.
(defun c:layA-SEC-LIH-005 ()
(command "_-layer" "_m" "A-SEC-LIH-005" "_C" "magenta" "" "_l" "DASHED2" "_LW" "0.10" """" "")
) Hi feargt,
Still doesn't work, I get a prompt asking to "Enter and option" [? Make Set New Rename ON OFF Color LType LWeight Transparency MAterial Plot Freeze Thaw LOck Unlock state Description rEconcile]:
Doesn't work for you if you use the pull down menu? copy this direct on to the command line
(command "_-layer" "_m" "A-SEC-LIH-005" "_C" "magenta" "" "_l" "DASHED2" "_LW" "0.10" """" "")
and see does it work. it works for me.
if it does not work, press f2 and copy the text out so I can see where it stops working for you as requested.. btw.. thanks for helping
Command: (command "_-layer" "_m" "A-SEC-LIH-005" "_C" "magenta" "" "_l" "DASHED2" "_LW" "0.10" "" "" "")
_-layer
Current layer:"0"
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _m
Enter name for new layer (becomes the current layer) : A-SEC-LIH-005 Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _C
New color : magenta
Enter name list of layer(s) for color 6 (magenta) : Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _l
Enter loaded linetype name or [?] : DASHED2
Enter name list of layer(s) for linetype "DASHED2" : _LW
No matching layer names found.
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: 0.10
Invalid option keyword. Please pay attention that you missed to indicate the layer that will set the linetype for:
..."_L" "DASHED2" "A-SEC-LIH-005"...or
..."_L" "DASHED2" ""... I will try tomorrow on another computer.. still doesn't work for me.. g nite
Command: (command "_-layer" "_m" "A-SEC-HIDDEN" "_C" "magenta" "" "_LT" "DASHED2" "_LW" "0.10" "" "" "")
_-layer
Current layer:"0"
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _m
Enter name for new layer (becomes the current layer) : A-SEC-HIDDEN Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _C
New color : magenta
Enter name list of layer(s) for color 6 (magenta) : Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: _LT
Enter loaded linetype name or [?] : DASHED2
Enter name list of layer(s) for linetype "DASHED2" : _LW
No matching layer names found.
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: 0.10
Invalid option keyword.
; error: Function cancelled
Enter an option [?/Make/Set/New/Rename/ON/OFF/Color/Ltype/LWeight/TRansparency/MATerial/Plot/Freeze/Thaw/LOck/Unlock/stAte/Description/rEconcile]: *Cancel* Thanks MSasu for picking that up:
(command "_-layer" "_m" "A-SEC-LIH-005" "_C" "magenta" "" "_l" "DASHED2" "" "_LW" "0.10" """" "") You may want to create a global lisp defun that just passes the variables using either entmake, command or VL eg (newlay "A- SEC-LIH-005" 5 "dashed2" 0.1) then you can use in any lisp you make.
(defun newlay (lay col lt thick / )(command "_-layer" "_m" lay "_C" col "" "_l" lt "" "_LW" thick "" "" ""))
BIGAL, there seems to be some issues showing up in ACAD 2015 in using the "command" function in LISP.It seems AutoCad is slowly moving away from allowing this.The better way is to use the "vl-cmdf" function, this will require the (vl-load-com) at the beginning of the LISP.
页:
[1]
2