- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I am sure someone will make this look easy, but I am having a hard time getting it to work. Bascially I want to create a WP selection set from an existing polyline that the user picks. The selectionset should select everything inside of the closed polyline.
Here is what I have so far:
Dim acDoc As Document = Application.DocumentManager.MdiActiveDocument
Dim acCurDb As Database = acDoc.Database
Dim acEd As Editor = DocumentManager.MdiActiveDocument.Editor
'' Start a transaction
Using acTrans As Transaction = acCurDb.TransactionManager.StartTransaction()
'' Lock the document
Dim acDocLock As DocumentLock = acDoc.LockDocument
Try
'' Pick Layout line (Polyline)
Dim acPlin As Polyline
'' Define prompt options
Dim acPrmptPl As New EditorInput.PromptSelectionOptions
acPrmptPl.AllowDuplicates = False
acPrmptPl.SinglePickInSpace = True
acPrmptPl.SingleOnly = True
acPrmptPl.AllowSubSelections = False
acPrmptPl.RejectObjectsFromNonCurrentSpace = True
acPrmptPl.MessageForAdding = (vbLf & "Select panel polyline:")
Dim acTypdVal(0) As TypedValue
acTypdVal(0) = New DatabaseServices.TypedValue(0, "LWPOLYLINE")
Dim myFilterPl As New EditorInput.SelectionFilter(acTypdVal)
Dim acPSRPl As PromptSelectionResult
RePick2:
acPSRPl = acEd.GetSelection(acPrmptPl, myFilterPl)
'' If selection is ok, then continue
If acPSRPl.Status = PromptStatus.OK Then
For Each acObjId As ObjectId In acPSRPl.Value.GetObjectIds
acPlin = acObjId.GetObject(OpenMode.ForRead)
Next
Dim pnts As New Point3dCollection()
For Each ver As Vertex2d In acPlin
pnts.Add(ver.Position)
Next
Dim Polygon As New Point3dCollection(pnts)
Dim PolyPrompt_res As PromptSelectionResult = acEd.SelectWindowPolygon(Polygon)
I cannot seem to get a 3d collection of points from a polyline. I have tried a few different things like converting the polyline to a polyline3D, but no luck.
My assumptions are that I need to get the colection of vertices from the polyline. Then, I need a new collection of points to create the Window Polygon. I pass those points to the SelectWindowPolygon method to get my selection window. From there I do stuff! 🙂
I think I may be going about this the wrong way. And ideas?
TIA!
Solved! Go to Solution.