Tharwat Posted July 2, 2012 Share Posted July 2, 2012 Suggest you swap the order. Select object first then prompt for color: Why you wanna swap the order for the input ? Current code lost the ability to recognize Effective name against anonymous name on selection: Are you sure ? Quote Link to comment Share on other sites More sharing options...
pBe Posted July 2, 2012 Share Posted July 2, 2012 Why you wanna swap the order for the input ? It doesnt make sense to select a color if there are no objects selected Are you sure ? Aboslutely , if you happen to select a block with anonymous name [DB blocks], thats the only block updated and worse if it has attributes its hosed. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 2, 2012 Share Posted July 2, 2012 It doesnt make sense to select a color if there are no objects selected Even if you have selected nothing after choosing the colour , codes would run for nothing to do / which is in the safe way . Aboslutely , if you happen to select a block with anonymous name [DB blocks], that s the only block updated and worse if it has attributes its hosed. I did not go that far because the OP question was not indicating to that kind of blocks . But it is not that difficult to add some functions to get the effective name of the DB then cycle through entities to change the color or vlax-invoke 'Getattributes to change the color of attributes as I have used them in mine . EDIT: by the use of my sub-routines (ExploreBlocks) (PaintTheWorld ) . Quote Link to comment Share on other sites More sharing options...
pBe Posted July 2, 2012 Share Posted July 2, 2012 Even if you have selected nothing after choosing the colour , codes would run for nothing to do / which is in the safe way . Exactly my point. so the time spent selecting the color is all for nothing I did not go that far because the OP question was not indicating to that kind of blocks . Better have and not need than need and not have. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 2, 2012 Share Posted July 2, 2012 Better have and not need than need and not have. So we should think of commercial programs all the time when we being in need of any codes . Quote Link to comment Share on other sites More sharing options...
pBe Posted July 2, 2012 Share Posted July 2, 2012 (edited) So we should think of commercial programs all the time when we being in need of any codes . Well. not really, you did say "efficient" did you not? Dont worry about it Tharwat. Cheers dude. BTW: it looks as if the slected blocks does indeed have an attribute. you assign the color not just once but twice might as well loose these lines (foreach x (vlax-invoke (vlax-ename->vla-object sn) 'Getattributes ) (vla-put-color x color) ) Edited July 2, 2012 by pBe Quote Link to comment Share on other sites More sharing options...
sammyteacake Posted September 27, 2012 Share Posted September 27, 2012 For what it's worth, attached is my take on this task. The attached program will allow the user to modify the colour property of all objects (residing on unlocked layers) within multiple blocks defined in a drawing. The program will work with standard, attributed and dynamic blocks. Lee This is the perfect piece of code which will revolutionise the way we produce drawings in our office - just wanted to say a huge thank you to you Lee, brilliant stuff, as always. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 27, 2012 Share Posted September 27, 2012 This is the perfect piece of code which will revolutionise the way we produce drawings in our office - just wanted to say a huge thank you to you Lee, brilliant stuff, as always. You're very welcome sammy - I'm delighted to hear that you can make use of the program in your office. Cheers! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.