I want to read the workpoints and parts used to add dimension in the drawing. Using VBA I can get workpoints using <Dimension>.IntentOne.Geometry.AttachedEntity. However I have not seen any way to read it in VB.NET.
Can anybody please suggest me the way to read it?
Solved! Go to Solution.
Solved by xiaodong_liang. Go to Solution.
Hi,
the similar code should be also work in VB.NET. did you get any error or failure? I used the following code, it works well to me. It is a code within a standalone application. It asks user to select a dimension and pop out the information of the attaced entity if it is a workpoint.
Private Sub test()
Dim m_inventorApp As Inventor.Application = Nothing
Try
m_inventorApp = System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
Catch ex As Exception
End Try
' Get a feature selection from the user
Dim oObject As Object
oObject = m_inventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "Pick a dimension")
If TypeOf oObject Is LinearGeneralDimension Then
Dim oDrawDim As LinearGeneralDimension = oObject
Dim oAttEntity As Object = oDrawDim.IntentOne.Geometry.AttachedEntity
If TypeOf oAttEntity Is WorkPoint Then
Dim oWP As WorkPoint = oAttEntity
MsgBox("pt x,y,z" & oWP.Point.X & "; " & oWP.Point.Y & "; " & oWP.Point.Z)
End If
End If
End Sub
Best regards,
Xiaodong Liang
Developer Consultant
Autodesk Developer Technical Services