Community
I am using following lisp code to select line object by single point.
(setq pt (getpoint "\nPick a point")) (setq ss (ssget pt))
What is the .Net equivalent to achieve this? (select object by a single point I provide)
Thanks in advance.
Solved! Go to Solution.
Solved by Hallex. Go to Solution.
Try this code snip:
Dim ppo As New PromptPointOptions(vbLf & "Pick a Point: ") Dim ppr As PromptPointResult ppr = ed.GetPoint(ppo) If ppr.Status <> PromptStatus.OK Then ed.WriteMessage(vbCrLf & "wrong point specification!") Exit Sub End If Dim p As Point3d = ppr.Value '------------------------------------------------------------'' Dim vd As Vector3d = New Vector3d(1e-4, 1e-4, 1e-4) '<-- dicrease a fuzz to suit Dim pMin As Point3d = p - vd Dim pMax As Point3d = p + vd Dim tvs() As TypedValue = New TypedValue() { New TypedValue(0, "line")} Dim points As Point3dCollection = New Point3dCollection points.Add(pMin) points.Add(pMax) Dim sf As SelectionFilter = New SelectionFilter(tvs) Dim sres As PromptSelectionResult = ed.SelectFence(points, sf) If sres.Status <> PromptStatus.OK Then ed.WriteMessage("\nWrong selection!") Return End If If sres.Value.Count = 0 Then ed.WriteMessage("\nNothing selected!") Return End If '' cast entity as Line Dim eid As ObjectId = sres.Value.GetObjectIds(0) Dim ent As Entity = TryCast(tr.GetObject(eid, OpenMode.ForRead), Entity) ''-----------------------------------------------------------'' Dim ln As Line = TryCast(ent, Line) If ln IsNot Nothing Then ed.WriteMessage(vbLf + "{0},{1},{2}", ln.StartPoint.X, ln.StartPoint.Y, ln.StartPoint.Z) End If
You can also look at this post: http://through-the-interface.typepad.com/through_the_interface/2006/11/two_methods_for.html