Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

entities nested in polylines

Status
Not open for further replies.

jremy68

Materials
Aug 12, 2004
4
Using VBA how would I be able to select all polylines in modelspace and "filter through" them leaving only those with a vertex from another polyline left on the screen. Any help would be greatly appriciated.
 
Replies continue below

Recommended for you

Well, if you know VBA enough. Create a filtered selection set of Polylines in model space. Then you will need to obtain the dimension for the visible screen. This has to be calculated and you will need to grab the center of the Window (VIEWCTR) and the Window width (VIEWSIZE). Then cycle through the vertices of the polylines and pull the ones meeting your criteria. Is this too general or were you looking for code snippets?

"Everybody is ignorant, only on different subjects." — Will Rogers
 
I was actually looking for code snippets because there are a lot of polylines which I need to filter through and also my knowlegde of VBA is not the greatest. I only know enough to get into trouble. I'm not sure if I understand exactly the approach that you have mentioned I will have to evaluate that. If you have any lines of code I would greatly appriciate it as a way to start with this problem. Thank you.
 
This should get you started...


Dim acSelSet As AcadSelectionSet
Dim acItem As AcadLWPolyline
Dim vntAcItems As Variant
Dim intCode() As Integer
Dim vntValue() As Variant
Dim vntVerts As Variant
Dim lCnt As Long
'--------------------------------------
ReDim intCode(3): ReDim vntValue(3)
intCode(0) = -4: vntValue(0) = "<AND"
intCode(1) = 0: vntValue(1) = "LWPOLYLINE" 'OBJECT TYPE
intCode(2) = 67: vntValue(2) = 0 'MODELSPACE
intCode(3) = -4: vntValue(3) = "AND>"

Set acSelSet = ThisDrawing.SelectionSets.Add("PLINESSET")

acSelSet.Select acSelectionSetAll, , , intCode, vntValue
For Each acItem In acSelSet
'--------------------------------------------------------------------------
'Get vertice list
'--------------------------------------------------------------------------
vntVerts = acItem.Coordinates
For lCnt = 0 To UBound(vntVerts)
'Figure out your vertice calcs here
MsgBox vntVerts(lCnt)
Next lCnt
Next acItem

"Everybody is ignorant, only on different subjects." — Will Rogers
 
so where do i head from this point. I threw that code in a simple sub and I am not sure what the result it is returning it seems like it is just returning the lenghths of the segments in the polyline.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor