Wrong thread parameter

Wrong thread parameter

Anonymous
Not applicable
552 Views
2 Replies
Message 1 of 3

Wrong thread parameter

Anonymous
Not applicable

I have a project which contains a model. The model has 8 faces, and I want to create a thread on the 7th face.

 

Here's my code, but I keep getting the error.

 

 

design = app.activeProduct
rootComp = design.rootComponent
features = rootComp.features
components = design.allComponents
threadFeatures = features.threadFeatures

comp = components.item(0).bRepBodies.item(0)
componentFingerfaces = comp.faces
face = componentFingerfaces.item(7)

threadType = "ISO Metric profile"
threadDesignation = 'M6x1'
threadClass = '6g'
threadInfo = threadFeatures.createThreadInfo(False, threadType, threadDesignation, threadClass)  
threadInput = threadFeatures.createInput(face, threadInfo)
threadInput.isFullLength = True
thread = threadFeatures.add(threadInput)

 

 

How do I solve this error? Maybe there is a way to change a thread of a complete component

0 Likes
Accepted solutions (1)
553 Views
2 Replies
Replies (2)
Message 2 of 3

kandennti
Mentor
Mentor
Accepted solution

Hi @Anonymous .

 

I haven't checked, but I think threadFeatures need to be obtained from the component the face belongs to.

・・・
threadClass = '6g'

threadFeatures = components.item(0).features.threadFeatures # Here
threadInfo = threadFeatures.createThreadInfo(False, threadType, threadDesignation, threadClass)  
threadInput = threadFeatures.createInput(face, threadInfo)
・・・
0 Likes
Message 3 of 3

Anonymous
Not applicable

Thank you so much!

0 Likes