×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

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!
  • Students Click Here

*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

Jobs

Catia Macro: Measure Minimum Distance Between Two Parts in a Product

Catia Macro: Measure Minimum Distance Between Two Parts in a Product

Catia Macro: Measure Minimum Distance Between Two Parts in a Product

(OP)
Hello

I want to measure minimum distance between two parts in a product. But I am not able to get it work. Below is my code.

CODE --> VBA

Sub CATMain()

    Dim MyDoc As Document
    Set MyDoc = CATIA.ActiveDocument
    
    Dim MainProduct As Product
    Set MainProduct = MyDoc.Product
    
    Dim product1 As Product
    Dim product2 As Product
    
    Set product1 = MainProduct.Products.Item("Housing.1")
    Set product2 = MainProduct.Products.Item("Part1.2_Manual")
    
    Dim SPAWorkbench1 As SPAWorkbench
    Set SPAWorkbench1 = MyDoc.GetWorkbench("SPAWorkbench")
    
    Dim reference1 As Reference
    Dim reference2 As Reference
    
    Set reference1 = MainProduct.CreateReferenceFromName("Product1/Housing.1/")
    Set reference2 = MainProduct.CreateReferenceFromName("Product1/Part1.2_Manual/")
    
    Dim measurable1 As Measurable
    Set measurable1 = SPAWorkbench1.GetMeasurable(reference1)
    
    MsgBox measurable1.GetMinimumDistance(reference2)
    
End Sub 

Please help me

RE: Catia Macro: Measure Minimum Distance Between Two Parts in a Product

(OP)
Anyone please help me

RE: Catia Macro: Measure Minimum Distance Between Two Parts in a Product

(OP)
My Problem is still not solved. Anyone please help

RE: Catia Macro: Measure Minimum Distance Between Two Parts in a Product

(OP)
Measure Between allows you to select different children(instances) of a product and give minimum distance between two products. But somehow the same thing is not exposed through automation. One can't create reference from product instance.
Yes it is necessary to get it as I am working on something really complex where clearance calculation takes around 30 sec per iteration and I have to do it around 1500 times.

Right now I am using Distance and Clash Object to calculate clearance and interference but its very time consuming. Want to test the same with measurable if I get some speed advantage.

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!


Resources