Message 1 of 8

Not applicable
02-08-2018
07:43 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello there,
I want to create a SectionView via VB.NET. I'm trying this by Setting two workpoints on a subassembly and use them to create the sectionline. This subassambly is part of the whole assembly which is opened in the drawing (Setting the Workpoints on the whole assembly is not an Option)
I can run the Code, and a Section View is made. However, I think the coordinates I get are wrong, so I looked at them via Message Box:
Point 1 (906052,85.../-0,499)
Point 2 (905704,26 / -5,499)
Seems pretty strange. Maybe I get the Model coordinates instead of drawing coordinates?
Private Sub Erstellung_Zeichnungsdatei() 'Variables not declared here, are declared globally oDrawDoc = g_inventorApplication.Documents.Add(DocumentTypeEnum.kDrawingDocumentObject, g_inventorApplication.FileManager.GetTemplateFile(DocumentTypeEnum.kDrawingDocumentObject)) oSheet = oDrawDoc.ActiveSheet oAsmDoc = g_inventorApplication.Documents.Open(zielverzeichnis, False) oTG = g_inventorApplication.TransientGeometry Dim oAsmDoc_türrahmen As AssemblyDocument oAsmDoc_türrahmen = g_inventorApplication.Documents.Open(tuerrahmen_einfach, False) Dim oFrontView As DrawingView oFrontView = oSheet.DrawingViews.AddBaseView(oAsmDoc, oTG.CreatePoint2d(15, 12), 0.125, ViewOrientationTypeEnum.kFrontViewOrientation, DrawingViewStyleEnum.kHiddenLineDrawingViewStyle) Dim oWorkPoint1 As WorkPoint Dim oWorkPoint2 As WorkPoint Dim oWorkPoint1Prox As WorkPointProxy = Nothing Dim oWorkPoint2Prox As WorkPointProxy = Nothing Dim oCompocc As ComponentOccurrence Dim oSectionSketch As DrawingSketch Dim oSectionLine As SketchLine Dim oSectionView As SectionDrawingView oCompocc = oAsmDoc.ComponentDefinition.Occurrences.ItemByName("Türrahmen:1") oWorkPoint1 = oAsmDoc_türrahmen.ComponentDefinition.WorkPoints.Item(1) oWorkPoint2 = oAsmDoc_türrahmen.ComponentDefinition.WorkPoints.Item(2) oCompocc.CreateGeometryProxy(oWorkPoint1, oWorkPoint1Prox) oCompocc.CreateGeometryProxy(oWorkPoint2, oWorkPoint2Prox) Dim coordX_1 As Double = oWorkPoint1Prox.Point.X Dim coordY_1 As Double = oWorkPoint1Prox.Point.Y Dim coordX_2 As Double = oWorkPoint2Prox.Point.X Dim coordY_2 As Double = oWorkPoint2Prox.Point.Y Dim oPoint1 As Point2d = oTG.CreatePoint2d(coordX_1, coordY_1) Dim oPoint2 As Point2d = oTG.CreatePoint2d(coordX_2, coordY_2) MsgBox("Y_1: " & coordY_1) MsgBox("X_1: " & coordX_1) MsgBox("Y_2: " & coordY_2) MsgBox("X_2: " & coordX_2) oSectionSketch = oFrontView.Sketches.Add oSectionSketch.Edit() oSectionLine = oSectionSketch.SketchLines.AddByTwoPoints(oPoint1, oPoint2) oSectionSketch.ExitEdit() oSectionView = oSheet.DrawingViews.AddSectionView(oFrontView, oSectionSketch, oTG.CreatePoint2d(34, 10), DrawingViewStyleEnum.kHiddenLineRemovedDrawingViewStyle, Nothing, False) End Sub
Any help would be much appreciated.
Solved! Go to Solution.