wrha Posted May 30, 2011 Posted May 30, 2011 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 . Quote
irneb Posted May 30, 2011 Posted May 30, 2011 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. Quote
Lee Mac Posted May 30, 2011 Posted May 30, 2011 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. Quote
irneb Posted May 31, 2011 Posted May 31, 2011 Lee, would that work in an external file as well? I thought ObjectDBX doesn't work with selection sets Quote
Lee Mac Posted May 31, 2011 Posted May 31, 2011 Lee, would that work in an external file as well? I thought ObjectDBX doesn't work with selection sets No, just in the current drawing... Quote
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.