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
    399
    Login to Give a bone
    0

    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.

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    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
    399
    Login to Give a bone
    0

    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

  4. #4
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    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))
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #5
    I could stop if I wanted to cadd4la's Avatar
    Join Date
    2001-12
    Location
    Newport Beach, CA
    Posts
    399
    Login to Give a bone
    0

    Default Re: Coding help.

    RenderMan,

    Thank you, it works great.

    KC

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Coding help.

    Quote Originally Posted by cadd4la View Post
    RenderMan,

    Thank you, it works great.
    You're welcome.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

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.wishlist1738 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
  •