Author Topic: changing entities within a block  (Read 987 times)

0 Members and 1 Guest are viewing this topic.

Peter Smets

  • Mosquito
  • Posts: 1
changing entities within a block
« on: February 07, 2021, 12:58:40 PM »
Hello,

I regularly have a block with entities (color white, multiple linetypes) and (color yellow, multiple linetypes).
Now I am looking for a lisproutine that puts all the color white on layer "0" and the color BYBLOCK, LINE TYPE "BYBLOCK" and everything with the color yellow on a specified layer with the color "BYLAYER" LINTYPE "BYLAYER".
Who can help me with this?
ps. I don't know much about lisproutines

Greeting in advance

Peter Smets

BIGAL

  • Swamp Rat
  • Posts: 1430
  • 40 + years of using Autocad
Re: changing entities within a block
« Reply #1 on: February 07, 2021, 05:39:02 PM »
What is wrong with Bedit, or are you making a random block ?

Anyway not answer but an example.
Code: [Select]
(vlax-for block allblocks
   (if   (not (wcmatch (strcase (vla-get-name block) t) "*_space*"))
   (vlax-for   ent block
   (vla-put-color ent 0)
   (vla-put-linetype ent "Bylayer")
   (vla-put-lineweight ent aclnwtbyblock)
   ) ;_ end of vlax-for
      ) ;_ end of if
    ) ;_ end of vlax-for

Put some ifs in it.
A man who never made a mistake never made anything

Rustabout

  • Newt
  • Posts: 135
Re: changing entities within a block
« Reply #2 on: February 07, 2021, 07:08:55 PM »
If you're not up on your LISP than your best option might be creating visibility states within your blocks themselves.

Describing your problem in more detail might help as well. If you want to control the behavior of future block inserts, the above could be a viable solution. If you need to edit existing entities, then a LISP routine would likely get you there.