Message 1 of 4
Avoid writing annotations on top of shown geometry - DrawingView/FindUsingRay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I would like to add some leaders to a drawingview. I don't want to put them on top of my part. So I would like to test if a given point on the sheet conflicts with any shown geometry. I use FindUsing Ray for that. But my problem is to define the sheet as a clipping plane. My current code also finds intersections "behind my back":
'For Each Leader In ActiveSheet.Sheet.DrawingNotes.LeaderNotes ' Leader.delete 'Next Dim view As DrawingView view=ActiveSheet.View("A").View Dim modelDoc As PartDocument = ThisDrawing.ModelDocument Dim compo As PartComponentDefinition compo = modelDoc.ComponentDefinition For Each dc As DrawingCurve In view.DrawingCurves Dim oLeaderPoints As ObjectCollection oLeaderPoints = ThisApplication.TransientObjects.CreateObjectCollection Dim txtPt2D = ThisApplication.TransientGeometry.CreatePoint2d(dc.MidPoint.X -1, dc.MidPoint.Y -1) Dim Line3D As Line = view.SheetToModelSpace(txtPt2D) Dim FoundEntities As ObjectsEnumerator Dim LocationPoints As ObjectsEnumerator Call compo.FindUsingRay(Line3D.RootPoint,Line3D.Direction ,0.0001,FoundEntities, LocationPoints) Dim txt As String If FoundEntities.Count>0 Then txt="Leader/solid conflict" Else txt ="Leader ok" End If oLeaderPoints.Add(txtPt2D) Call oLeaderPoints.Add(dc.MidPoint) Dim oLeaderNote As LeaderNote oLeaderNote = ActiveSheet.Sheet.DrawingNotes.LeaderNotes.Add(oLeaderPoints, txt) Next
Can I in any better way see if a point on the sheet is on top of shown geometry?