TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Mystogan on May 31, 2019, 05:27:12 AM

Title: Double Tag in EVERY DWG
Post by: Mystogan on May 31, 2019, 05:27:12 AM
Hi to all,

Would like to know if there's a way that LISP can give a summary of double tag(I'm referring to text values, attribute value, Mtext) in one dwg file then proceed to another dwg file and give another summary list.

It would better about the execution it will produce excel file.

Thank you in advance.


Title: Re: Double Tag in EVERY DWG
Post by: kpblc on May 31, 2019, 05:38:11 AM
The start point could be found at http://www.theswamp.org/index.php?topic=55217.msg594740#msg594740
Title: Re: Double Tag in EVERY DWG
Post by: roy_043 on May 31, 2019, 06:33:28 AM
What is a 'double tag'?
Title: Re: Double Tag in EVERY DWG
Post by: Lee Mac on May 31, 2019, 03:05:38 PM
What is a 'double tag'?

I'm guessing multiple annotation objects with the same text content.
Title: Re: Double Tag in EVERY DWG
Post by: Mystogan on June 02, 2019, 11:31:20 PM
What is a 'double tag'?

I'm guessing multiple annotation objects with the same text content.


Yes, that's correct...

Hope you can help me

Thank you in advance
Title: Re: Double Tag in EVERY DWG
Post by: BIGAL on June 09, 2019, 06:13:10 AM
If you do a ssget with *text that handles mtext and text then make a list of the text and the entity name then do a sort. next step is compare two items sequentially in the list if they match get further details and write a csv file etc. this stores the handle id which can be used to retrieve object data. use (handent "handle id") to

Here is a start

Code: [Select]
(setq ss (ssget "x" (list (cons 0 "*text"))))
(setq lst '())
(repeat (setq x (sslength ss))
(setq ent (entget (ssname ss (setq x (- x 1)))))
(setq lst (cons (list (cdr (assoc 1 ent)) (cdr (assoc 5 ent))) lst))
)
(setq lst (vl-sort lst
             (function (lambda (e1 e2)
                         (< (car e1) (car e2)))))
)
(setq x 0)
(setq t1 (nth 0 (nth 0 lst)))
(repeat (- (length lst) 1)
(setq t2 (nth 0 (nth (+ x 1) lst)))
(if (= t1 t2)
(progn
(alert (strcat "match found \n \n do write csv here\n \n" t1))
(setq t1 t2)
)
(progn
(setq t1 t2)
)
)
(setq x (+ x 1))
)

Code: [Select]
(setq ent (entget (handent "handle id"))) ; to retrieve object data
Title: Re: Double Tag in EVERY DWG
Post by: Mystogan on June 12, 2019, 10:42:50 PM
If you do a ssget with *text that handles mtext and text then make a list of the text and the entity name then do a sort. next step is compare two items sequentially in the list if they match get further details and write a csv file etc. this stores the handle id which can be used to retrieve object data. use (handent "handle id") to

Here is a start

Code: [Select]
(setq ss (ssget "x" (list (cons 0 "*text"))))
(setq lst '())
(repeat (setq x (sslength ss))
(setq ent (entget (ssname ss (setq x (- x 1)))))
(setq lst (cons (list (cdr (assoc 1 ent)) (cdr (assoc 5 ent))) lst))
)
(setq lst (vl-sort lst
             (function (lambda (e1 e2)
                         (< (car e1) (car e2)))))
)
(setq x 0)
(setq t1 (nth 0 (nth 0 lst)))
(repeat (- (length lst) 1)
(setq t2 (nth 0 (nth (+ x 1) lst)))
(if (= t1 t2)
(progn
(alert (strcat "match found \n \n do write csv here\n \n" t1))
(setq t1 t2)
)
(progn
(setq t1 t2)
)
)
(setq x (+ x 1))
)

Code: [Select]
(setq ent (entget (handent "handle id"))) ; to retrieve object data

Hi BIGAL,

Thank you for the initiative of the code. Unfortunately I have no idea on where to put and completely rewrite your code that can give me a command/execution key
Title: Re: Double Tag in EVERY DWG
Post by: roy_043 on June 13, 2019, 09:53:07 AM
IMO the definition of a 'double tag' is still unclear.
Example:
There are 10 columns in a plan that all have an mtext annotation identifying their dimensions as "300x300".
Should 9 mtext objects be removed?
Title: Re: Double Tag in EVERY DWG
Post by: Lee Mac on June 13, 2019, 12:42:31 PM
There are 10 columns in a plan that all have an mtext annotation identifying their dimensions as "300x300".
Should 9 mtext objects be removed?

And if so, which 9?
Title: Re: Double Tag in EVERY DWG
Post by: Mystogan on June 13, 2019, 10:07:02 PM
IMO the definition of a 'double tag' is still unclear.
Example:
There are 10 columns in a plan that all have an mtext annotation identifying their dimensions as "300x300".
Should 9 mtext objects be removed?

Hi sir roy_043
To make a more clear perspective of the intent is like. In using command Find in autocad it will give you list of exact word/letter that you want to look for and you notice there is two or more same work/letter. That's what I want that list of word.

In other command of autocad known as data extraction here you can have a list of block value/mtext/text etc.,This is what I'm looking a summary of value. The command key should be extract only the block value/mtext/text. With this command you don't need check/uncheck other function in data extraction.

It is posibble?
Title: Re: Double Tag in EVERY DWG
Post by: roy_043 on June 14, 2019, 04:25:21 AM
@Mystogan:
Comparing what you want to _Find and _DataExtraction is not very clear as these commands are quite different.
Title: Re: Double Tag in EVERY DWG
Post by: BIGAL on June 19, 2019, 02:16:35 AM
So you want how many "300x300" occurs but done for every word combo ?
Title: Re: Double Tag in EVERY DWG
Post by: Mystogan on June 20, 2019, 11:33:55 PM
So you want how many "300x300" occurs but done for every word combo ?

yes
Title: Re: Double Tag in EVERY DWG
Post by: Lee Mac on June 21, 2019, 08:00:41 AM
Here's an old program which may help: Text Counter (http://lee-mac.com/tcount.html)
Title: Re: Double Tag in EVERY DWG
Post by: Mystogan on June 27, 2019, 03:59:36 AM
Here's an old program which may help: Text Counter (http://lee-mac.com/tcount.html)

This is what am looking for Thank you very much sir Lee Mac