Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to create dimensions for an assembly in an Inventor drawing using VB.net. I found a function that uses workpoints to create the dimension. However, when I run the function, it finds the workpoints, makes them visible, but gives an exception
{"The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"} when it gets to the point where it is supposed to create the dimension. I am running Inventor 2016 update 2. Here is the sub I'm using to create the dimension:
Public Sub DimToWorkPoints(ByVal DrawView As DrawingView, ByVal WorkPoint1 As WorkPoint, ByVal WorkPoint2 As WorkPoint, ByVal TextPosition As Point2d, ByVal AlignmentType As DimensionAlignmentTypeEnum) Try Dim sheet As Sheet sheet = DrawView.Parent ' Create centermarks based on the work points. Dim marks(1) As Centermark marks(0) = sheet.Centermarks.AddByWorkFeature(WorkPoint1, DrawView) 'marks(0).Visible = False marks(1) = sheet.Centermarks.AddByWorkFeature(WorkPoint2, DrawView) 'marks(1).Visible = False ' Create geometry intents for the center marks. Dim intent1 As GeometryIntent intent1 = sheet.CreateGeometryIntent(marks(0)) Dim intent2 As GeometryIntent intent2 = sheet.CreateGeometryIntent(marks(1)) ' Add a dimension. MsgBox(AlignmentType.ToString) Dim genDim As GeneralDimension genDim = sheet.DrawingDimensions.GeneralDimensions.AddLinear(TextPosition, intent1, intent2, AlignmentType) Catch ex As Exception End Try End Sub
Here is the list showing the exception I get:
I've also attached the code that calls out the sub. Can anyone give me a hand with this?
Solved! Go to Solution.