Crop Drawing view through API

Crop Drawing view through API

Mario-Villada
Advocate Advocate
1,361 Views
3 Replies
Message 1 of 4

Crop Drawing view through API

Mario-Villada
Advocate
Advocate

Is there any way to do a Crop operation in a drawing view using iventor API?

thanks In advance.

 

Mario.

0 Likes
Accepted solutions (1)
1,362 Views
3 Replies
Replies (3)
Message 2 of 4

YuhanZhang
Autodesk
Autodesk

No official API exposed for the crop operation yet.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 4

YuhanZhang
Autodesk
Autodesk
Accepted solution

But you can try below workaround:

 

Sub CreateCropView()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.Sheets(1)
    
    Dim oDrawingView As DrawingView
    Set oDrawingView = oSheet.DrawingViews(1)
    
    Dim oSk As DrawingSketch
    Set oSk = oDrawingView.Sketches.Add
    
    oSk.Edit
    oSk.SketchCircles.AddByCenterRadius ThisApplication.TransientGeometry.CreatePoint2d(0, 0), 2
    oSk.ExitEdit
    
    Me.SelectSet.Select oSk
    
    Dim oDef As ControlDefinition
    Set oDef = ThisApplication.CommandManager.ControlDefinitions("DrawingCropViewCmd")
    oDef.Execute
    
End Sub

 Hope this helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 4 of 4

Mario-Villada
Advocate
Advocate

Fantastic!, That is what  I needed.

 

Thank you very much.

 

Mario.

0 Likes