Get Origin of DrawingView

Get Origin of DrawingView

PolemEngineering
Advocate Advocate
619 Views
3 Replies
Message 1 of 4

Get Origin of DrawingView

PolemEngineering
Advocate
Advocate

I'm working on a small tool with which some actions in the Inventor Drawing Environment can be automated.

 

For this I need to define the center of a topview in a drawing.

Dim newCenter as Point2d = oApp.TransientGeometry.CreatePoint2d(oView.Center.X, oView.Center.Y)

Code above results in the center of the view. For a circular object placed on the model origin, the view center equals the origin. When the view has some asymetric geometry, the result is not as desired.

 

Instead of the View Center I need the origin of the model showed in the view.

 

What code do I need to achieve this?

René van der Starre

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

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@PolemEngineering,

 

Try below iLogic code to get origin of model document(PartDocument) in Drawing document.

 

 

Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet
oSheet = oDoc.ActiveSheet

Dim oView As DrawingView
oView = oSheet.DrawingViews.Item(1)

Dim oDef As PartComponentDefinition
oDef = oView.ReferencedDocumentDescriptor.ReferencedDocument.ComponentDefinition

Dim oWP As WorkPoint
oWP = oDef.WorkPoints.Item(1)

Call oView.SetIncludeStatus(oWP, True)

Dim oCentermark As Centermark
oCentermark = oSheet.Centermarks.Item(oSheet.Centermarks.Count)

Messagebox.Show ("X = " & oCentermark.Position.X & "Y = " & oCentermark.Position.Y) 

 

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



Message 3 of 4

PolemEngineering
Advocate
Advocate

Thank you very much! This is the code I was looking for.

I was not aware of the fact that WorkPoints.Item(1) represents the Origins Center Point.

René van der Starre

0 Likes
Message 4 of 4

chandra.shekar.g
Autodesk Support
Autodesk Support

@PolemEngineering ,

 

You are welcome!!!

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes