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
    274
    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
    606
    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
    274
    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
    3,632
    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

    Autodesk Exchange Apps
    ~ Autoloader ~ AutoCAD Security

  5. #5
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    274
    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
    3,632
    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

    Autodesk Exchange Apps
    ~ Autoloader ~ AutoCAD Security

Similar Threads

  1. Coding VBA for INVENTOR 2010
    By mikel.pesquer in forum VBA/COM Interop
    Replies: 0
    Last Post: 2009-11-26, 06:40 AM
  2. If I wanted to start coding in .NET....
    By Coolmo in forum Dot Net API
    Replies: 19
    Last Post: 2009-08-31, 04:41 PM
  3. CODING ELEMENTS
    By Steve Hutana in forum Revit - Platform
    Replies: 2
    Last Post: 2009-08-09, 08:42 PM
  4. Line Coding and In-Roads
    By markj.193961 in forum Survey - General
    Replies: 1
    Last Post: 2009-03-17, 07:21 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
  •