Share

IManagedDrawing Interface

Provides functions for managing dimensions and annotations in the drawing in which the rule is running. In a rule, this interface is implemented by the predefined object named ThisDrawing. For backward compatibility, this interface inherits from ICadDrawing.

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

Syntax

VB

Public Interface IManagedDrawing
	Inherits IManagedItem(Of DrawingDocument), ICadDrawing

C#

public interface IManagedDrawing : IManagedItem<DrawingDocument>, 
	ICadDrawing

The IManagedDrawing type exposes the following members.

Properties

  NameDescription
Public propertyActiveSheet
Gets the active sheet.
Public propertyDocument
Gets the drawing document in which the rule is running.
(Inherited from ICadDrawing.)
Public propertyGeometry
Gets an object that can be used to create points, vectors, and matrices that have values in the units of the document in which the rule is running.
Public propertyKeepExtraResources
If this is set to False, then resources that have been copied from the drawing specified by ResourceFileName will be deleted from the current drawing when an iLogic function is used to replace them. This helps to redcue the number of unused resources stored in the drawing. The default value is True.
(Inherited from ICadDrawing.)
Public propertyModelDocument
Gets the document that is shown in the first view of a model that is found in the current drawing. If no such view is found, a value of Nothing will be returned.
(Inherited from ICadDrawing.)
Public propertyModelFactoryDocument
If the document returned by the ModelDocument is a model state member document, then this will get the corresponding factory document.
(Inherited from ICadDrawing.)
Public propertyName
Gets the name of the item.
(Inherited from IManagedItem(T).)
Public propertyNativeEntity
Gets the native Inventor API entity that is being managed.
(Inherited from IManagedItem(T).)
Public propertyResourceFileName
Gets or sets a path with filename that specifies the name of another drawing from which to pull title block and border definitions for the sheet TitleBlock and Border functions. This can be a relative or absolute path.
(Inherited from ICadDrawing.)
Public propertySheet
Gets the sheet with the specified name. An exception (error) will be thrown if the sheet is not found. This is an older ICadDrawing property. In new code, use the Sheets property.
Public propertySheets
Gets the collection of sheets in the drawing. Each sheet is of the type IManagedSheet.

Methods

  NameDescription
Public methodAddManagedEntity(String, Func(Object))
Adds a generic managed entity (e.g. an annotation) created by the Inventor API.
Public methodAddManagedEntity(String, Object)
Registers a generic managed entity that has already been created or edited.
Public methodAddManagedEntity(String, Func(Object, Boolean), Func(Object))
Adds or edits a generic managed entity (e.g. an annotation) created by the Inventor API.
Public methodBeginManage
Puts the system in a "managed group" state. The BeginManage/EndManage pair of functions provides for automatic deletion of unused components.
Public methodDeleteManagedEntity
Deletes a generic managed entity.
Public methodEndManage
Takes the system out of a "managed group" state. Any items (components, patterns, and constraints) that were previously managed by this group, but have not been touched in the current run will be deleted. (The current run includes all the statements between the preceding BeginManage and this EndManage statement.)

Remarks

Sample iLogic code:

VB

Option Explicit On
''' <summary>
''' This rule demonstrates adding (or editing) the following items in a managed drawing:
''' - linear, radius, and diameter dimensions
''' - centermarks and centerlines
''' - holes notes
''' </summary>
Sub Main

    ThisDrawing.BeginManage()

    ' A True/False parameter named AnnotationsWanted must exist in the drawing document.
    If AnnotationsWanted Then

        Dim drawDoc = ThisDrawing.Document
        _managedSheet = ThisDrawing.Sheets.ItemByName("Sheet:1")

        Dim frontView = _managedSheet.DrawingViews.ItemByName("FRONT")
        Dim backView = _managedSheet.DrawingViews.ItemByName("BACK")

        Dim genDims = _managedSheet.DrawingDimensions.GeneralDimensions

        ' Get a GeometryIntent on a drawing curve created by a model face named "TopRound"
        Dim topIntent = frontView.GetIntent("TopRound", PointIntentEnum.kCircularTopPointIntent)

        Dim bottomIntent = frontView.GetIntent("BottomRound", PointIntentEnum.kCircularBottomPointIntent)

        Dim textPt = frontView.SheetPoint(-0.05, 0.5)
        Dim linDim1 = genDims.AddLinear("Overall Size", textPt, topIntent, bottomIntent)

        topIntent = frontView.GetIntent("ArmTop")
        bottomIntent = frontView.GetIntent("ArmBottom")
        textPt = frontView.SheetPoint(0.8, 0.5)
        Dim linDim2 = genDims.AddLinear("Arm Width", textPt, topIntent, bottomIntent)

        Dim filletIntent = frontView.GetIntent("BottomRightFillet")
        textPt = frontView.SheetPoint(0.8, 0.2)
        Dim radiusDim = genDims.AddRadius("Fillet Radius", textPt, filletIntent)

        CreateHolePatternDims(frontView, 
        {"TopHole", "RightHole", "BottomHole", "LeftHole" },
        "BottomHole")

        CreateHolePatternDims(backView, 
        {"TopMiddleHole", "RightMiddleHole", "BottomMiddleHole", "LeftMiddleHole" },
        "BottomMiddleHole")

    End If

    ThisDrawing.EndManage()

End Sub

''' <summary>
''' Class members
''' </summary>
Dim _managedSheet As IManagedSheet

''' <summary>
''' Create dimensions on the hole patterns in a single view.
''' </summary>
Sub CreateHolePatternDims(view As IManagedDrawingView, holeNames() As String, holeNameForNote As String)

    Dim viewName = view.Name
    Dim isFront = viewName = "FRONT"

    Dim centerCentermark = _managedSheet.Centermarks.Add(viewName + "Center Centermark", view.GetIntent("CenterHole"))
    Dim genDims = _managedSheet.DrawingDimensions.GeneralDimensions
    Dim textPt As DocumentUnitsPoint2d

    Dim centerHoleIntent = view.GetIntent("CenterHole")

    If isFront Then
        textPt = view.SheetPoint(0.25, 0.75)
        Dim centerDiaDim = genDims.AddDiameter(viewName + "Center Hole Diameter", textPt, centerHoleIntent)
    End If

    Dim holeIntents As New List(Of GeometryIntent)
    For Each holeName In holeNames
        Dim holeIntent = view.GetIntent(holeName)
        holeIntents.Add(holeIntent)
    Next

    Dim centerPattern = _managedSheet.Centerlines.AddCenteredPattern(viewName + "Centerline on pattern",
    centerHoleIntent, holeIntents, closed := True)

    Dim clIntent = _managedSheet.NativeEntity.CreateGeometryIntent(centerPattern.NativeEntity)
    textPt = view.SheetPoint(If (isFront, 0.9, 0.1), If (isFront, 0.9, 0.67))
    Dim radialDim = genDims.AddRadius(viewName + " Holes Pattern Radius", textPt, clIntent)

    Dim cSintent = view.GetIntent(holeNameForNote)
    textPt = view.SheetPoint(If (isFront, 0.57, 0.64), If (isFront, -0.2, 0.2))
    Dim threadNote = _managedSheet.DrawingNotes.HoleThreadNotes.Add(viewName + " Countersunk Hole Note", textPt, cSintent)

End Sub

See Also

Reference