0

I'm making a macro in CATIA using catscript. After a pad is made the user select a face and then the programs runs an operation in each face of the pad except if it is the one the user selected. I'm using a for loop, but when I try to use the statement "Continue For", I get a compilation error. Does anyone know why I'm getting the error? Also, if that statement can't be used in CATScript, is there any way of achieving that?

For I = 2 To nCaras

    strReferenceBRepName = "RSur:(Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;" & I & ")));None:();Cf11:())"
    MsgBox(strReferenceBRepName)
    If strReferenceBrepName = strBRepName Then
        MsgBox("La cara seleccionada es la " & I )
        Continue For
    End If

    Set myReference(I) = part1.CreateReferenceFromBRepName(strReferenceBRepName & ";WithTemporaryBody;WithoutBuildError;WithSelectingFeatureSupport;MFBRepVersion_CXR15)", myDraft(I-1))
    myDraftDomain(I).AddFaceToDraft myReference(I)

    Set myDraft(I) = shapeFactory1.AddNewDraft(myReference(I), reference3, catNoneDraftNeutralPropagationMode, reference1, 0.000000, 0.000000, 1.000000, catStandardDraftMode, 45.000000, catNoneDraftMultiselectionMode)
    Set myDraftDomains(I) = myDraft(I).DraftDomains
    Set myDraftDomain(I) = myDraftDomains(I).Item(1)

    myDraftDomain(I).SetPullingDirection 0.000000, 0.000000, 1.000000
    myDraftDomain(I).PullingDirectionElement = reference4

    part1.Update 
Next

I have tried the program and it does recognize the face (that's why the MsgBox is there). Thank you in advance.

  • VBScript doesn't have native support for the `Continue` keyword - See [The Official Documentation](https://learn.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/scripting-articles/sa3hh43e(v=vs.84)). – user692942 May 09 '22 at 16:59
  • Thank you. I have tried to increase the counter by one inside the If statement but that also doesn't work. Any ideas? – Cesar Rodriguez Cuenda May 09 '22 at 17:35
  • 2
    Use `Else` instead of `Continue For` and move the code, that's currently after the `End If`, to be between the `Else` and `End If`. – LesFerch May 09 '22 at 17:42

0 Answers0