+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 15
  1. #1
    Forum Newbie
    Using
    AutoCAD 2014
    Join Date
    Aug 2014
    Posts
    7

    Default AutoLISP - Adding linetype & lineweight

    Registered forum members do not see this ad.

    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

  2. #2
    Senior Member
    Computer Details
    feargt's Computer Details
    Operating System:
    win 7
    Using
    Civil 3D 2012
    Join Date
    Sep 2008
    Location
    Austria
    Posts
    428

    Default

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




  3. #3
    Forum Newbie
    Using
    AutoCAD 2014
    Join Date
    Aug 2014
    Posts
    7

    Default

    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?

  4. #4
    Senior Member
    Computer Details
    feargt's Computer Details
    Operating System:
    win 7
    Using
    Civil 3D 2012
    Join Date
    Sep 2008
    Location
    Austria
    Posts
    428

    Default

    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


  5. #5
    Forum Newbie
    Using
    AutoCAD 2014
    Join Date
    Aug 2014
    Posts
    7

    Default

    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) <0>: 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) <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]: _l
    Enter loaded linetype name or [?] <Continuous>: DASHED2
    Enter name list of layer(s) for linetype "DASHED2" <A-SEC-LIH-005>: _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.

  6. #6
    Forum Deity MSasu's Avatar
    Discipline
    Construction
    MSasu's Discipline Details
    Occupation
    engineer
    Discipline
    Construction
    Details
    AutoLISP programmer
    Using
    AutoCAD 2013
    Join Date
    Mar 2009
    Location
    Brasov, Romania
    Posts
    4,008

    Default

    Please pay attention that you missed to indicate the layer that will set the linetype for:
    Code:
    ..."_L" "DASHED2" "A-SEC-LIH-005"...
    or
    Code:
    ..."_L" "DASHED2" ""...
    Regards,
    Mircea

    AutoCAD's happy user equation: FILEDIA + PICKADD² + PICKFIRST = 3

  7. #7
    Forum Newbie
    Using
    AutoCAD 2014
    Join Date
    Aug 2014
    Posts
    7

    Default

    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) <0>: 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) <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]: _LT
    Enter loaded linetype name or [?] <Continuous>: DASHED2
    Enter name list of layer(s) for linetype "DASHED2" <A-SEC-HIDDEN>: _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*

  8. #8
    Senior Member
    Computer Details
    feargt's Computer Details
    Operating System:
    win 7
    Using
    Civil 3D 2012
    Join Date
    Sep 2008
    Location
    Austria
    Posts
    428

    Default

    Thanks MSasu for picking that up:




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

  9. #9
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,748

    Default

    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.

    Code:
    (defun newlay (lay col lt thick / )
    (command "_-layer" "_m" lay "_C" col "" "_l" lt "" "_LW" thick "" "" "")
    )
    A man who never made mistakes never made anything

  10. #10
    Senior Member
    Computer Details
    Snownut's Computer Details
    Operating System:
    Windows 10 Home premium
    Computer:
    Lenovo
    Using
    not applicable
    Join Date
    Nov 2010
    Location
    New Hampshire
    Posts
    238

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by BIGAL View Post
    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.

    Code:
    (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.

Similar Threads

  1. Change Bylayer ( color,lineweight,linetype )
    By vnanhvu in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 17th Aug 2011, 05:14 pm
  2. Change a viewport linetype or lineweight? F1 key...
    By sean.svs in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 3
    Last Post: 18th Feb 2010, 12:16 am
  3. Colour/Lineweight/Linetype control on Ribbon
    By busseynova in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 7
    Last Post: 5th Feb 2010, 12:27 pm
  4. FOUND IT! - Linetype/Lineweight/Color Macro
    By amattintime in forum AutoCAD General
    Replies: 2
    Last Post: 30th Jun 2006, 08:07 pm
  5. User Defined Button?: Color/Lineweight/Linetype
    By amattintime in forum AutoCAD General
    Replies: 5
    Last Post: 30th Jun 2006, 07:25 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts