Can not select objects crossing an arc with ssget "F" neither ssget "CP" ?

Can not select objects crossing an arc with ssget "F" neither ssget "CP" ?

mbark_achka2421
Observer Observer
642 Views
9 Replies
Message 1 of 10

Can not select objects crossing an arc with ssget "F" neither ssget "CP" ?

mbark_achka2421
Observer
Observer

Having a polyline with arcs, I am using ssget "F" or ssget "CP" to select all objects crossing this polyline, but I noticed that some small objects intersecting some arcs in the pline were not selected !

 

 

 

(setq pr (fix (vlax-curve-getendparam pl)))
(setq lst '()) 
setq i 0)
      (repeat (1+ pr)
        (setq lst (cons (list (car (vlax-curve-getpointatparam pl i)) (cadr (vlax-curve-getpointatparam pl i))) lst) 
        i (1+ i)
	      )
      )
  (setq sel2 (ssget "_F" lst  '((410 . "Model") (-4 . "<or") (0 . "LINE") (0 . "POLYLINE") (0 . "LWPOLYLINE") (-4 . "or>"))))

 

 

 

0 Likes
643 Views
9 Replies
Replies (9)
Message 2 of 10

Kent1Cooper
Consultant
Consultant

That's because a selection Fence goes only in straight lines between points.  You may also find that in addition to not finding some things you want, it selects some things that are not crossed by the Polyline's arc segments, [but that are crossed by the straight chords across them].

 

With some Searching, you will find Topics in this Forum about improving on that, basically breaking up arc segments into multiple short straight pieces [not actually breaking them up, but putting multiple location points along them into the Fence list, in addition to the vertex locations].

Kent Cooper, AIA
0 Likes
Message 3 of 10

CodeDing
Advisor
Advisor

@mbark_achka2421 ,

 

Also, perhaps you could look into the FASTSEL (FS) Command. It sounds like what you are trying to accomplish.

 

https://help.autodesk.com/view/ACD/2024/ENU/?guid=GUID-A4FBF4EC-DE23-46A2-A576-AEED0E9847D4 

 

Best,

0 Likes
Message 4 of 10

john.uhden
Mentor
Mentor

@mbark_achka2421 ,

As @Kent1Cooper pointed out, the points you are using for the fence create straight lines only, from point to point.  So either...

1.  If you are manually picking the fence points, then don't cut any corners.

2. I f you are using a predrawn polyline, then add a bundle of points along any bulged segment.  You don't have to add points to the polyline itself.  Just compute the points and add them in order to the list you are providing for the fence points.  Bear in mind that this method only increases your chances of including objects in your selection set since the fence line will (and must) be made up of all chords, not curves.  It's up to you to decide what accuracy will provide you suitable results.

John F. Uhden

0 Likes
Message 5 of 10

Sea-Haven
Mentor
Mentor

Another gotcha is dashed lines a ssget "F" can go through a gap and not find it, yes there is a variable to set so it treats dashed lines as continuous and I keep forgetting it. Some one help.

0 Likes
Message 6 of 10

Kent1Cooper
Consultant
Consultant

It's called >LTGAPSELECTION<.  But even with that turned on, there is yet another possibility for missing something you want selected:  if the Fence line goes through a gap between words or even between letters in a Text/Mtext object, the selection will not "see" it, but needs to hit some actual drawn element of it in order for it to be selected.  LTGAPSELECTION doesn't get around that one.

Kent Cooper, AIA
Message 7 of 10

john.uhden
Mentor
Mentor

Thanks, @Kent1Cooper ,

I am near the end of a routine to select objects by fence drawn as a polyline.

Now that I know about this phenomenon, I will temporarily change the polyline's linetype to Continuous.  Umm, but can that linetype possibly be redefined (to include gaps)?

Oh blast it all.  My polyline fence could sneak through gaps in the target objects. 😧

But it gets even worse... intersectwith won't find an intersection either.  You would think that the AutoCAD coders would determine an intersection mathematically, but alas, I guess not.  Now, I have a few ancient functions I wrote like arc-line-intersect and arc-arc-intersect but they would be seriously cumbersome replacements for (ssget "F" ...) and ssnamex, especially if entities are at differing elevations.  The only workaround I can think of is to temporarily change all the targets' linetypes to Continuous before finding the intersections and putting them back afterward, but then how do you ascertain what the targets will be before you run the fence?  Well I guess you could change all the curves' linetypes and put them back afterword, but that could be a lot of overhead.  😵

Don't get me wrong.  I sincerely appreciate your advising me of LTGAPSELECTION, but as I read the Help it appears that it applies to only selection, not to computing intersections.  Anyway, it had been turned ON (the default).

John F. Uhden

0 Likes
Message 8 of 10

mbark_achka2421
Observer
Observer
That's a great solution! HOWEVER: I cannot include it inside a Lisp:
I think this is how can this be called in Lisp:
(C:FS)
So we can not pass our entity as a parameter to (C:FS)
Any idea?
Thanks!
0 Likes
Message 9 of 10

Kent1Cooper
Consultant
Consultant

@mbark_achka2421 wrote:
.... we can not pass our entity as a parameter to (C:FS) ....

If the Fence object is the last thing drawn, this has worked sometimes but not always [in very limited testing], so I don't know what the issue is, but maybe it can be corrected:

(vla-sendcommand (vla-get-activedocument (vlax-get-acad-object)) "fs l  ")

Whether feeding it something like a variable name for an entity would work, for use with something other than the last object drawn, I'm not sure [I would want it to be working consistently, first].

Kent Cooper, AIA
0 Likes
Message 10 of 10

mbark_achka2421
Observer
Observer
Thanks,
The object is in a lisp variable, maybe it is a (setq Ent (ssname MySS 11))
I am not sure if this Ent variable could be passed using vla-sendcommand ?
0 Likes