(Please note: This is not the same as the cpolygon or wpolygon. You have
to pick each individual point for that command. I just want to select the
line.)
Jason gave me the following lisp file (see below), but I don't know Lisp, so
I'm trying to translate it to VBA. I can select the polyline with the
SelectOnScreen command, and can select every entity within the drawing, but
am unsure how to test if the entity is within the boundary.
Has this already been done or am I reinventing the wheel?
TIA, -Kirsten
Lisp file:
(defun C:Test ()
(ssget "wp" (massoc 10 (entget (car (entsel "\nselect polyline:")))))
)
(defun massoc (key alist / x nlist)
(foreach x alist
(if (eq key (car x))
(setq nlist (cons (cdr x) nlist))
)
)
(reverse nlist)
)
Have you looked into the SelectionSet.SelectByPolygon method? It sounds
like exactly what you need. If you need help with the point retrieval,
there are a couple of web sites with good descriptions on getting LWPoly and
Polyline point lists.
A word of caution: I did something similar to that with lips a few years
back, but using the SSGET function of lisp, with the WP option (I think)
only picked up objects currently visible on-screen. If the user selected a
polyline that went beyond the current zoom scale, objects would be
potentially missed. I don't know if this is still true, or what would
eliminate the problem, but something to consider and test for. I just gave
up on it, because I didn't need it very often.
THT
To over come the object not on screen issue:
After selecting the polyline get its boundingbox and do a zoom centre on the
middle of the bounding box with a scale matching twice the diagonal length.
--
Laurie Comerford
CADApps
www.cadapps.com.au
"TomD" <nospam.dc...@stargate.net> wrote in message
news:A3ECAD2A97ADB524...@in.WebX.maYIadrTaRb...
> Kirsten <kirste...@co.anoka.mn.us> wrote in message
> news:F6409595ABA5F486...@in.WebX.maYIadrTaRb...
<snipped>
Here's a snippet of code that I wrote for an appication that does what
you want (I think). You might be able to use a similar technique:
varVertices = objPolyline.Coordinates
intFilterType(0) = 0
varFilter(0) = "TEXT"
varFilterType = intFilterType
varFilterData = varFilter
lngSelectMode = acSelectionSetCrossingPolygon
Set ssetBFText = ThisDrawing.SelectionSets.Add("BondFingerText")ssetBFText.SelectByPolygon
lngSelectMode, varVertices, _
varFilterType, varFilterData
What I have been doing is converting the Polyline into a Region then testing
all objects that fall within the BoundBox to see if they intersect. This
guaranties they are inside even arcs.
--
|
-+-------------------------------------------------
| Rob Starz
| Stardsign cad solutions
| AEC Designer / Consultant / Developer
| Arch Desktop tools www.stardsign.com/adtcadpacx.htm
| ******coming soon e-Training for ******
| programming Arch Desktop
| learn what you can do...with little input.
p.s.- sorry Tom, I didn't catch your response to the original post
before posting my own redundant version.
This will easily grab all objects even if there is an arc with a large
bulge.
<<Out of curiosity, under what circumstances would you want to select
enities that are contained in an existing polyline?
I use this for scheduling of items that are in a room area. Facility
Management software would use this also.
Works great on my end.
For civil/surveying, that type of thing can be handy quite often. One
example would be to select objects within boundary polyline to create
surface models from.
> p.s.- sorry Tom, I didn't catch your response to the original post
> before posting my own redundant version.
No problem. I'm not the best at conveying the thoughts in my scrambled
head, so most of my posts can't hurt a second perspective, even if it's
saying basically the same thing. ;)
Interesting topic (at least to me.)
I haven't used the BoundBox property at all, so if I'm mistaken about it
returning a rectangular area, by all means correct me.
Rob Starz <r...@stardsignNOSPAM.com> wrote in message
news:DFC4DA2D3FF2D003...@in.WebX.maYIadrTaRb...
Laurie Comerford <lau...@cadapps.com.au> wrote in message
news:EE342C30653D6669...@in.WebX.maYIadrTaRb...
I find it interesting as well ,,, makes me think :)
-Josh
Rob Starz <r...@stardsignNOSPAM.com> wrote in message
news:88128F407EF9BB58...@in.WebX.maYIadrTaRb...