Using API to Get coordinate X,Y of centerline on drawing

Using API to Get coordinate X,Y of centerline on drawing

Anonymous
Not applicable
947 Views
1 Reply
Message 1 of 2

Using API to Get coordinate X,Y of centerline on drawing

Anonymous
Not applicable

Im new in Inventor API. i have been done to create drawing view from ipt file and add 3 projected view also set automatic centerline for cylindrical and hole feature.
for my project i need to get 2d coordinate (x,y) from all center cylindrical and hole feature in drawing (oview1 component). 


Any idea to extract centerline coordinate from oview1 variable?
This only important snippet of my code :

Dim oDrawingDoc As DrawingDocument
oDrawingDoc = ThisApplication.ActiveDocument
Dim oSheet As Sheet
oSheet = oDrawingDoc.Sheets.Item(1)
Dim oPoint1 As Point2d
oPoint1 = ThisApplication.TransientGeometry.CreatePoint2d(5.0#, 5.0#)
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.Documents.Open("D:\SyncCloud\OneDrive\AutoDesk Saved Files\Base1\Frame\ISO 00000017.ipt", False)
Dim oView1 As DrawingView
oView1 = oSheet.DrawingViews.AddBaseView(oPartDoc, oPoint1, 1.0#, ViewOrientationTypeEnum.kTopViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle)
 
Dim oACS As AutomatedCenterlineSettings
oView1.GetAutomatedCenterlineSettings(oACS)
oACS.ApplyToCylinders = True
oACS.ApplyToHoles = True
oView1.SetAutomatedCenterlineSettings(oACS)

 

 

0 Likes
Accepted solutions (1)
948 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Accepted solution

Hooray.. after i checked object randomly using watch in visual studio. i get the center mark coordinate. with evaluate sheet centermarks.
i think center mark is not oview1 member.

 

this code that i use to get all centermaks coordinate on osheet.

        Dim centermarkscoordsX() As Double
        Dim centermarkscoordsY() As Double
        Dim oDoc As DrawingDocument
        oDoc = ThisApplication.ActiveDocument

        ' Set a reference to the active sheet
        Dim oSheet As Sheet
        oSheet = oDoc.ActiveSheet

        Dim oDrawingDim As Centermark

        ' Iterate over all centermark in the drawing
        Dim i As Integer = 0
        For Each oDrawingDim In oSheet.Centermarks
            centermarkscoordsX(i) = oDrawingDim.Position.X
            centermarkscoordsY(i) = oDrawingDim.Position.Y
            i = i + 1
        Next
0 Likes