Jump to content

Recommended Posts

Posted

Hi All.

 

I am trying to achieve the following:

for example... in 100 floor plans there are blocks that have certain attribute values. i want to be able to create a script/lisp that will find all blocks that include a certain piece of text ie "window" in the attribute value and change the block to a certain colour.

 

Essentially it is the same way that the "FIND" command works but via command line/lisp/script etc instead. This will be so i can apply this specific task without user input on the 100 floor plans.

 

Is there a way to do this as ive searched hundreds of terms/forums/ideas etc and came up with only find and replace tools or change all text in a drawing to certain colour.

 

Your help is greatly appreciated =]

Posted

Totally untested :

 

[b][color=BLACK]([/color][/b]defun c:chbyav [b][color=FUCHSIA]([/color][/b]/ bn nc ss i en ed an ad ch[b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]setq bn [color=#2f4f4f]"*"[/color]        [color=#8b4513];BLOCK Name search[/color]
       av [color=#2f4f4f]"window"[/color]   [color=#8b4513];ATTRIBute Value search[/color]
       nc 5[b][color=FUCHSIA])[/color][/b]         [color=#8b4513];New Color[/color]
 [b][color=FUCHSIA]([/color][/b]and [b][color=NAVY]([/color][/b]setq ss [b][color=MAROON]([/color][/b]ssget [color=#2f4f4f]"X"[/color] [b][color=GREEN]([/color][/b]list [b][color=BLUE]([/color][/b]cons 0 [color=#2f4f4f]"INSERT"[/color][b][color=BLUE])[/color][/b]
                                [b][color=BLUE]([/color][/b]cons 2 bn[b][color=BLUE])[/color][/b]
                                [b][color=BLUE]([/color][/b]cons 66 1[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b]
       [b][color=NAVY]([/color][/b]setq i 0[b][color=NAVY])[/color][/b]
       [b][color=NAVY]([/color][/b]while [b][color=MAROON]([/color][/b]setq en [b][color=GREEN]([/color][/b]ssname ss i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              [b][color=MAROON]([/color][/b]setq ed [b][color=GREEN]([/color][/b]entget en[b][color=GREEN])[/color][/b]
                    an [b][color=GREEN]([/color][/b]entnext en[b][color=GREEN])[/color][/b]
                    ad [b][color=GREEN]([/color][/b]entget an[b][color=GREEN])[/color][/b]
                    ch nil[b][color=MAROON])[/color][/b]
              [b][color=MAROON]([/color][/b]while [b][color=GREEN]([/color][/b]= [color=#2f4f4f]"ATTRIB"[/color] [b][color=BLUE]([/color][/b]cdr [b][color=RED]([/color][/b]assoc 0 ad[b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                     [b][color=GREEN]([/color][/b]and [b][color=BLUE]([/color][/b]wcmatch [b][color=RED]([/color][/b]strcase [b][color=PURPLE]([/color][/b]cdr [b][color=TEAL]([/color][/b]assoc 1 ad[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b]
                                   [b][color=RED]([/color][/b]strcase [b][color=PURPLE]([/color][/b]strcat [color=#2f4f4f]"*"[/color] av [color=#2f4f4f]"*"[/color][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b]
                          [b][color=BLUE]([/color][/b]setq ch T[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b]
                     [b][color=GREEN]([/color][/b]setq an [b][color=BLUE]([/color][/b]entnext an[b][color=BLUE])[/color][/b]
                           ad [b][color=BLUE]([/color][/b]entget an[b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              [b][color=MAROON]([/color][/b]and ch
                  [b][color=GREEN]([/color][/b]entmod
                     [b][color=BLUE]([/color][/b]if [b][color=RED]([/color][/b]assoc 62 ed[b][color=RED])[/color][/b]
                         [b][color=RED]([/color][/b]subst [b][color=PURPLE]([/color][/b]cons 62 nc[b][color=PURPLE])[/color][/b] [b][color=PURPLE]([/color][/b]assoc 62 ed[b][color=PURPLE])[/color][/b] ed[b][color=RED])[/color][/b]
                         [b][color=RED]([/color][/b]append ed [b][color=PURPLE]([/color][/b]list [b][color=TEAL]([/color][/b]cons 62 nc[b][color=TEAL])[/color][/b][b][color=PURPLE])[/color][/b][b][color=RED])[/color][/b][b][color=BLUE])[/color][/b][b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b]
              [b][color=MAROON]([/color][/b]setq i [b][color=GREEN]([/color][/b]1+ i[b][color=GREEN])[/color][/b][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b]
 [b][color=FUCHSIA]([/color][/b]prin1[b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

 

-David

Posted

Yeah i apologise for that. i wanted to rename the title as i didnt think this one was great, and then couldnt figure out how to delete and had allready created the other one.

 

Lesson Learnt. =]

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...