×
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

VB Script check interference

VB Script check interference

VB Script check interference

(OP)
I tried to do colision detection between two parts by using vb, but I could not get it to work .Can someone help me with this?  Below is part of script

dim productdocument1 as Productdocument
set productdocument1 = CATIA.ActiveDocument

dim products1 as Products
set products1 = productdocument1.product.products

dim group1 as Group
group1.AddExplicit products1.item(1)

dim group2 as Group
group2.AddExplicit products1.item(2)

dim clash1 As Clash
set clash1 = Clash.Compute(group1, group2)

RE: VB Script check interference

Hi,

Here is a script which can solve your problem. You can obtain a clash analize for a whole product. The result will be listed in a xml file (see line "c:\Temp\sample.xml") but without pictures.

If somebody can find how can we obtain also pictures when we export a xml file, please let us know. Untill now, I can' realize how can I solve this.




Sub CATMain()

       Dim cClashes As Clashes
       Set cClashes =CATIA.ActiveDocument.Product.GetTechnologicalObject("Clashes")


       Dim oClash As Clash
       Set oClash = cClashes.AddFromSel
       oClash.ComputationType = catClashComputationTypeInsideOne
       oClash.InterferenceType = catClashInterferenceTypeContact
       oClash.Compute

       Dim cConflicts As Conflicts
       Set cConflicts = oClash.Conflicts
       Dim I As Integer


       For I = 1 To cConflicts.Count
           Dim oConflict As Conflict
           Set oConflict = cConflicts.Item(I)


           'MsgBox oConflict.Value
           If (oConflict.Type = catConflictTypeClash) Then

               If (oConflict.Value <> 0) Then

                   oConflict.Status = catConflictStatusRelevant
                   oConflict.Comment = "Automatic filter : penetration less than " & dFilterValue

               End If

           ElseIf (oConflict.Type = catConflictTypeContact) Then

               oConflict.Status = catConflictStatusIrrelevant
               oConflict.Comment = "Automatic filter : contact"
           End If

       Next

                   oClash.Export ClashSpecExportAsXMLClashSpec,"c:\Temp\sample.xml"
End Sub


Regards
Fernando

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