Get thread info from DrawingCurve.ModelGeometry?

Get thread info from DrawingCurve.ModelGeometry?

rfink
Enthusiast Enthusiast
527 Views
4 Replies
Message 1 of 5

Get thread info from DrawingCurve.ModelGeometry?

rfink
Enthusiast
Enthusiast

Is there a way to get the Thread Information of a Hole/Thread Feature from a Drawing Document using the DrawingCurve.ModelGeometry?

 

I am trying to put Thread Information in the text of Diameter General Dimension to work around issues with the HoleThread Note (which nobody seems to be able to fix).

 

I realize that this is wishfull thinking, but what the heck? Here is the code:

 

Dim oDwgCurve As Inventor.DrawingCurve
Dim oThread As Inventor.ThreadFeature
Set oDwgCurve = thisDoc.SelectSet.Item(1).Parent
Set oThread = oDwgCurve.ModelGeometry.????????

0 Likes
528 Views
4 Replies
Replies (4)
Message 2 of 5

dgreatice
Collaborator
Collaborator

Hi,

 

I will try to help you. But what kind of thread info do you want?

please provide screenshot.

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 3 of 5

AlexFielder
Advisor
Advisor

Does this section in the Autodesk github API training material offer any inspiration?

 

        Dim oHoleF As HoleFeature
        If oModelDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
            Dim oAssDef As AssemblyComponentDefinition
            oAssDef = oModelDoc.ComponentDefinition

            If oAssDef.Features.HoleFeatures.Count > 0 Then
                'as a demo: get the first hole feature
                oHoleF = oAssDef.Features.HoleFeatures(1)
            End If
        ElseIf oModelDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
            Dim oPartDef As PartComponentDefinition
            oPartDef = oModelDoc.ComponentDefinition

            If oPartDef.Features.HoleFeatures.Count > 0 Then
                'as a demo: get the first hole feature
                oHoleF = oPartDef.Features.HoleFeatures(1)
            End If
        End If


        ' add a new row to the hole table
        If Not oHoleF Is Nothing Then
            Dim oHoleCurves As DrawingCurvesEnumerator
            oHoleCurves = oDrawingView.DrawingCurves(oHoleF)
            If oHoleCurves.Count > 0 Then
                oFeatureHoleTable.HoleTableRows.Add(oHoleCurves(1))
            End If

        End If

Let me know if this works, but please share your solution either way so others can learn from your efforts.

 

🙂

 

Message 4 of 5

kelly.young
Autodesk Support
Autodesk Support

Hello @rfink does the response by @AlexFielder get you any closer?

 

Seems like good bit of code to get you going. If you can report back with more information to clarify that would be helpful.

 

Please select the Accept as Solution button if a post solves your issue or answers your question.

0 Likes
Message 5 of 5

rfink
Enthusiast
Enthusiast

Not really.

 

I was trying to get thread info by selecting the hole thread in a drawing and then inserting the info into the text of a drawing diameter dimension as a work around for the problems I experience with placement of  hole thread notes.

0 Likes