Inventor Customization

Reply
Member
guilloryt
Posts: 5
Registered: ‎06-06-2008
Message 1 of 2 (141 Views)

Modify ThreadInfo using the API

141 Views, 1 Replies
04-27-2011 10:19 AM

Would anyone have examples of how to modify ThreadInfo using the api.

 

Currently trying to use the code below to create a new ThreadInfo Object and assign it to the feature... but whenever the oClass is "" (zero length string)  the the CreateStandardThreadInfo fails.

 

Thanks

 

oThreadFeatures.Item(ThreadName).ThreadInfo = NewThreadInfo(oInternal, oRightHanded, oThreadType, oThreadDesignation, oClass)

 

 

Public Function NewThreadInfo(ByVal oInternal As Boolean, ByVal oRightHanded As Boolean, ByVal oThreadType As String, ByVal oThreadDesignation As String, ByVal oClass As String) As

ThreadInfo

 

Try

NewThreadInfo = oThreadFeatures.CreateStandardThreadInfo(oInternal, oRightHanded, oThreadType, oThreadDesignation, oClass)

 

Catch ex As

Exception

 

MessageBox

.Show(ex.Message)

 

End

Try

 

End

Function

Employee
yuhanzhang
Posts: 411
Registered: ‎01-06-2009
Message 2 of 2 (128 Views)

Re: Modify ThreadInfo using the API

04-27-2011 08:31 PM in reply to: guilloryt

Below is a VBA code sample from API document:

 

Sub EditThread()

   Dim oDoc As PartDocument
   Set oDoc = ThisApplication.ActiveDocument

   Dim oDef As PartComponentDefinition
   Set oDef = oDoc.ComponentDefinition

   ' Create a new thread info object containing the thread data
   Dim oNewThreadInfo As StandardThreadInfo
   Set oNewThreadInfo = oDef.Features.ThreadFeatures.CreateStandardThreadInfo(False, True, "ISO Metric Profile", "M20x2.5", "6g")

   ' Get the first thread feature
   Dim oThread As ThreadFeature
   Set oThread = oDef.Features.ThreadFeatures.Item(1)

   ' Edit the thread feature
   oThread.ThreadInfo = oNewThreadInfo

End Sub

 

 

The Class argument is required, and below is the description for it:

 

Class : Input String that defines the thread class. For example a valid class for an inch internal thread is 2B. A valid class for a metric external thread is 6g.

Hope this helps.



Rocky Zhang
Inventor API
Manufacturing Solutions
Autodesk, Inc.

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Inventor

Twitter

Facebook

Blogs

Pinterest

Youtube