Share

IStandardObjectProvider.ThisDrawing Property

Provides functions for managing annotations in a drawing. Also provides access to sheets and views. If this property is used during the lifetime of the object that contains it, then the Dispose method should be called on the containing object.

Namespace:  Autodesk.iLogic.Interfaces
Assembly:  Autodesk.iLogic.Interfaces (in Autodesk.iLogic.Interfaces.dll) Version: 30.0

Syntax

VB

ReadOnly Property ThisDrawing As IManagedDrawing
	Get

C#

IManagedDrawing ThisDrawing { get; }

Return Value

Type: IManagedDrawing
A managed drawing object.

Remarks

Sample iLogic code:

VB

''' <summary>
''' This rule runs in an assembly. 
''' It will find or open an associated drawing and add, delete, or edit an angular dimension.
''' </summary>
Sub Main
    Dim drawingDoc = GetDrawingDoc(ThisDoc.ChangeExtension(".idw"))
    If drawingDoc Is Nothing Then
        Throw New Exception("The drawing must be open.")
    End If

    ' The Using statement takes care of calling Dispose on the object.
    ' Either one of these Using statements will work:
    'Using std = iLogicVb.CreateObjectProvider(drawingDoc)
    Using stdProvider = StandardObjectFactory.Create(drawingDoc)
        Dim thatDrawing = stdProvider.ThisDrawing
        Dim modelDoc = thatDrawing.ModelDocument
        If modelDoc IsNot ThisDoc.Document Then
            Throw New Exception("The drawing has the wrong ModelDocument.")
        Else
            TestManagedDrawing(stdProvider)
        End If
    End Using
End Sub

Sub TestManagedDrawing(stdProvider As IStandardObjectProvider)
    Dim thatDrawing = stdProvider.ThisDrawing
    thatDrawing.BeginManage("Group1")
    ' The model document in which this rule is running must contain a True/False parameter named AnnotationsWanted
    If AnnotationsWanted Then
        Dim Sheet_1 = thatDrawing.Sheets.ItemByName("Sheet:1")
        Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")
        Dim RightFace = VIEW1.GetIntent({"Subassem632:2", "Part362:1" }, "RightFace")
        Dim FrontFace = VIEW1.GetIntent({"Subassem632:2", "Part362:1" }, "FrontFace")
        Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions
        Dim linDim1 = genDims.AddAngular("Angle dimension 1", VIEW1.SheetPoint(0.3, 0.2), RightFace, FrontFace)
    End If

    thatDrawing.EndManage("Group1")

End Sub

Function GetDrawingDoc(fileName As String) As Document
    For Each doc In ThisApplication.Documents.VisibleDocuments
        If (String.Equals(doc.FullFileName, fileName, StringComparison.OrdinalIgnoreCase))
            Return doc
        End If
    Next
    Return ThisApplication.Documents.Open(fileName, True)
End Function

See Also

Reference

Was this information helpful?