@Anonymous wrote:
....
I wrote my code, but not exacty lst_ent_1, lst_ent_2, lst_ent_3. Pls tell me where is wrong ?
....
(command "UCS"
"3"
(cdr (assoc 14 (entget (car l))))
(cdr (assoc 13 (entget (car l))))
(cdr (assoc 10 (entget (car l))))
)
....
(setq lst_min
(vl-remove-if
'(lambda (e)
(> (cadr (trans (cdr (assoc 10 (entget e))) 0 1))
(cadr (trans (cdr (assoc 10 (entget (car lst)))) 0 1))
)
....
One problem may be in the red part. In an Aligned Dimension, the direction between the definition points [13 & 14] will always be the same as the direction of the dimension line [that's what defines that direction]. But it will not always be the same in a Rotated Dimension [which all but one of them in your sample drawing are]. That's why my code makes the distinction between the two types, and if the one it's using to change the UCS is a Rotated Dimension, uses its defined rotation angle [regardless of the definition point relationship], but if it's an Aligned Dimension, uses the 13-to-14 angle. That's also why it uses the UCS rotate-around-the-Z-axis option rather than the 3-point option.
Another possible problem may be in the blue part [and the similar part with the (<) function for lst_max]. The resulting extracted and translated Y coordinate values may vary way down at the 12th decimal place, or something, in which case (<) and (>) may read the relationships [between values you would consider equal] differently than you expect. That's why I didn't use the Y values directly themselves, but turned them into text strings with a specific number of decimal places, which rounds them off so that a comparison of not-truly-exactly-equal Y coordinates can find them to be equal enough to classify them as being in the same row. It could also be done with (equal) functions with fuzz factors.
Another comment: I didn't try these kinds of different situations, but mine should work with any number of rows of collinear dimensions, not just the 3 that yours seems designed for. Of course, your purposes may always be served with 3, so it may not matter.
[And a little warning about mine.... It doesn't localize the lst_ent_# variables, so that the resulting lists will be available to you afterwards. But that means that if you run it more than once in the same editing session of the same drawing, you should set those to nil first, or Dimensions from subsequent runs will be added into lists of those from earlier runs. That wiping out could be built into the beginning, if it makes sense to do it that way.]
Kent Cooper, AIA