Problem using draft

Cesar Rodríguez

Problem using draft

Hello, I am trying to develop a macro to design roofs. I'll explain the process.

From a existing draft, a pad is created. The user is then prompted to select a face which will not receive the same operation. A reference is created from that face. Then al faces are drafted one by one except the one the user selected. The faces are drafted one by one because CATIA gave me an error when trying to do all faces at the same time.

The problem I'm getting is that after the draft operation is skipped on the selected frace, several other faces are skipped reporting an error 13 "type mismatch". I have not been able to solve this error. Any ideas? Thank you.

I'm using CATScript and CATIA V5R19.  The loop where I do the drafdt is listed below if that is of any help, and the whole code is attached. I know it is not very pretty as of right now, When I get it working I will clean up.

 

 

For I = 2 To nCaras

    strReferenceBRepName = "RSur:(Face:(Brp:(Pad.1;0:(Brp:(Sketch.1;" & I & ")));None:();Cf11:())"

    If strReferenceBrepName = strBRepName Then
        saltarCara = true
    End If

    If saltarCara = false Then

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

        Set myDraft(I) = shapeFactory1.AddNewDraft(myReference(I), reference3, catNoneDraftNeutralPropagationMode, referenceEmpty, 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

        If ((Err.Number <> 0) And (Err.Number <> -2147418113)) Then

            Set objSel = CATIA.ActiveDocument.Selection
            objSel.Clear
            objSel.Add myDraft(I)
            MsgBox("Error en la cara I= " & I & ", Error nš: " & Err.Number & ", Descripcion: " & Err.Description)      
            objSel.Delete
            Err.Clear
            part1.Update
        End If
    End If

    If saltarCara = true Then
        MsgBox("La cara " & I & " se salta")
        saltarCara = false
        contadorCarasSaltadas = contadorCarasSaltadas + 1
    End If

Next
Thgank you in advence, and sorry if this is posted in the wrong thread, I'm new to the forum.
Attachments

  • DraftedPad_v4_(selection_of_faces).CATScript (6k)