Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script check interference 1

Status
Not open for further replies.

Camille1

Aerospace
Mar 25, 2005
12
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)
 
Replies continue below

Recommended for you

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor