//---------------------------------------------------------------------------- // EgalTech 2014-2014 //---------------------------------------------------------------------------- // File : API_GdbCreateCurve.cpp Data : 02.11.14 Versione : 1.5j7 // Contenuto : Funzioni di creazione curve del DB geometrico per API. // // // // Modifiche : 02.11.14 DS Creazione modulo. // // //---------------------------------------------------------------------------- //--------------------------- Include ---------------------------------------- #include "stdafx.h" #include "API.h" #include "/EgtDev/Include/EInAPI.h" #include "/EgtDev/Include/EXeExecutor.h" using namespace std ; //------------------------------------------------------------------------------- int __stdcall EgtCreateLine( int nParentId, const double ptIni[3], const double ptFin[3], int nRefType) { return ExeCreateLine( nParentId, ptIni, ptFin, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateLineEx( int nParentId, const double ptIni[3], int nSepI, int nIdI, const double ptFin[3], int nSepF, int nIdF, int nRefType) { return ExeCreateLineEx( nParentId, ptIni, nSepI, nIdI, ptFin, nSepF, nIdF, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateLinePDL( int nParentId, const double ptIni[3], double dDirDeg, double dLen, int nRefType) { return ExeCreateLinePDL( nParentId, ptIni, dDirDeg, dLen, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateLinePVL( int nParentId, const double ptIni[3], const double vtDir[3], double dLen, int nRefType) { return ExeCreateLinePVL( nParentId, ptIni, vtDir, dLen, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateLineMinPointCurve( int nParentId, const double ptStart[3], int nCrvId, double dNearPar, int nRefType) { return ExeCreateLineMinPointCurve( nParentId, ptStart, nCrvId, dNearPar, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCircle( int nParentId, const double ptCen[3], double dRad, int nRefType) { return ExeCreateCircle( nParentId, ptCen, dRad, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCircleCP( int nParentId, const double ptCen[3], const double ptOn[3], int nRefType) { return ExeCreateCircleCP( nParentId, ptCen, ptOn, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCircleCPEx( int nParentId, const double ptCen[3], const double ptOn[3], int nSepO, int nIdO, int nRefType) { return ExeCreateCircleCPEx( nParentId, ptCen, ptOn, nSepO, nIdO, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCircle2P( int nParentId, const double ptP1[3], const double ptP2[3], int nRefType) { return ExeCreateCircle2P( nParentId, ptP1, ptP2, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCircle3P( int nParentId, const double ptP1[3], const double ptP2[3], const double ptP3[3], int nRefType) { return ExeCreateCircle3P( nParentId, ptP1, ptP2, ptP3, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateArc( int nParentId, const double ptCen[3], double dRad, double dAngIniDeg, double dAngCenDeg, double dDeltaN, int nRefType) { return ExeCreateArc( nParentId, ptCen, dRad, dAngIniDeg, dAngCenDeg, dDeltaN, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateArcC2P( int nParentId, const double ptCen[3], const double ptStart[3], const double ptNearEnd[3], int nRefType) { return ExeCreateArcC2P( nParentId, ptCen, ptStart, ptNearEnd, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateArcC2PEx( int nParentId, const double ptCen[3], const double ptStart[3], int nSepS, int nIdS, const double ptNearEnd[3], int nRefType) { return ExeCreateArcC2PEx( nParentId, ptCen, ptStart, nSepS, nIdS, ptNearEnd, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateArc3P( int nParentId, const double ptP1[3], const double ptP2[3], const double ptP3[3], int nRefType) { if ( ptP1 == nullptr || ptP2 == nullptr || ptP3 == nullptr) return GDB_ID_NULL ; return ExeCreateArc3P( nParentId, ptP1, ptP2, ptP3, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateArc2PR( int nParentId, const double ptStart[3], const double ptEnd[3], double dRad, BOOL bCCW, int nRefType) { if ( ptStart == nullptr || ptEnd == nullptr) return GDB_ID_NULL ; return ExeCreateArc2PR( nParentId, ptStart, ptEnd, dRad, ( bCCW != FALSE), nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateArc2PD( int nParentId, const double ptStart[3], const double ptEnd[3], double dDirSDeg, int nRefType) { if ( ptStart == nullptr || ptEnd == nullptr) return GDB_ID_NULL ; return ExeCreateArc2PD( nParentId, ptStart, ptEnd, dDirSDeg, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateArc2PDEx( int nParentId, const double ptStart[3], const double ptEnd[3], int nSep, int nId, double dDirSDeg, int nRefType) { if ( ptStart == nullptr || ptEnd == nullptr) return GDB_ID_NULL ; return ExeCreateArc2PDEx( nParentId, ptStart, ptEnd, nSep, nId, dDirSDeg, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateArc2PV( int nParentId, const double ptStart[3], const double ptEnd[3], const double vtDirS[3], int nRefType) { if ( ptStart == nullptr || ptEnd == nullptr) return GDB_ID_NULL ; return ExeCreateArc2PV( nParentId, ptStart, ptEnd, vtDirS, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateBiArc( int nParentId, const double ptStart[3], const double ptEnd[3], double dDirSDeg, double dDirEDeg, double dPar, int nRefType) { if ( ptStart == nullptr || ptEnd == nullptr) return GDB_ID_NULL ; return ExeCreateBiArc( nParentId, ptStart, ptEnd, dDirSDeg, dDirEDeg, dPar, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveFillet( int nParentId, int nCrv1, const double ptNear1[3], int nCrv2, const double ptNear2[3], double dRad, BOOL bTrim, int nRefType) { return ExeCreateCurveFillet( nParentId, nCrv1, ptNear1, nCrv2, ptNear2, dRad, ( bTrim != FALSE), nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveChamfer( int nParentId, int nCrv1, const double ptNear1[3], int nCrv2, const double ptNear2[3], double dDist, BOOL bTrim, int nRefType) { return ExeCreateCurveChamfer( nParentId, nCrv1, ptNear1, nCrv2, ptNear2, dDist, ( bTrim != FALSE), nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveBezier( int nParentId, int nDegree, const double ptCtrls[], int nRefType) { PNTVECTOR vPnt ; vPnt.reserve( nDegree + 1) ; for ( int i = 0 ; i <= nDegree ; ++i) { vPnt.emplace_back( ptCtrls[3*i], ptCtrls[3*i+1], ptCtrls[3*i+2]) ; } return ExeCreateCurveBezier( nParentId, nDegree, vPnt, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveBezierRational( int nParentId, int nDegree, const double ptCtrlWs[], int nRefType) { PNTUVECTOR vPntW ; vPntW.reserve( nDegree + 1) ; for ( int i = 0 ; i <= nDegree ; ++i) { vPntW.emplace_back( Point3d( ptCtrlWs[4*i], ptCtrlWs[4*i+1], ptCtrlWs[4*i+2]), ptCtrlWs[4*i+3]) ; } return ExeCreateCurveBezierRational( nParentId, nDegree, vPntW, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveBezierFromArc( int nParentId, int nArcId, BOOL bErase) { return ExeCreateCurveBezierFromArc( nParentId, nArcId, ( bErase != FALSE)) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveCompo( int nParentId, int nNumId, const int nIds[], BOOL bErase) { INTVECTOR vIds ; vIds.reserve( nNumId) ; for ( int i = 0 ; i < nNumId ; ++i) vIds.push_back( nIds[i]) ; return ExeCreateCurveCompo( nParentId, vIds, ( bErase != FALSE)) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveCompoByChain( int nParentId, int nNumId, const int nIds[], const double ptNear[3], BOOL bErase, int nRefType) { INTVECTOR vIds ; vIds.reserve( nNumId) ; for ( int i = 0 ; i < nNumId ; ++i) { vIds.push_back( nIds[i]) ; } return ExeCreateCurveCompoByChain( nParentId, vIds, ptNear, ( bErase != FALSE), nRefType, nullptr) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveCompoByReorder( int nParentId, int nNumId, const int nIds[], const double ptNear[3], BOOL bErase, int nRefType) { INTVECTOR vIds ; vIds.reserve( nNumId) ; for ( int i = 0 ; i < nNumId ; ++i) { vIds.push_back( nIds[i]) ; } return ExeCreateCurveCompoByReorder( nParentId, vIds, ptNear, ( bErase != FALSE), nRefType, nullptr) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveCompoByInterpolation( int nParentId, int nP, const double ptPs[], int nType, int nRefType) { PolyLine PL ; for ( int i = 0 ; i < nP ; ++i) { PL.AddUPoint( 0, Point3d( ptPs[3*i], ptPs[3*i+1], ptPs[3*i+2])) ; } return ExeCreateCurveCompoByInterpolation( nParentId, PL, nType, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveCompoByApproximation( int nParentId, int nP, const double ptPs[], int nType, double dLinTol, int nRefType) { PolyLine PL ; for ( int i = 0 ; i < nP ; ++i) { PL.AddUPoint( 0, Point3d( ptPs[3*i], ptPs[3*i+1], ptPs[3*i+2])) ; } return ExeCreateCurveCompoByApproximation( nParentId, PL, nType, dLinTol, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveCompoFromPoints( int nParentId, int nP, const double ptPs[], int nRefType) { PolyLine PL ; for ( int i = 0 ; i < nP ; ++i) { PL.AddUPoint( 0, Point3d( ptPs[3*i], ptPs[3*i+1], ptPs[3*i+2])) ; } return ExeCreateCurveCompoFromPoints( nParentId, PL, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateCurveCompoFromPointBulges( int nParentId, int nPB, const double ptPBs[], int nRefType) { PolyArc PA ; for ( int i = 0 ; i < nPB ; ++i) { PA.AddUPoint( 0, Point3d( ptPBs[4*i], ptPBs[4*i+1], ptPBs[4*i+2]), ptPBs[4*i+3]) ; } return ExeCreateCurveCompoFromPointBulges( nParentId, PA, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateRectangle2P( int nParentId, const double ptIni[3], const double ptCross[3], int nRefType) { return ExeCreateRectangle2P( nParentId, ptIni, ptCross, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreateRectangle3P( int nParentId, const double ptIni[3], const double ptCross[3], const double ptDir[3], int nRefType) { return ExeCreateRectangle3P( nParentId, ptIni, ptCross, ptDir, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreatePolygonFromRadius( int nParentId, int nNumSides, const double ptCen[3], const double ptCorn[3], int nRefType) { return ExeCreatePolygonFromRadius( nParentId, nNumSides, ptCen, ptCorn, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreatePolygonFromApothem( int nParentId, int nNumSides, const double ptCen[3], const double ptMid[3], int nRefType) { return ExeCreatePolygonFromApothem( nParentId, nNumSides, ptCen, ptMid, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtCreatePolygonFromSide( int nParentId, int nNumSides, const double ptIni[3], const double ptFin[3], int nRefType) { return ExeCreatePolygonFromSide( nParentId, nNumSides, ptIni, ptFin, nRefType) ; } //------------------------------------------------------------------------------- int __stdcall EgtSurfBezierGetCurveU( int nSurfId, double dV, int nDestGroup) { return ExeSurfBezierGetCurveU( nSurfId, dV, nDestGroup) ; } //------------------------------------------------------------------------------- int __stdcall EgtSurfBezierGetCurveV( int nSurfId, double dU, int nDestGroup) { return ExeSurfBezierGetCurveV( nSurfId, dU, nDestGroup) ; }