Author Topic: Layer Checker  (Read 2494 times)

0 Members and 1 Guest are viewing this topic.

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Layer Checker
« on: April 02, 2004, 12:21:03 PM »
Enclosed is a progie that I have been working on for checking a drawings layers for compliance. (i.e. Color & Linetype). I would like for this to also check for the Layers NAME for compliance. How do I go aboout adding to this and which is the best way?

Code: [Select]

(defun layercheck (layername color linetype / layername color linetype)
        (if (setq entlist (tblsearch "LAYER" (strcat layername)))
          (progn
            (setq colorx (rtos (abs (cdr (assoc 62 entlist))) 2 0))
            (setq linetypex (cdr (assoc 6 entlist)))
            (if (or (/= color colorx)(/= (strcase linetype) (strcase linetypex)))
              (progn
                    (setq openval (findfile valname))
           (if (null openval)
              (setq vfile (open valname "w"))
              (setq vfile (open valname "a"))
           )              
                (princ (strcat "\nLayer " layername " is color " colorx
                           " but should be color " color ".\n"
                           "\nLayer " layername " is linetype " linetypex
                           " but should be linetype " linetype ".\n")vfile)
                           (close vfile)
              )
            ) ;end if
          )
          (progn)
        )
     )

;;Call Function

   (layercheck "A-ANNO-TEXT-SHEL" "1" "CONTINUOUS")
   (layercheck "A-ANNO-TEXT-TENT" "30" "CONTINUOUS")


Thanks,

Don
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
Layer Checker
« Reply #1 on: April 02, 2004, 12:44:21 PM »
What do you mean by "compliance" ? If the layer isn't in the dwg the program returns nil.
TheSwamp.org  (serving the CAD community since 2003)

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
Layer Checker
« Reply #2 on: April 02, 2004, 01:28:12 PM »
I mean, have a list if layers and have the routine check the layers in the drawing against the layer list in the routine for compliance. If you have a layer that should not be in a drawing, then it will be flagged to the user.
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023