Not applicable
12-18-2012
12:19 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello.
How can I define a Point2D with my mouse by clicking on an random place in a drawingsheet?
I have made the code below that creates a DetailDrawingView automatic. I am now searching a method to select the oPoint & oCenterPoint with my mouse. Both are defined as Poin2D.
I find a lot a method's where you can manipulate the Point2D using maths but I never found a method where you can get the Point2D by just clicking somewhere on the sheet (drawingview).
Thanks for your help!
Sub AutoDetailedView() ' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet. Dim oSheet As Sheet Set oSheet = oDrawDoc.ActiveSheet ' Manually select a drawing view Dim oDrawingView As DrawingView Set oDrawingView = ThisApplication.CommandManager.Pick(kDrawingViewFilter, "Select a drawing view.") ' Set a reference to the center of the base view. Dim oPoint As Point2d Set oPoint = oDrawingView.Center ' Translate point by a distance = 2 * width of the view ' This will be the placement point of the detail view. oPoint.x = oPoint.x + 2 * oDrawingView.Width ' Set corner one of rectangular fence as ' the left-bottom corner of the base view. Dim oCenterPoint As Point2d Set oCenterPoint = oDrawingView.Center oCenterPoint.x = oCenterPoint.x - oDrawingView.Width / 10 oCenterPoint.Y = oCenterPoint.Y - oDrawingView.Height / 10 ' Get any linear curve from the base view Dim oCurve As DrawingCurve For Each oCurve In oDrawingView.DrawingCurves If oCurve.CurveType = kLineSegmentCurve Then Exit For Next ' Create an intent object Dim oAttachPoint As Point2d Set oAttachPoint = oDrawingView.Center ' Create the detail view Dim oDetailView As DetailDrawingView Set oDetailView = oSheet.DrawingViews.AddDetailView(oDrawingView, oPoint, kShadedDrawingViewStyle, True, oCenterPoint, 0.3, , 0.25, False, " ") 'Set breakline to smooth oDetailView.IsBreakLineSmooth = True 'Show full detail boundary oDetailView.DisplayFullBoundary = True 'Show connection line oDetailView.DisplayConnectionLine = True End Sub
Solved! Go to Solution.
Link copied