Message 1 of 4
Create a detail drawing view defined by a workpoint.

Not applicable
05-24-2018
02:26 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
Looking to create a detail drawing view from a predefined workpoint
The workpoint (shown by red cross) needs to be the centre point of the detail window. I have found some code which will create the detail view but you need to manually select the drawing view. (see below)
SyntaxEditor Code Snippet
Sub Main CreateDetailView() ' Set a reference to the drawing document. ' This assumes a drawing document is active. Dim oDrawDoc As DrawingDocument oDrawDoc = ThisApplication.ActiveDocument ' Select a drawing view. Dim oDrawingView As DrawingView oDrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "select view") 'Set a reference to the active sheet. Dim oSheet As Sheet oSheet = oDrawingView.Parent ' Set a reference to the center of the base view. Dim oPoint As Point2d oPoint = oDrawingView.Center ' Translate point by a distance equal to the width of the view ' This will be the placement point of the detail view. oPoint.X = oPoint.X + oDrawingView.Width ' Arbitrarily find an arc within the selected drawing view. ' The detail view will include this arc. Dim oCurve As DrawingCurve Dim oArcCurve As DrawingCurve For Each oCurve In oDrawingView.DrawingCurves If oCurve.CurveType = curveTypeEnum.kCircularArcCurve Then oArcCurve = oCurve Exit For End If Next If Not oArcCurve Is Nothing Then ' Use the range of the arc in sheet space to calculate the detail view box. Dim oCornerOne As Point2d oCornerOne = oArcCurve.Evaluator2D.RangeBox.MinPoint oCornerOne.X = oCornerOne.X - 1 oCornerOne.Y = oCornerOne.Y - 1 Dim oCornerTwo As Point2d oCornerTwo = oArcCurve.Evaluator2D.RangeBox.MaxPoint oCornerTwo.X = oCornerTwo.X + 1 oCornerTwo.Y = oCornerTwo.Y + 1 ' Create the detail view with a rectangular box. Dim oDetailView As DetailDrawingView oDetailView = oSheet.DrawingViews.AddDetailView(oDrawingView, oPoint, _ DrawingViewStyleEnum.kFromBaseDrawingViewStyle, False, oCornerOne, oCornerTwo, , oDrawingView.Scale * 2) Else MsgBox ("No arc was found in the selected drawing view.") End If End Sub
any ideas how this can be achieved if possible at all?
Many thanks in advance.
Chris