Author Topic: ssget filtering issue (mleaders)  (Read 6962 times)

0 Members and 1 Guest are viewing this topic.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
ssget filtering issue (mleaders)
« on: November 02, 2011, 01:20:39 PM »
Code: [Select]
(ssget "_:L" '((0 . "MULTILEADER") (174 . 2)))

The above code should only select MLeaders with a content type of 2 (has text), but for some strange reason, it will not select MLeaders. Does anyone have any ideas? Am I not allowed to use 100 codes in dxf filtering within ssget?


DXF Reference
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Jeff H

  • Needs a day job
  • Posts: 6144
Re: ssget filtering issue (mleaders)
« Reply #1 on: November 02, 2011, 02:16:54 PM »
Isn't Content type 172 and Text Angle Type 174?

ronjonp

  • Needs a day job
  • Posts: 7526
Re: ssget filtering issue (mleaders)
« Reply #2 on: November 02, 2011, 04:19:48 PM »
This works for me:

Code: [Select]
(ssget "_:L" '((0 . "MULTILEADER") (-4 . "<NOT") (304 . "") (-4 . "NOT>")))
If you're trying to select mleaders that have text.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: ssget filtering issue (mleaders)
« Reply #3 on: November 02, 2011, 05:15:12 PM »
Isn't Content type 172 and Text Angle Type 174?
Damn, you are correct, but that still doesn't work.

This works for me:

Code: [Select]
(ssget "_:L" '((0 . "MULTILEADER") (-4 . "<NOT") (304 . "") (-4 . "NOT>")))
If you're trying to select mleaders that have text.
Problem with that is, it won't ignore MLeaders where it includes a block or cannot include text (is just an arrow).


The following *should* only select mleaders that allow text, but it seems that, no matter what number you put in for dxf 172, it will only select mleaders that do not have a text object (I'm not talking about mleaders without text).
Code: [Select]
(ssget "_:L" '((0 . "MULTILEADER") (172 . 5)))

There has to be a way to filter them properly. I just want mleaders that have the textrotation property (ones with blocks and ones that can't include text don't have that property).
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7526
Re: ssget filtering issue (mleaders)
« Reply #4 on: November 02, 2011, 05:30:51 PM »
Gotcha ...  please disregard  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: ssget filtering issue (mleaders)
« Reply #5 on: November 02, 2011, 05:33:39 PM »
So far, this is the only way I can get it to select only mleaders that have the text option and have a value for vla-get-textrotation.

Code: [Select]
(ssget "_:L" '((0 . "MULTILEADER") (-4 . "<NOT") (290 . 0) (-4 . "NOT>")))
Problem is, 290 is Enable Landing
http://docs.autodesk.com/ACD/2011/ENU/filesDXF/WS1a9193826455f5ffc751fd10f4618e369-5b2f.htm
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Jeff H

  • Needs a day job
  • Posts: 6144
Re: ssget filtering issue (mleaders)
« Reply #6 on: November 02, 2011, 06:07:06 PM »
I know nothing about lisp but trying to guess and assuming thingd this looks like it works so far
 
Code: [Select]
(ssget "_:L" '((0 . "MULTILEADER") (-4 . "=") (296 . 1)))
 

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: ssget filtering issue (mleaders)
« Reply #7 on: November 02, 2011, 08:22:18 PM »
I know nothing about lisp but trying to guess and assuming thingd this looks like it works so far
 
Code: [Select]
(ssget "_:L" '((0 . "MULTILEADER") (-4 . "=") (296 . 1)))
 
The (-4 . "=") isn't required (implied), but that's a good find and does ignore MLeaders with blocks. Sadly, it won't filter out Mleaders that do not allow text content. The only thing I can get to work is filtering out if (290 . 0) which doesn't make sense, but the DXF codes for MLeaders are retarded. If you extract the 296 code from a block content MLeader, it will return 1, however, if you filter ssget to select 1 it ignores block content MLeaders; you have to use 0 to select them. It's crazyness.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: ssget filtering issue (mleaders)
« Reply #8 on: November 02, 2011, 08:47:49 PM »
On a side note, I did find this interesting since I'd never come across a way to alter the rotation of the block within a MLeader. Sadly, it doesn't set the rotation of the landing like it does if you alter the text rotation.  :x


Code: [Select]
(defun c:Test (/ _angle ent bp gr ang)

  (defun _angle (p1 p2) (redraw) (grdraw p1 p2 1 -1) (angle p1 p2))

  (if (and (setq ent (car (entsel))) (eq (cdr (assoc 296 (entget ent))) 1))
    (progn (setq bp (trans (cdr (assoc 10 (entget ent))) 0 1))
           (while (eq (car (setq gr (grread T 15 0))) 5)
             (entmod (subst (cons 46 (_angle bp (cadr gr))) (assoc 46 (entget ent)) (entget ent)))
           )
    )
  )
  (redraw)
  (princ)
)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: ssget filtering issue (mleaders)
« Reply #9 on: November 03, 2011, 07:48:04 AM »
I think the ssget filtering is messed up when there are multiple occurrences of the same DXF code in the DXF Data.

This appears to work for my tests:

Code: [Select]
(sssetfirst nil (ssget "_X" '((0 . "MULTILEADER") (-4 . "<NOT") (290 . 1) (-4 . "NOT>"))))
Don't ask me why...

Chris

  • Swamp Rat
  • Posts: 547
Re: ssget filtering issue (mleaders)
« Reply #10 on: November 03, 2011, 08:04:14 AM »
I have found that working with dxf codes and multileaders almost never seems to give the desired result.  Perhaps a revision your code to select the mulitleaders, then use VLISP to create a new selectionset from that initial selectionset, only containing the mleaders that apply to the particular properties you desire.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: ssget filtering issue (mleaders)
« Reply #11 on: November 03, 2011, 08:28:45 AM »
I have found that working with dxf codes and multileaders almost never seems to give the desired result.  Perhaps a revision your code to select the mulitleaders, then use VLISP to create a new selectionset from that initial selectionset, only containing the mleaders that apply to the particular properties you desire.

That would be the workaround - to filter the MLeaders within the initial Selection by their Visual LISP properties; however, I can see why Alan would want to exactly tailor the ssget filter list since it may be misleading to the user as to which MLeaders are actually going to be processed by the routine (whatever that may be), since all MLeaders were highlighted and included in the initial selection.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: ssget filtering issue (mleaders)
« Reply #12 on: November 03, 2011, 08:36:31 AM »
I think the ssget filtering is messed up when there are multiple occurrences of the same DXF code in the DXF Data.

This appears to work for my tests:

Code: [Select]
(sssetfirst nil (ssget "_X" '((0 . "MULTILEADER") (-4 . "<NOT") (290 . 1) (-4 . "NOT>"))))
Don't ask me why...
See, the part that does make sense is, if I use yours or mine (only difference being 290 being 1 or 0, it still filters properly. Actually, If you put any number with the 290 ditted pair, it will only select MLeaders with the text property.  :ugly:

I have found that working with dxf codes and multileaders almost never seems to give the desired result.  Perhaps a revision your code to select the mulitleaders, then use VLISP to create a new selectionset from that initial selectionset, only containing the mleaders that apply to the particular properties you desire.

I could, but as Lee was saying, if I can filter everything at the source, why not attempt it to get it right?


Screw it. Unless someone comes forward saying that
Code: [Select]
(-4 . "<NOT")(290 . 0 or 1)(-4 . "NOT>") does not work for them, I'm using it.

Thank you all for testing and contributing your thoughts/ideas.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox