tried to make it a little more customizable and user friendly. #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't do much in Github so i am not sure if what i did is correct, if not then my apologies. I was looking for something like this for days and finally found BalzGuenat's post. THANK YOU!! I needed to add more variation to the script and comments for explanations on how to follow the code better. So i made some changes to it. wanted to help so i uploaded it in case it helps someone else. i added a description of my changes below.
now my only comment on this would be that, because this script can generate larger variations, it would be nice if the script could check the thread profiles as it is creating them and see if they are truly about to be generated in fusion 360. for example i don't think a M24 x .25 thread is possible. but that is someone smart then me to figure out.
Change Log: Metric Thread Generator Script
Moved all user inputs to the top of the script for easy access.
Added clear START and END markers around the user input section.
Replaced static pitch list with dynamic pitch range using pitch_start, pitch_end, and pitch_step.
Created a function called generate_pitch_list() to calculate pitch values from the input range.
Renamed designator() function to format_number() for clarity.
Introduced a Thread class to store thread properties with named attributes.
Modularized the code using named functions: generate_pitch_list() and generate_xml().
Grouped thread generation logic into a MetricThreadGenerator class.
Made output filename customizable using output_filename variable.
Added metadata fields to the XML output: Name, CustomName, Unit, Angle, SortOrder.
Used ET.indent() to format the XML output (requires Python 3.9 or later).
Added detailed comments throughout the script to explain each section.
Included instructional examples in the input section to guide new users.
Added a confirmation message at the end of the script to notify successful XML creation.
Preserved original ISO metric thread geometry calculations (H, pitch diameter, minor diameter).
Maintained original offset logic for internal and external threads.
Preserved tap drill calculation for internal threads (D - P).
Ensured compatibility with Python 3.9 and avoided advanced syntax to keep the script beginner-friendly.