Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Read workpoints and parts used to add dimension

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Anonymous
476 Views, 2 Replies

Read workpoints and parts used to add dimension

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?

2 REPLIES 2
Message 2 of 3
xiaodong_liang
in reply to: Anonymous

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

Message 3 of 3
Anonymous
in reply to: xiaodong_liang

Thank you.

 

This solution works for me.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report