Jump to content

How to extract the selection set for w block and modify it


Recommended Posts

Posted
Alanjt , Your routine would change the color in Layer's list but it wont effect at the selected Block at all.

 

Thanks

No, it only changes the color of the block on a primary object level. Yours changes the color of everything. Did you even test this?

  • Replies 29
  • Created
  • Last Reply

Top Posters In This Topic

  • alanjt

    9

  • raj

    8

  • NHM

    6

  • Tharwat

    5

Top Posters In This Topic

Posted
alanjt thanks man this indeed solves my problem i am go on writing a rotine for this

 

thank

Post back if you have any questions and no more double-posting.

Posted

alanjt i got stuck to do so i need a block to b there

 

now i need to take a colour and put the block into the chossen color and then inserted the block

 

last post one only changed the color in the layer list but not changed on the block

Posted
alanjt i got stuck to do so i need a block to b there

 

now i need to take a colour and put the block into the chossen color and then inserted the block

 

last post one only changed the color in the layer list but not changed on the block

First off, stop setting all text to bold.

Just post an example block. I keep telling you the level at which the block color will change and you keep saying it works and then it doesn't work.

If the objects within a block are set to ByLayer, then changing the color of the block (at an object level) will NOT change the color of objects within the block - the objects HAVE TO HAVE THEIR COLOR SET TO BYBLOCK.

Posted
Yours changes the color of everything. Did you even test this?

 

Yeah that's right ... and I still looking for the reason.

 

What you think ?

Posted
Yeah that's right ... and I still looking for the reason.

 

What you think ?

It steps through the entire drawing collection and sets the color. If you want edit each object within the block definition, you need to vlax-for through (vla-item (vla-get-blocks...) ).

 

Your routine find the block name, but compares it to nothing, it just steps through the block collection and changes the color of everything.

Posted

Alan's program works very well and fine.... I tested it but the pre-requisite being that at primary level if the blocks are already assigned Object Color Or ByLAYER Color then it won't change the color of those selected Blocks but else if the objects within the Block are assigned BYBLOCK Color then they are bound to change by the use of the program compiled by ALAN....

Posted
Alan's program works very well and fine.... I tested it but the pre-requisite being that at primary level if the blocks are already assigned Object Color Or ByLAYER Color then it won't change the color of those selected Blocks but else if the objects within the Block are assigned BYBLOCK Color then they are bound to change by the use of the program compiled by ALAN....

 

Please do remember Raj... My code is no diferent from Alan's.. It's just a different approach and more conventional or traditional way of doing the same.. Alan's code is more refined... Hence the choice is entirely yours of which to use....

 

More importantly the end result shall be the same... and both the codes shall work very well on Dynamic Blocks too... The color property of the blocks should be set to BYBLOCK only then you shall get the desired result from my routine or ALAN's ....

 

(defun C:BlockColor ()

(setq ent (entsel "SELECT OLD BLOCK..."))

(vl-load-com)

(setq cosmode1 (getvar "osmode"))

(setq clyr1 (getvar "clayer"))

(setq cclr1 (getvar "cecolor"))

(setq clt1 (getvar "celtype"))

(setq ormode1 (getvar "orthomode"))

(if (/= ent nil)

(progn

(setq Blockcolor (getint "\nEnter Color of the Block to be assigned (INTEGERAL VALUE):"))

(setq blockname (cdr (assoc 2 (entget (car ent)))))

(setq location (vl-string-search "*" blockname))

(if (or (= location nil) (= location 0))

(progn

(setq ss (ssget (list (cons 0 "INSERT"))))

(setq no (sslength ss))

(setq i 0)

(repeat no

(setq ename (ssname ss i))

(setq ent1 (entget ename))

(setq vlobj (vlax-ename->vla-object ename))

(setq oricolor (vlax-get-property vlobj 'Color))

(setq newcolor (vlax-put-property vlobj 'Color Blockcolor))

(entupd (ssname ss i))

(setq i (+ i 1))

);end repeat

(command "regen")

);end progn

);end if

);end progn

);end if

(command "REGEN")

(princ)

(setvar "clayer" clyr1)

(setvar "osmode" cosmode1)

(setvar "celtype" clt1)

(setvar "cecolor" cclr1)

(setvar "orthomode" ormode1)

(princ)

);end of defun BlockColor

(prompt "\n Edit Block Color Depending upon Integeral Value Entered = BlockColor")

(princ)

Posted

Hello GUYS.

 

But how to change the color of the Layer which the selected block lays on ?

 

So that would be better than change the color in Layer 's color list. Agree ?

Posted
Hello GUYS.

 

But how to change the color of the Layer which the selected block lays on ?

Even if the selected Blocks Lays on X Layer, what is important is while creating the Block the entities comprising the BLOCK are on what Layer... That's utmost important... since even if one changes the layer color in which the Block is placed it shall show no change unless and until the entities comprising the Block were created in 0 Layer or bear the color BYBLOCK

 

 

So that would be better than change the color in Layer 's color list. Agree ?

 

 

hence you shall end up with no change in Block Color even if you change the color of the Layer in Layer's color list....

 

Hope this suffices your queries....

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...