Author Topic: turn on layer in multiple files  (Read 3328 times)

0 Members and 1 Guest are viewing this topic.

diego65

  • Newt
  • Posts: 51
  • Learning LISP is a cool thing
turn on layer in multiple files
« on: December 03, 2013, 12:58:11 PM »
I need help BIG time
I have the following lsp to turn ON a day name  layer in multiples files in a directory.
The stranger thing is that it works, however, only turn ON the layer on a few drawings within the directory others remain OFF.
First I thought, could be the name of the layer was too long? I changes to a shorter name without success.
Second I thought, maybe the reference file is referenced in a Relative Path? I changed it to Full path, without success.
If anyone be able to help me please, I have at least 1,000 drawing to go thru…

(defun c:dton ( )

    (LM:ODBX
        (function
            (lambda ( doc / lay )

                (vlax-for lay (vla-get-layers doc)

                (if (wcmatch (strcase (vla-get-name lay)) "*|SIGNED ON AUG 29 2013")
            
      (vla-put-layeron lay :vlax-true)
                    )
                )
            )
        )
        nil t
    )
    (princ)                              
)

Thank you…

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: turn on layer in multiple files
« Reply #1 on: December 03, 2013, 01:02:28 PM »
Are there any error messages printed to the command-line?



P.S. Please read this regarding formatting code in your posts.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: turn on layer in multiple files
« Reply #2 on: December 03, 2013, 01:47:11 PM »
Try opening one of the drawings for which the layers are NOT turned on and run the following program to test whether the wildcard pattern is finding any matches:
Code - Auto/Visual Lisp: [Select]
  1. (defun c:test ( / f )
  2.         (if (wcmatch (strcase (vla-get-name x)) "*|SIGNED ON AUG 29 2013")
  3.             (setq f (princ (strcat "\nMatch found: " (vla-get-name x))))
  4.         )
  5.     )
  6.     (if (null f) (princ "\nNo matches found."))
  7.     (princ)
  8. )

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: turn on layer in multiple files
« Reply #3 on: December 04, 2013, 11:13:40 AM »
That's odd - your results show that the program is finding a matching layer to turn on, but apparently this layer isn't being turned on.  :?

kruuger

  • Swamp Rat
  • Posts: 637
Re: turn on layer in multiple files
« Reply #4 on: December 04, 2013, 11:59:56 AM »
Indeed, I tried everything, re-pathing to full path, renaming the layer to a shorter name, checke dthe spelling and nothing seems to turn teh dumb layer on :x...

Not fun at all going thru every single drawing and turn the bloody layer on...
post the dwg here.  we try to investigate.
are you sure your layer is off not freeze?
k.

kruuger

  • Swamp Rat
  • Posts: 637
Re: turn on layer in multiple files
« Reply #5 on: December 04, 2013, 04:06:18 PM »
Hi kruuger,

Thank you for helping out.

Joselo...
do you have xref Post_Signed_Eng_Stamp.dwg file ?
this file is required.
kruuger


kruuger

  • Swamp Rat
  • Posts: 637
Re: turn on layer in multiple files
« Reply #6 on: December 05, 2013, 05:36:46 PM »
Hi kruuger,

Here you go...

sorry.
sorry but i don't see any problem.
i put both files on drive D: use Lee routine. after DTON date on stamped was turned on.
k.

Krushert

  • Seagull
  • Posts: 13679
  • FREE BEER Tomorrow!!
Re: turn on layer in multiple files
« Reply #7 on: December 05, 2013, 06:31:00 PM »
Hi kruuger,

Here you go...

sorry.

I do not have CAD here at home but you guys are not  sharing an engineers professional stamp are you?   That is no-no in my parts.  Just my over cautious self.
I + XI = X is true ...  ... if you change your perspective.

I no longer CAD or Model, I just hang out here picking up the empties beer cans

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: turn on layer in multiple files
« Reply #8 on: December 05, 2013, 07:18:14 PM »
I do not have CAD here at home but you guys are not  sharing an engineers professional stamp are you?   That is no-no in my parts.  Just my over cautious self.

Double that.  As you work a few blocks down the road from myself I can confidently say that your employers (and all 5 engineers listed on there) would not approve of the quantity of confidential information you have just released to the WWW.  In future strongly recommend you post simplified and PURGED drawings.

On the lighter side, I wish you guys had finished that LRT run when I was in university!
« Last Edit: December 05, 2013, 07:27:54 PM by WILL HATCH »