34bc5e8f0d
- aggiunte funzioni Exe e Lua CAvToolStmPosition.
58 lines
2.2 KiB
C++
58 lines
2.2 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2018-2018
|
|
//----------------------------------------------------------------------------
|
|
// File : EXE_CAvTool.cpp Data : 28.04.18 Versione : 1.9e1
|
|
// Contenuto : Funzioni per evitare coolisioni dell'utensile.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 28.04.18 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "EXE.h"
|
|
#include "EXE_Macro.h"
|
|
#include "EXE_Const.h"
|
|
#include "AuxTools.h"
|
|
#include "GeoTools.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
#include "/EgtDev/Include/EXeConst.h"
|
|
#include "/EgtDev/Include/EGkCAvToolSurfTm.h"
|
|
#include "/EgtDev/Include/EgtPointerOwner.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
double
|
|
ExeCAvToolStmPosition( double dToolLen, double dToolDiam, double dToolCornR, int nSurfTmId,
|
|
const Point3d& ptP, const Vector3d& vtAx, const Vector3d& vtMove, int nRefType)
|
|
{
|
|
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
|
VERIFY_GEOMDB( pGeomDB, false)
|
|
// recupero la superficie TriMesh
|
|
const ISurfTriMesh* pStm = GetSurfTriMesh( pGeomDB->GetGeoObj( nSurfTmId)) ;
|
|
if ( pStm == nullptr)
|
|
return -1 ;
|
|
// recupero il riferimento della superficie
|
|
Frame3d frSurf ;
|
|
if ( ! pGeomDB->GetGlobFrame( nSurfTmId, frSurf))
|
|
return -1 ;
|
|
// definizione oggetto per evitare collisioni
|
|
PtrOwner<ICAvToolSurfTm> pCAvTlStm( CreateCAvToolSurfTm()) ;
|
|
if ( IsNull( pCAvTlStm))
|
|
return -1 ;
|
|
// porto i dati geometrici in locale
|
|
Point3d ptPL = GetPointLocal( pGeomDB, ptP, nRefType, frSurf) ;
|
|
Vector3d vtAxL = GetVectorLocal( pGeomDB, vtAx, nRefType, frSurf) ;
|
|
Vector3d vtMoveL = GetVectorLocal( pGeomDB, vtMove, nRefType, frSurf) ;
|
|
// imposto dati
|
|
if ( ! pCAvTlStm->SetStdTool( dToolLen, dToolDiam / 2, dToolCornR))
|
|
return -1 ;
|
|
pCAvTlStm->SetSurfTm( *pStm) ;
|
|
pCAvTlStm->SetMoveDir( vtMoveL) ;
|
|
return pCAvTlStm->TestPosition( ptPL, vtAxL) ;
|
|
}
|