Author Topic: Block on layer zero without moving the attributes  (Read 2789 times)

0 Members and 1 Guest are viewing this topic.

Hugo

  • Bull Frog
  • Posts: 431
Block on layer zero without moving the attributes
« on: April 08, 2011, 03:32:35 AM »
Hello

Have you a Lisp where everything is placed on Lyer null move without me the attribute.
This is a very good thing
Now I want but the shading is not placed on layer zero but will remain as it is
Can I use the one in the Installation Procedure Lisp.
Thanks

Hallo

Habe ihr ein Lisp wo alles auf Lyer null gelegt wird ohne mir das Attribut zu verschieben.
Das läuft sehr gut so
Jetzt will ich aber das die Schraffur nicht auf Layer null gelegt wird sondern so bleibt wie sie ist
Kann mir bitte das einer in die Lisp einbaun.
Danke

Hugo

  • Bull Frog
  • Posts: 431
Re: Block on layer zero without moving the attributes
« Reply #1 on: April 08, 2011, 03:35:58 AM »
Sorry Lisp

Code: [Select]
(defun c:ATTColor (/ blkobj lays ss)
  (setq lays (vla-get-layers
       (vla-get-activedocument (vlax-get-acad-object))
     )
ss   (ssget "x" '((0 . "INSERT") (66 . 1)))
  )
  (if ss
    (progn
      (setq ss
     (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss)))
      )
      (mapcar
'(lambda (b)
   (if (eq (vla-get-lock (vla-add lays (vla-get-layer b)))
   :vlax-false
       )
     (progn
       (mapcar
'(lambda (a)
    (vla-put-color a 256)
  )
(vlax-invoke b 'getattributes)
       )
       (vlax-for blkobj (vla-item
  (vla-get-blocks
    (vla-get-activedocument
      (vlax-get-acad-object)
    )
  )
  (vla-get-name b)
)
(mapcar
   '(lambda (c)
      (vla-put-color blkobj 256)
    )
   (vlax-invoke b 'getattributes)
)
       )
     )
     (princ (strcat "\n Block "
    (vla-get-name b)
    " on locked layer "
    (vla-get-layer b)
    " not updated..."
    )
     )
   )
)
ss
      )
    )
  )
  (princ)
)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Block on layer zero without moving the attributes
« Reply #2 on: April 08, 2011, 08:34:28 AM »
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: Block on layer zero without moving the attributes
« Reply #3 on: April 08, 2011, 09:02:50 AM »
Another example - will move block objects and attributes to an arbitrary layer (currently set to layer "0") and with color ByLayer:

Code: [Select]
([color=BLUE]defun[/color] c:Ins2Layer ( [color=BLUE]/[/color] acblk acdoc acsel done layer name ) ([color=BLUE]vl-load-com[/color])
  [color=GREEN];; Example © Lee Mac 2011  -  www.lee-mac.com[/color]
 
  ([color=BLUE]setq[/color] acdoc ([color=BLUE]vla-get-ActiveDocument[/color] ([color=BLUE]vlax-get-acad-object[/color]))
        acblk ([color=BLUE]vla-get-Blocks[/color] acdoc)
  )
  ([color=BLUE]setq[/color] layer [color=MAROON]"0"[/color]) [color=GREEN];; Layer for Block Objects[/color]

  ([color=BLUE]if[/color] ([color=BLUE]ssget[/color] [color=MAROON]"_:L"[/color] '((0 . [color=MAROON]"INSERT"[/color])))
    ([color=BLUE]progn[/color]
      ([color=BLUE]vlax-for[/color] block ([color=BLUE]setq[/color] acsel ([color=BLUE]vla-get-ActiveSelectionSet[/color] acdoc))
        ([color=BLUE]foreach[/color] attrib
          ([color=BLUE]append[/color] ([color=BLUE]vlax-invoke[/color] block 'getattributes) ([color=BLUE]vlax-invoke[/color] block 'getconstantattributes))
          ([color=BLUE]vla-put-layer[/color] attrib layer)
          ([color=BLUE]vla-put-color[/color] attrib [color=BLUE]acbylayer[/color])
        )
        ([color=BLUE]if[/color] ([color=BLUE]not[/color] ([color=BLUE]member[/color] ([color=BLUE]setq[/color] name ([color=BLUE]vla-get-name[/color] block)) done))         
          ([color=BLUE]vlax-for[/color] object ([color=BLUE]vla-item[/color] acblk ([color=BLUE]car[/color] ([color=BLUE]setq[/color] done ([color=BLUE]cons[/color] name done))))
            ([color=BLUE]vla-put-layer[/color] object layer)
            ([color=BLUE]vla-put-color[/color] object [color=BLUE]acbylayer[/color])
          )
        )
      )
      ([color=BLUE]vla-delete[/color] acsel) ([color=BLUE]vla-regen[/color] acdoc [color=BLUE]acallviewports[/color])
    )
  )
  ([color=BLUE]princ[/color])
)

Hugo

  • Bull Frog
  • Posts: 431
Re: Block on layer zero without moving the attributes
« Reply #4 on: April 08, 2011, 12:57:39 PM »
Thanks Lee

But should he not change the shading, otherwise ok



Danke Lee

Aber die Schraffur sollte er nicht ändern, sonst ok


Hugo

  • Bull Frog
  • Posts: 431
Re: Block on layer zero without moving the attributes
« Reply #5 on: April 08, 2011, 01:33:42 PM »
You may want to look at this one too:
http://www.cadtutor.net/forum/archive/index.php/t-47075.html


Thanks CAB
Also not what I want.

Danke CAB
Auch nicht das was ich suche.


Hugo

  • Bull Frog
  • Posts: 431
Re: Block on layer zero without moving the attributes
« Reply #6 on: April 12, 2011, 09:59:02 AM »
Hello

I Can not Help the the hatch is not changed.
Thanks

Hallo

Kann mir keiner Helfen das die Schraffur nicht geändert wird.
Danke