Create a detail drawing view defined by a workpoint.

Create a detail drawing view defined by a workpoint.

Anonymous
Not applicable
539 Views
3 Replies
Message 1 of 4

Create a detail drawing view defined by a workpoint.

Anonymous
Not applicable

Hi All,

 

Looking to create a detail drawing view from a predefined workpointCapture.PNG

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

 

 

0 Likes
540 Views
3 Replies
Replies (3)
Message 2 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Is that drawing contains only one view in it? Is there any criteria to select workpoint like line with red color?

 

DO you want to create detail view with work point as center point?

 

Can you please provide sample drawing to create detail view?

 

Please make sure that files are non confidential.

 

Thanks and regards, 


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 3 of 4

Anonymous
Not applicable

Hi,

 

That particular drawing does only have one drawing view, the criteria for selecting the work point would be its name (in this instance "fillpointworkpoint") , yes I want to create a detail view  which uses the work point as the centre point.

 

I'm afraid i cant provide the drawing as it is confidential.

 

Many thanks

 

Chris

0 Likes
Message 4 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Need not be to original drawing document. Sample drawing document which resembles same drawing.

 

One more question, Model document of drawing document is Part Document or Assembly Document?

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes