Change only Size of Thread feature

Change only Size of Thread feature

tim11_manhhieu
Advocate Advocate
284 Views
6 Replies
Message 1 of 7

Change only Size of Thread feature

tim11_manhhieu
Advocate
Advocate

When I change the bolt diameter, the thread feature does not automatically adjust, so an error occurs.

Is there a way to change the Size of the Thread feature so that the error does not occur?

 

tim11_manhhieu_0-1747626958692.png

 

0 Likes
285 Views
6 Replies
Replies (6)
Message 2 of 7

WCrihfield
Mentor
Mentor

Are you changing the diameter of the bolt manually, or by using a code process?  Either way, since the thread feature is dependent on that earlier feature's size, you will most likely need to 'roll-back' the 'End of Part' to before that thread feature, before changing the diameter of the bolt, then modify the thread size of the thread feature, while it remains in its rolled-back state, then reset the 'End of Part' to its natural end again after that step is finished.  We do have ways of doing those roll-back & roll-forward steps by code also, if needed.  Either that or suppress the thread feature, instead of roll-back, but suppression is more difficult to work with by code.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 7

tim11_manhhieu
Advocate
Advocate

I change the bolt diameter by code, I change the diameter through parameter.

The idea is to create bolts with different diameters and lengths through parameter.

However when changing the bolt diameter there is an error in the Thread feature.

I can change the Thread feature profile like designation, class.

But I find it unnecessary because just changing Size will eliminate the error.

Moreover, it is easy to cause errors, because if M8 has M8x1.25, but M6 does not have M6x1.25.

0 Likes
Message 4 of 7

WCrihfield
Mentor
Mentor

Within the code, get the ThreadFeature, then try setting the 'End of Part' to before that feature, before changing the parameter's value that changes the bolt's diameter.  Then, while it is still in that state, update the ThreadFeature to the same size thread specification.  Then set the 'End of Part' back to after that ThreadFeature (or to end of all features).  That should help eliminate the error.  However, there is not much I can do to eliminate the possibility of the other portion of the thread specification, after the diameter portion, not matching an existing/available thread specification within the 'thread.xls' file.  I generally do not change those types of things by code where I work, so I do not have any super advanced, or highly developed solutions for preventing thread specification mismatches.  You would likely have to develop a Sub or Function routine that you supply the specification to, then have it check within that 'thread.xls' file to see if that specification exists for you...and if it does, apply it, but if not, do not apply it.  It would likely be a very large and complex code to accomplish that, due to how large that Excel file is, how many sheets, and how many different layouts/formatting there are across all the sheets.  Some 'Search' functionality would likely be required.

 

For further reference, below are some links to online API help about different ways to move the 'End of Part' by code.

This first one lets you move it to just before, or just after a specific feature.

PartFeature.SetEndOfPart (method) (is available to pretty much all sub-types of features, such as ExtrudeFeature & ThreadFeature)

This next one is for moving it to top or bottom of all features in a part.

PartComponentDefinition.SetEndOfPartToTopOrBottom (method)

This next one is just an Object type, for if you attempt to navigate the model browser tree nodes, this is one of the objects you can encounter.  Not very useful other than that though.

EndOfFeatures (object)

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 5 of 7

tim11_manhhieu
Advocate
Advocate

Thanks for the help.
Even if I change the End of Part bar position, it still gives an error if I specify the wrong Thread Designation.
I'll probably create the Thread Info for each bolt diameter.

 

M6x1
M8x1.25
M10x1.5
M12x1.75
M14x2
M16x2
M18x2.5
M20x2.5
M22x3
M24x3
0 Likes
Message 6 of 7

jnowel
Advocate
Advocate

@tim11_manhhieu won't the simpler iLogic code of changing the thread designation work?
see attached part1.ipt (i was able to change the diameter (thru Form 1) in Inventor 2022 w/o error prompts
i think my sample is a bit simplistic (as the threads belong to the same family under "ANSI Metric M Profile") but maybe suffice for your use case?

Message 7 of 7

tim11_manhhieu
Advocate
Advocate

It works. Thank you for your time.

But my wish is that I don't need to create thread info for each diameter, when I change the bolt diameter to Φ20,

from that value 20, transform to M20 and pass to the size of the Thread feature,

which is Size 20 so as not to cause errors (no matter what the thread pitch is).

0 Likes