Jump to content

Recommended Posts

Posted

I hope i can found lisp or option when i make count in dwg the result going automaticaly to another dwg i mean the 2 dwg become with one link .

Posted

You mean you want to count how many text's contain something on one DWG and have the value shown in another DWG?

 

There's many ways: Through lisp you could look into something called ObjectDBX. Or without any programming place a table through Data Extraction. To name only 2 ways.

Posted

This should give you the core text counting algorithm for your needs:

 

([color=BLUE]defun[/color] c:test ( [color=BLUE]/[/color] alist e i ss )
 ([color=BLUE]if[/color]
   ([color=BLUE]setq[/color] ss
     ([color=BLUE]ssget[/color]
      '(
         (-4 . [color=MAROON]"<OR"[/color])
           (0 . [color=MAROON]"TEXT,MTEXT"[/color])
           (-4 . [color=MAROON]"<AND"[/color])
             (0 . [color=MAROON]"INSERT"[/color])
             (66 . 1)
           (-4 . [color=MAROON]"AND>"[/color])
         (-4 . [color=MAROON]"OR>"[/color])
       )
     )
   )
   ([color=BLUE]repeat[/color] ([color=BLUE]setq[/color] i ([color=BLUE]sslength[/color] ss))
     ([color=BLUE]setq[/color] e ([color=BLUE]ssname[/color] ss ([color=BLUE]setq[/color] i ([color=BLUE]1-[/color] i))))

     ([color=BLUE]if[/color] ([color=BLUE]eq[/color] [color=MAROON]"INSERT"[/color] ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 0 ([color=BLUE]entget[/color] e))))
       ([color=BLUE]setq[/color] alist (_CountAttributes e alist))
       ([color=BLUE]setq[/color] alist (_Assoc++ ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 1 ([color=BLUE]entget[/color] e))) alist))
     )
   )
 )
 alist
)

([color=BLUE]defun[/color] _Assoc++ ( key alist )
 (
   ([color=BLUE]lambda[/color] ( pair )
     ([color=BLUE]if[/color] pair
       ([color=BLUE]subst[/color] ([color=BLUE]list[/color] key ([color=BLUE]1+[/color] ([color=BLUE]cadr[/color] pair))) pair alist)
       ([color=BLUE]cons[/color]  ([color=BLUE]list[/color] key 1) alist)
     )
   )
   ([color=BLUE]assoc[/color] key alist)
 )
)

([color=BLUE]defun[/color] _CountAttributes ( entity alist )
 ([color=BLUE]while[/color]
   ([color=BLUE]not[/color]
     ([color=BLUE]eq[/color] [color=MAROON]"SEQEND"[/color]
       ([color=BLUE]cdr[/color]
         ([color=BLUE]assoc[/color] 0
           ([color=BLUE]entget[/color]
             ([color=BLUE]setq[/color] entity
               ([color=BLUE]entnext[/color] entity)
             )
           )
         )
       )
     )
   )
   ([color=BLUE]setq[/color] alist (_Assoc++ ([color=BLUE]cdr[/color] ([color=BLUE]assoc[/color] 1 ([color=BLUE]entget[/color] entity))) alist))
 )
)

I'll leave it to you with regards to manipulating the result.

Posted

Lee, would that work in an external file as well? I thought ObjectDBX doesn't work with selection sets :o

Posted
Lee, would that work in an external file as well? I thought ObjectDBX doesn't work with selection sets :o

 

No, just in the current drawing...

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