Jump to content
rgutierrez

AutoLISP - Adding linetype & lineweight

Recommended Posts

rgutierrez

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

Share this post


Link to post
Share on other sites
feargt

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" "" "" "")

)

Share this post


Link to post
Share on other sites
rgutierrez

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?

Share this post


Link to post
Share on other sites
feargt

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

Share this post


Link to post
Share on other sites
rgutierrez

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 [Truecolor/COlorbook] : 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.

Share this post


Link to post
Share on other sites
MSasu

Please pay attention that you missed to indicate the layer that will set the linetype for:

..."_L" "DASHED2" [color=red]"[font=Verdana][size=2]A-SEC-LIH-005"[/size][/font][/color]...

or

..."_L" "DASHED2" [color=red]"[font=Verdana][size=2]"[/size][/font][/color]...

Share this post


Link to post
Share on other sites
rgutierrez

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 [Truecolor/COlorbook] : 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*

Share this post


Link to post
Share on other sites
feargt

Thanks MSasu for picking that up:

(command "_-layer" "_m" "A-SEC-LIH-005" "_C" "magenta" "" "_l" "DASHED2" "" "_LW" "0.10" "" "" "")

Share this post


Link to post
Share on other sites
BIGAL

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 "" "" "")
)

Share this post


Link to post
Share on other sites
Snownut
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.

Share this post


Link to post
Share on other sites
rgutierrez

Hi Guys,

What a great help, I want to thanks you all of you.

Cheers feargr, MSasu, Bigal, Snownut!!

cheers

Share this post


Link to post
Share on other sites
BIGAL

Snownut following up I would probably use entmake or vl-addlayer now, did not want to confuse op, thats interesting perhaps create a new post 2015 & lisp ?

Share this post


Link to post
Share on other sites
rgutierrez

Hi Guys,

 

Again thanks for all your help.. I was having a chat with the IT guy and he introduced me to http://notepad-plus-plus.org/ great program to create the autoLISP

 

Cheers

Share this post


Link to post
Share on other sites
rgutierrez

Sorry.. next time for sure... thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×