×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Auto-Counting and Sorting Threads in a Part

Auto-Counting and Sorting Threads in a Part

Auto-Counting and Sorting Threads in a Part

(OP)
Hi everyone :)
I want to create a macro in Catia v5 R2020 that replicates the Thread/Tap Analysis feature from previous versions of the software. My goal is for the macro to automatically detect all threads in my part, categorize them by diameter, and provide a count of each thread size (ex. Total Threads = 130. M6 = 126, M24 = 4).

I’ve tried searching for every Thread in the Technological Results, but I’m not sure how to sort them by diameter. This, i think, is complicated by the fact that threads are generated by various features like Threaded Hole, TapHole Assemble (with isolated body), Mirrored holes, and User/Circ Patterns.

Is there a way to do this?

Thanks in advance

RE: Auto-Counting and Sorting Threads in a Part

First, I Would suggest to find hole feature, and analyse the dimensions of the feature, and as well if thread is defined or not!
Then you have the patterns. Lets make the first step and then we will figure out something!

Tiago Figueiredo
Tooling Engineer

Youtube channel:
https://www.youtube.com/channel/UC1qdlBeJJEgMgpPLV...

RE: Auto-Counting and Sorting Threads in a Part

I started and you can continue to code :)

just fill the points you need to add your choices.

CODE -->

Sub ThreadAnalysis()
    Dim partDocument As PartDocument
    Set partDocument = CATIA.ActiveDocument
    
    Dim part As Part
    Set part = partDocument.Part
    
    ' Dictionary to store thread diameter and count
    Dim threadCounts As New Scripting.Dictionary
    
    Dim features As HybridBodies
    Set features = part.HybridBodies
    
    ' Loop through hybrid bodies
    ' ...

        Dim hybridBody As HybridBody
        Set hybridBody = ' ...

        Dim feat As HybridShape
        For Each feat In hybridBody.HybridShapes
            ' Check if feat is a thread feature and extract relevant information
            ' ...

            ' Categorize and count threads
            ' ...

        Next feat

    ' ...

    ' Display the results to the user
    ' ...

End Sub 

RE: Auto-Counting and Sorting Threads in a Part

(OP)
Thanks guys, I'll work on it now and later I'll share what I got

RE: Auto-Counting and Sorting Threads in a Part

(OP)
Hi everyone,

unfortunately, I haven't been able to find a solution to this problem yet. I tried to complete the code provided by Dialga1, but, due to my lack of VB experience, I couldn't get it to work.

I think a good strategy is to detect all the Holes in a part and detect the holes that have a diameter equal to a value stored in a dictionary (I don't need to check if a hole is threaded or not). Then I just have to count how many objects there are in the various groups of the dictionary.

Please, can you help me to do that?

Thanks,
Francesco

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close