• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    Autodesk Inventor Customization

    Reply
    Member
    s_kul
    Posts: 3
    Registered: ‎07-28-2011
    Accepted Solution

    Read workpoints and parts used to add dimension

    126 Views, 2 Replies
    07-28-2011 04:37 AM

    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?

    Please use plain text.
    ADN Support Specialist
    xiaodong.liang
    Posts: 861
    Registered: ‎06-12-2011

    Re: Read workpoints and parts used to add dimension

    07-28-2011 08:52 PM in reply to: s_kul

    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,

     
    autodesk_logo_signature.png

    Xiaodong Liang

    Developer Consultant

    Autodesk Developer Technical Services



    Xiaodong Liang
    Developer Technical Services
    Autodesk Developer Network

    Please use plain text.
    Member
    s_kul
    Posts: 3
    Registered: ‎07-28-2011

    Re: Read workpoints and parts used to add dimension

    07-30-2011 01:51 AM in reply to: xiaodong.liang

    Thank you.

     

    This solution works for me.

    Please use plain text.