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!

CATIA macro for finding constraint

Status
Not open for further replies.

wescut

New member
Jul 12, 2012
6
Here is the problem:

I Have a large assembly (over 200 parts and 1000 constraints)
When I make a certain modification, there is an update needed.
Is there a macro code which could find WHICH constraint needs to be updated?
Scrolling through 1000+ constraints in the tree is long, and finding the "blacked out" constraint in the assembly is merely impossible!

Thanks in advance


 
Replies continue below

Recommended for you

Hi,

In a CATScript, copy code bellow. After testing on a small assy (two-three constrains), if I would be in your place, I would modify the code to do the update automatically (otherwise I suppose you will have to kill CATIA).

Option Explicit
Sub CATMain()

' get root product
Dim prdRoot As Product
Set prdRoot = CATIA.ActiveDocument.Product

' get constraints stored in the root product
Dim oConstraints As Constraints
Set oConstraints = prdRoot.Connections("CATIAConstraints")

' loop through all constraints
Dim iConstraint
iConstraint = oConstraints.Count
MsgBox iConstraint

For iConstraint = 1 TO oConstraints.Count

' check if constraint is ok or not
If (oConstraints.Item(iConstraint).Status = catCstStatusOK) Then
MsgBox oConstraints.Item(iConstraint).Name & " OK"
Else
MsgBox oConstraints.Item(iConstraint).Name & " Not_OK"
End If

Next
End Sub

Regards
Fernando

 
in assembly design, Analyze menu, use Updates...

Eric N.
indocti discant et ament meminisse periti
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor