IBM Support

HD21430: GENERATING CATDRAWING USING CAA

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as user error.

Error description

  • Generating CATDrawing using CAA
    The customer has written code to generate a front
    view and then generate
    a section view from this front view.
    When only front view is created by the CAA
    program the generated
    CATDrawing contains the Front view of the part.
    When a section is added to the same sheet the
    initial front view
    disappears from the result.
    .
    

Local fix

Problem summary

Problem conclusion

Temporary fix

Comments

  • Incident Diagnosis
    Impossible to create front view and section view by
    using CAA Drafting modeler
    Correct Application
    Definition of projection plane is missing when
    creating the front view.
    To create a section view DefineSectionView method
    of CATIAGenerativeBehavior interface has to be
    used instead of AddSection method of
    CATIGenerSpec interface.
    Note: A macro may be recorded by creating front
    view and section view to understand different steps
    necessary to create such elements
    See below the corrected code:
    #include "iostream.h"
    // New includes
    #include "CATAutoConversions.h"
    #include "CATIAGenerativeViewBehavior.h"
    #include "CATMathPlane.h"
    #include "CATMathPoint.h"
    #include "CATMathVector.h"
    #include "CATSessionServices.h"
    #include "CATSession.h"
    #include "CATDocumentServices.h"
    #include "CATIDftDocumentServices.h"
    #include "CATIDrawing.h"
    #include "CATISheet.h"
    #include "CATIView.h"
    #include "CATIDrwFactory.h"
    #include "CATISketch.h"
    #include "CATISketchEditor.h"
    #include "CATI2DWFFactory.h"
    #include "CATIDftViewMakeUp.h"
    #include "CATInit.h"
    #include "CATIPrtContainer.h"
    #include "CATIPrtPart.h"
    #include "CATIGenerSpec.h"
    #include "CATMathDirection.h"
    #include "CATISpecObject.h"
    #include "CATLISTV_CATISpecObject.h"
    int main()
    {
    //SESSION CREATION.
    char* iSessionName
    = "DrawingSession";
    CATSession* pSession = NULL;
    HRESULT hr;
    hr = Create_Session
    (iSessionName,pSession);
    if (FAILED(hr))
    {
    cout<<"Create_Session
    failed\n";
    return 0;
    }
    else
    cout<<"Session creation
    OK\n";
    //OPEN CATPART FILE
    CATUnicodeString PartDocPath
    = "E:\\Part1.CATPart";
    CATDocument* pPartDoc = NULL;
    hr = CATDocumentServices::Open
    (PartDocPath, pPartDoc);
    if (FAILED(hr))
    {
    cout<<"PartDocPath
    Failed\n";
    return 0;
    }
    //CREATE NEW DRAWING FILE.
    CATDocument* pDoc = NULL;
    hr = CATDocumentServices::New
    ("Drawing",pDoc);
    if (FAILED(hr))
    {
    cout<<"New drawing
    failed\n";
    return 0;
    }
    CATIDftDocumentServices*
    piDftDocServices = NULL;
    hr = pDoc->QueryInterface
    (IID_CATIDftDocumentServices, (void**)
    &piDftDocServices);
    if(FAILED(hr))
    {
    cout<<"piDftDocServices
    failed\n";
    return 0;
    }
    CATIDrawing *piDwg = NULL;
    hr = piDftDocServices->GetDrawing
    (IID_CATIDrawing, (void**)&piDwg);
    if(FAILED(hr)) {
    cout<<"piDwg failed\n";
    //piDftDocServices->Release
    ();
    //piDftDocServices = NULL;
    return 0;
    }
    //RETRIEVE NEW DRAWING SHEET.
    CATISheet_var spCurrentSheet =
    piDwg->GetCurrentSheet();
    if(!spCurrentSheet)
    {
    cout<<"spCurrentSheet
    Failed\n";
    piDwg->Release();
    piDwg = NULL;
    return 0;
    }
    // piDwg->Release();
    // piDwg = NULL;
    CATISpecObject_var spDrwSpec =
    piDwg;
    CATIContainer_var spContainer =
    spDrwSpec->GetFeatContainer();
    if(!spContainer)
    {
    cout<<"spContainer
    Failed\n";
    return 0;
    }
    CATIDrwFactory* piDrwFactory =NULL;
    hr = spContainer->QueryInterface
    (IID_CATIDrwFactory,(void**)&piDrwFactory);
    if(FAILED(hr) || piDrwFactory == NULL)
    {
    cout<<"piDrwFactory
    Failed\n";
    return 0;
    }
    CATInit_var spInit(pPartDoc);
    if(!spInit)
    {
    cout<<"spinit Failed\n";
    return 0;
    }
    CATIPrtContainer* piPrtCont = NULL;
    piPrtCont = (CATIPrtContainer*)spInit-
    >GetRootContainer("CATIPrtContainer");
    if (!piPrtCont)
    {
    cout<<"piPrtCont failed\n";
    return 0;
    }
    CATIPrtPart_var spPart = piPrtCont-
    >GetPart();
    if (!spPart)
    {
    cout<<"spPart failed\n";
    return 0;
    }
    //CREATE FRONT VIEW
    CATILinkableObject_var spLink = spPart;
    CATIDftViewMakeUp* piDftFrontView =
    NULL;
    hr = piDrwFactory-
    >CreateViewWithMakeUp(IID_CATIDftViewMakeUp,
    (void**)&piDftFrontView);
    if (SUCCEEDED(hr))
    {
    cout << " creation view make up OK " << endl;
    }
    if(!piDftFrontView)
    {
    cout<<"piDftFrontView
    Failed\n";
    return 0;
    }
    CATIView* piFrontView =NULL;
    piDftFrontView->GetView(&piFrontView);
    if(piFrontView == NULL)
    return(NULL);
    piFrontView->SetViewType(FrontView);
    piDftFrontView->SetPosition(450,450);
    piFrontView->SetDoc (spLink);
    // Projection plane definition
    CATIGenerSpec_var spGenerSp = piFrontView-
    >GetGenerSpec();
    // Set projection plane.
    CATMathPoint pt1(0,0,0);
    CATMathVector vect1(1,0,0);
    CATMathVector vect2(0,1,0);
    CATMathPlane projPlane(pt1,vect1,vect2);
    spGenerSp->SetProjPlane(projPlane);
    spCurrentSheet->AddView
    (piDftFrontView);
    CATIDomain_var spUpdate;
    piFrontView->Update(spUpdate);
    spCurrentSheet->SetCurrentView
    (piFrontView);
    piFrontView->Update(spUpdate);
    cout<<"fin creation front view \n";
    //CREATE SECTIONAL VIEW.
    CATILinkableObject_var spLink1 =
    spPart;
    CATIDftViewMakeUp*
    piDftSectionalView = NULL;
    hr = piDrwFactory-
    >CreateViewWithMakeUp(IID_CATIDftViewMakeUp,
    (void**)&piDftSectionalView);
    if (FAILED(hr))
    {
    cout<<"piDftSectionalView
    Failed\n";
    return 0;
    }
    CATIView* piSectionalView = NULL;
    piDftSectionalView->GetView
    (&piSectionalView);
    if(!piSectionalView)
    {
    cout<<"piSectionalView
    Failed\n";
    return 0;
    }
    piSectionalView->SetDoc (spLink1);
    piSectionalView->SetViewType
    (SectionView);
    piDftSectionalView->SetPosition
    (300,450);
    spCurrentSheet->AddView(piDftSectionalView);
    spCurrentSheet->SetCurrentView(
    piDftSectionalView );
    CATIAGenerativeViewBehavior
    *piFrontGenViewBehavior = NULL;
    if (SUCCEEDED(piFrontView->QueryInterface (
    IID_CATIAGenerativeViewBehavior, ( void ** )
    &piFrontGenViewBehavior )))
    {
    CATIAGenerativeViewBehavior
    *piSectGenViewBehavior = NULL;
    if (SUCCEEDED(piSectionalView-
    >QueryInterface (
    IID_CATIAGenerativeViewBehavior, ( void ** )
    &piSectGenViewBehavior )))
    {
    // Callout definition
    int iSideToDraw = 0;
    double CalloutCoord 4 ;
    CalloutCoord 0  = -10.0;
    CalloutCoord 1  = -180.0;
    CalloutCoord 2  = -10.0;
    CalloutCoord 3  = 180.0;
    CATSafeArrayVariant *iProfile =
    BuildSafeArrayVariant ( CalloutCoord, 4 );
    CATUnicodeString iSectionType
    = "SectionCut";
    CATBSTR iSectionTypeBSTR;
    iSectionType.ConvertToBSTR(
    &iSectionTypeBSTR );
    CATUnicodeString iProfileType = "Aligned";
    CATBSTR iProfileTypeBSTR;
    iProfileType.ConvertToBSTR(
    &iProfileTypeBSTR );
    // Section view definition
    piSectGenViewBehavior->DefineSectionView
    (
    *iProfile,iSectionTypeBSTR,iProfileTypeBSTR,iSideT
    oDraw,piFrontGenViewBehavior );
    // memory clean
    CATFreeString ( iSectionTypeBSTR );
    CATFreeString ( iProfileTypeBSTR );
    piSectGenViewBehavior->Release();
    piSectGenViewBehavior=NULL;
    }
    piFrontGenViewBehavior->Release();
    piFrontGenViewBehavior=NULL;
    }
    piSectionalView->Update(spUpdate);
    //SAVE DRAWING FILE
    CATUnicodeString DocPath1
    = "E:\\LocatingRing_4535.CATDrawing";
    hr = CATDocumentServices::SaveAs
    (*pDoc,DocPath1);
    hr = CATDocumentServices::Remove
    (*pPartDoc);
    hr = CATDocumentServices::Remove
    (*pDoc);
    hr = Delete_Session(iSessionName);
    if (FAILED(hr))
    {
    cout<<"Delete_Session
    failed\n";
    return 0;
    }
    return 0;
    }
    Documentation Reference
    none
    Getting Started
    .
    

APAR Information

  • APAR number

    HD21430

  • Reported component name

    CATIA V5/NT/200

  • Reported component ID

    569151000

  • Reported release

    511

  • Status

    CLOSED USE

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2004-04-22

  • Closed date

    2004-04-28

  • Last modified date

    2004-04-28

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

Applicable component levels

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSVJ2K","label":"CATIA V5"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"511","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

Modified date:
28 April 2004