Results 1 to 6 of 6

Thread: Coding help.

  1. #1
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    296
    0 Did you find this post helpful? Yes

    Default Coding help.

    Hello everyone,

    I need some help to get this code to work.

    I am looking for it to allow me to select a layer and then make it nonplot.

    After I run it, I get this in the command line "Pick the layer to make nonprint: ; error: too many arguments" and the layer that I have pick has not be set to nonplot.

    Code:
    (DEFUN C:NP ()(SETVAR "CMDECHO" 0)
            (setq ent_name (car (entsel "\nPick the layer to make nonprint: ")))
        (setq ent_list (entget ent_name))     
        (setq l_name (cdr (assoc 8 ent_list)))  
        (setvar "-LAYER" "PLOT" "N" l_name)   
            (SETVAR "CMDECHO" 1)(princ))
    Thanks.
    AutoCAD 2010 Windows7 Ultimate
    _________________________________________________________
    My spelling is wobbly. It's good spelling but it wobbles and the letters get in the wrong places.
    ... Winnie the Pooh

  2. #2
    All AUGI, all the time Tharwat's Avatar
    Join Date
    2010-06
    Posts
    701
    0 Did you find this post helpful? Yes

    Default Re: Coding help.

    Just replace this part ...

    Code:
    (command "-LAYER" "PLOT" "N" l_name "")
    and it is better to localize variables like this ...

    Code:
    (DEFUN C:NP (/ ent_name ent_list l_name)

  3. #3
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    296
    0 Did you find this post helpful? Yes

    Default Re: Coding help.

    Thank for the help and the localize variables reminder.

    I did have the "" in the code before I posted it and it still didn't work.

    KC
    AutoCAD 2010 Windows7 Ultimate
    _________________________________________________________
    My spelling is wobbly. It's good spelling but it wobbles and the letters get in the wrong places.
    ... Winnie the Pooh

  4. #4
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    4,771
    0 Did you find this post helpful? Yes

    Default Re: Coding help.

    ... Building on Tharwat's post:

    Code:
    (defun c:FOO ( / eName layerName oldCmdecho)
      (if (and (setq eName (car (entsel "\nSelect layer to make \"No Plot\": ")))
               (setq layerName (cdr (assoc 8 (entget eName)))))
        (progn
          (setq oldCmdecho (getvar 'cmdecho))
          (setvar 'cmdecho 0)
          (command "._-layer" "plot" "n" layerName "")
          (setvar 'cmdecho oldCmdecho)
          (princ layerName))
        (prompt "\n** Nothing selected ** "))
      (princ))
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Autodesk Exchange Apps

  5. #5
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    296
    0 Did you find this post helpful? Yes

    Default Re: Coding help.

    RenderMan,

    Thank you, it works great.

    KC
    AutoCAD 2010 Windows7 Ultimate
    _________________________________________________________
    My spelling is wobbly. It's good spelling but it wobbles and the letters get in the wrong places.
    ... Winnie the Pooh

  6. #6
    Programming Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    4,771
    0 Did you find this post helpful? Yes

    Default Re: Coding help.

    Quote Originally Posted by cadd4la View Post
    RenderMan,

    Thank you, it works great.
    You're welcome.
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Autodesk Exchange Apps

Similar Threads

  1. Suggested Guidelines for Coding
    By peter in forum AutoLISP
    Replies: 12
    Last Post: 2015-07-27, 08:06 AM
  2. Coding help
    By cadd4la in forum AutoLISP
    Replies: 2
    Last Post: 2013-07-08, 10:50 PM
  3. Coding help
    By cadd4la in forum AutoLISP
    Replies: 14
    Last Post: 2013-06-21, 05:20 PM
  4. CODING ELEMENTS
    By Steve Hutana in forum Revit - Platform
    Replies: 2
    Last Post: 2009-08-09, 08:42 PM
  5. Color Coding XYZ in iProperties Tab
    By Inventor Wishes in forum Inventor Wish List
    Replies: 0
    Last Post: 2006-06-14, 04:07 AM

Tags for this Thread

Posting Permissions

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