411df42814
- aggiunta estensione MPF riconosciuta come tipo file CNC - aggiunta ExeExistsTable.
734 lines
22 KiB
C++
734 lines
22 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2014-2014
|
|
//----------------------------------------------------------------------------
|
|
// File : LUA_GdbModifyCurve.cpp Data : 28.12.14 Versione : 1.5l2
|
|
// Contenuto : Funzioni di modifica delle curve per LUA.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 03.10.14 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "LUA.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
#include "/EgtDev/Include/EXeConst.h"
|
|
#include "/EgtDev/Include/EGkCurve.h"
|
|
#include "/EgtDev/Include/EGkLuaAux.h"
|
|
|
|
using namespace std ;
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaInvertCurve( lua_State* L)
|
|
{
|
|
// 1 parametro : Id/s
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
LuaClearStack( L) ;
|
|
// eseguo inversione curve
|
|
bool bOk = ExeInvertCurve( vId) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaOffsetCurve( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, dDist [, nType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dDist ;
|
|
LuaCheckParam( L, 2, dDist)
|
|
int nType = ICurve::OFF_FILLET ;
|
|
LuaGetParam( L, 3, nType) ;
|
|
LuaClearStack( L) ;
|
|
// offset della curva
|
|
bool bOk = ExeOffsetCurve( nId, dDist, nType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaOffsetCurveAdv( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, dDist [, nType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dDist ;
|
|
LuaCheckParam( L, 2, dDist)
|
|
int nType = ICurve::OFF_FILLET ;
|
|
LuaGetParam( L, 3, nType) ;
|
|
LuaClearStack( L) ;
|
|
// offset della curva
|
|
int nCount ;
|
|
int nNewId = ExeOffsetCurveAdv( nId, dDist, nType, &nCount) ;
|
|
if ( nCount >= 0) {
|
|
LuaSetParam( L, nNewId) ;
|
|
LuaSetParam( L, nCount) ;
|
|
}
|
|
else {
|
|
LuaSetParam( L) ;
|
|
LuaSetParam( L, nCount) ;
|
|
}
|
|
return 2 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaApproxCurve( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, nApprType [, dLinTol]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
int nApprType ;
|
|
LuaCheckParam( L, 2, nApprType)
|
|
double dLinTol = 0.01 ;
|
|
LuaGetParam( L, 3, dLinTol) ;
|
|
LuaClearStack( L) ;
|
|
// approssimazione della curva con rette
|
|
bool bOk = ExeApproxCurve( nId, nApprType, dLinTol) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaProjectCurveOnPlane( lua_State* L)
|
|
{
|
|
// 3 o 4 parametri : Id, ptOn, vtN [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
Point3d ptOn ;
|
|
LuaCheckParam( L, 2, ptOn)
|
|
Vector3d vtN ;
|
|
LuaCheckParam( L, 3, vtN)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 4, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// approssimazione della curva con rette
|
|
bool bOk = ExeProjectCurveOnPlane( nId, ptOn, vtN, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaChangeClosedCurveStartPoint( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, NewStart [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
Point3d ptStart ;
|
|
LuaCheckParam( L, 2, ptStart)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// modifico il punto iniziale
|
|
bool bOk = ExeChangeClosedCurveStartPoint( nId, ptStart, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaModifyCurveStartPoint( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, NewStart [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
Point3d ptStart ;
|
|
LuaCheckParam( L, 2, ptStart)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// modifico il punto iniziale
|
|
bool bOk = ExeModifyCurveStartPoint( nId, ptStart, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaModifyCurveEndPoint( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, NewEnd [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
Point3d ptEnd ;
|
|
LuaCheckParam( L, 2, ptEnd)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// modifico il punto finale
|
|
bool bOk = ExeModifyCurveEndPoint( nId, ptEnd, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaModifyCurveExtrusion( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id/s, vtExtr [, nRefType]
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
Vector3d vtExtr ;
|
|
LuaCheckParam( L, 2, vtExtr)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// modifico il vettore estrusione
|
|
bool bOk = ExeModifyCurveExtrusion( vId, vtExtr, nRefType) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaModifyCurveThickness( lua_State* L)
|
|
{
|
|
// 2 parametri : Id/s, Thick
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
double dThick ;
|
|
LuaCheckParam( L, 2, dThick)
|
|
LuaClearStack( L) ;
|
|
// modifico lo spessore di estrusione
|
|
bool bOk = ExeModifyCurveThickness( vId, dThick) ;
|
|
// restituisco il risultato
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaTrimCurveStartAtLen( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, dLen
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dLen ;
|
|
LuaCheckParam( L, 2, dLen)
|
|
LuaClearStack( L) ;
|
|
// taglio la curva all'inizio
|
|
bool bOk = ExeTrimCurveStartAtLen( nId, dLen) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaTrimCurveEndAtLen( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, dLen
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dLen ;
|
|
LuaCheckParam( L, 2, dLen)
|
|
LuaClearStack( L) ;
|
|
// taglio la curva alla fine
|
|
bool bOk = ExeTrimCurveEndAtLen( nId, dLen) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaTrimCurveStartAtParam( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, dPar
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dPar ;
|
|
LuaCheckParam( L, 2, dPar)
|
|
LuaClearStack( L) ;
|
|
// taglio la curva all' inizio
|
|
bool bOk = ExeTrimCurveStartAtParam( nId, dPar) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaTrimCurveEndAtParam( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, dPar
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dPar ;
|
|
LuaCheckParam( L, 2, dPar)
|
|
LuaClearStack( L) ;
|
|
// taglio la curva alla fine
|
|
bool bOk = ExeTrimCurveEndAtParam( nId, dPar) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaTrimCurveStartEndAtParam( lua_State* L)
|
|
{
|
|
// 3 parametri : Id, dParS, dParE
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dParS ;
|
|
LuaCheckParam( L, 2, dParS)
|
|
double dParE ;
|
|
LuaCheckParam( L, 3, dParE)
|
|
LuaClearStack( L) ;
|
|
// taglio la curva alla fine
|
|
bool bOk = ExeTrimCurveStartEndAtParam( nId, dParS, dParE) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaTrimExtendCurveByLen( lua_State* L)
|
|
{
|
|
// 3 o 4 parametri : Id, dLen, ptNear [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dLen ;
|
|
LuaCheckParam( L, 2, dLen)
|
|
Point3d ptNear ;
|
|
LuaCheckParam( L, 3, ptNear)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 4, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// taglio o allungo la curva nell'estremo più vicino al punto
|
|
bool bOk = ExeTrimExtendCurveByLen( nId, dLen, ptNear, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaTrimCurveWithRegion( lua_State* L)
|
|
{
|
|
// 4 parametro : nCrvId, nRegId, bInVsOut, bOn
|
|
int nCrvId ;
|
|
LuaCheckParam( L, 1, nCrvId)
|
|
int nRegId ;
|
|
LuaCheckParam( L, 2, nRegId)
|
|
bool bInVsOut ;
|
|
LuaCheckParam( L, 3, bInVsOut)
|
|
bool bOn ;
|
|
LuaCheckParam( L, 4, bOn)
|
|
LuaClearStack( L) ;
|
|
// conservo le parti di curva desiderate
|
|
int nCount ;
|
|
int nNewId = ExeTrimCurveWithRegion( nCrvId, nRegId, bInVsOut, bOn, &nCount) ;
|
|
if ( nNewId != GDB_ID_NULL)
|
|
LuaSetParam( L, nNewId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
LuaSetParam( L, nCount) ;
|
|
return 2 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaSplitCurve( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, nParts
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
int nParts ;
|
|
LuaCheckParam( L, 2, nParts)
|
|
LuaClearStack( L) ;
|
|
// divido la curva nel punto
|
|
int nFirstId = ExeSplitCurve( nId, nParts) ;
|
|
if ( nFirstId != GDB_ID_NULL)
|
|
LuaSetParam( L, nFirstId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaSplitCurveAtPoint( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, ptOn [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
Point3d ptOn ;
|
|
LuaCheckParam( L, 2, ptOn)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// divido la curva nel punto
|
|
int nNewId = ExeSplitCurveAtPoint( nId, ptOn, nRefType) ;
|
|
if ( nNewId != GDB_ID_NULL)
|
|
LuaSetParam( L, nNewId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaSplitCurveAtParam( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, dParam
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dParam ;
|
|
LuaCheckParam( L, 2, dParam)
|
|
LuaClearStack( L) ;
|
|
// divido la curva nel punto
|
|
int nFirstId = ExeSplitCurveAtParam( nId, dParam) ;
|
|
if ( nFirstId != GDB_ID_NULL)
|
|
LuaSetParam( L, nFirstId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaSplitCurveAtCorners( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, dTgAngToler
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dTgAngToler ;
|
|
LuaCheckParam( L, 2, dTgAngToler)
|
|
LuaClearStack( L) ;
|
|
// divido la curva nei punti angolosi
|
|
int nCount ;
|
|
int nNewId = ExeSplitCurveAtCorners( nId, dTgAngToler, &nCount) ;
|
|
if ( nNewId != GDB_ID_NULL)
|
|
LuaSetParam( L, nNewId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
LuaSetParam( L, nCount) ;
|
|
return 2 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaSplitCurveAtSelfInters( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// divido la curva negli eventuali punti di autointersezione
|
|
int nCount ;
|
|
int nNewId = ExeSplitCurveAtSelfInters( nId, &nCount) ;
|
|
if ( nNewId != GDB_ID_NULL)
|
|
LuaSetParam( L, nNewId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
LuaSetParam( L, nCount) ;
|
|
return 2 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaModifyArcRadius( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, dNewRad
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dNewRad ;
|
|
LuaCheckParam( L, 2, dNewRad)
|
|
LuaClearStack( L) ;
|
|
// modifica del raggio
|
|
bool bOk = ExeModifyArcRadius( nId, dNewRad) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaModifyArcToExplementary( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// modifica del raggio
|
|
bool bOk = ExeModifyArcToExplementary( nId) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaModifyArcByFlip( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// modifica del raggio
|
|
bool bOk = ExeModifyArcByFlip( nId) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaCloseCurveCompo( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// eseguo chiusura della curva composita
|
|
bool bOk = ExeCloseCurveCompo( nId) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaAddCurveCompoLine( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, ptNew [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
Point3d ptNew ;
|
|
LuaCheckParam( L, 2, ptNew)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// aggiungo una linea in coda alla curva composita
|
|
bool bOk = ExeAddCurveCompoLine( nId, ptNew, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaAddCurveCompoArcTg( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : Id, ptNew [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
Point3d ptNew ;
|
|
LuaCheckParam( L, 2, ptNew)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// aggiungo un arco tangente in coda alla curva composita
|
|
bool bOk = ExeAddCurveCompoArcTg( nId, ptNew, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaAddCurveCompoArc2P( lua_State* L)
|
|
{
|
|
// 3 o 4 parametri : Id, ptMid, ptNew [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
Point3d ptMid ;
|
|
LuaCheckParam( L, 2, ptMid)
|
|
Point3d ptNew ;
|
|
LuaCheckParam( L, 3, ptNew)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 4, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// aggiungo arco per 3P in coda alla curva composita
|
|
bool bOk = ExeAddCurveCompoArc2P( nId, ptMid, ptNew, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaAddCurveCompoJoint( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, dU
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dU ;
|
|
LuaCheckParam( L, 2, dU)
|
|
LuaClearStack( L) ;
|
|
// aggiungo la giunzione
|
|
bool bOk = ExeAddCurveCompoJoint( nId, dU) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaModifyCurveCompoJoint( lua_State* L)
|
|
{
|
|
// 3 o 4 parametri : Id, nU, ptJoint [, nRefType]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
int nU ;
|
|
LuaCheckParam( L, 2, nU)
|
|
Point3d ptJoint ;
|
|
LuaCheckParam( L, 3, ptJoint)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 4, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// modifico il punto di giunzione nU-esimo
|
|
bool bOk = ExeModifyCurveCompoJoint( nId, nU, ptJoint, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaRemoveCurveCompoJoint( lua_State* L)
|
|
{
|
|
// 2 parametri : Id, nU
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
int nU ;
|
|
LuaCheckParam( L, 2, nU)
|
|
LuaClearStack( L) ;
|
|
// rimuovo la giunzione
|
|
bool bOk = ExeRemoveCurveCompoJoint( nId, nU) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaExplodeCurveCompo( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// esplosione della curva composita
|
|
int nCount ;
|
|
int nFirstId = ExeExplodeCurveCompo( nId, &nCount) ;
|
|
if ( nFirstId != GDB_ID_NULL)
|
|
LuaSetParam( L, nFirstId) ;
|
|
else
|
|
LuaSetParam( L) ;
|
|
LuaSetParam( L, nCount) ;
|
|
return 2 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaMergeCurvesInCurveCompo( lua_State* L)
|
|
{
|
|
// 1 o 2 parametri : Id [, dLinTol]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dLinTol = 0.01 ;
|
|
LuaGetParam( L, 2, dLinTol) ;
|
|
LuaClearStack( L) ;
|
|
// esplosione della curva composita
|
|
bool bOk = ExeMergeCurvesInCurveCompo( nId, dLinTol) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaRemoveCurveCompoUndercutOnY( lua_State* L)
|
|
{
|
|
// 1 o 2 parametri : Id [, dLinTol]
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
double dLinTol = 0.01 ;
|
|
LuaGetParam( L, 2, dLinTol) ;
|
|
LuaClearStack( L) ;
|
|
// eliminazioni delle parti sotto rispetto alla direzione Y+
|
|
bool bOk = ExeRemoveCurveCompoUndercutOnY( nId, dLinTol) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaChainCurvesInGroup( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
|
|
int nGroupId ;
|
|
LuaCheckParam( L, 1, nGroupId)
|
|
Point3d ptNear ;
|
|
LuaCheckParam( L, 2, ptNear)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// concateno le curve nel gruppo (senza fonderle in una curva composita)
|
|
bool bOk = ExeChainCurvesInGroup( nGroupId, ptNear, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaReorderCurvesInGroup( lua_State* L)
|
|
{
|
|
// 2 o 3 parametri : nGroupId, ptNear [, nRefType]
|
|
int nGroupId ;
|
|
LuaCheckParam( L, 1, nGroupId)
|
|
Point3d ptNear ;
|
|
LuaCheckParam( L, 2, ptNear)
|
|
int nRefType = RTY_DEFAULT ;
|
|
LuaGetParam( L, 3, nRefType) ;
|
|
LuaClearStack( L) ;
|
|
// riordino le curve nel gruppo (senza fonderle in una curva composita)
|
|
bool bOk = ExeReorderCurvesInGroup( nGroupId, ptNear, nRefType) ;
|
|
LuaSetParam( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
bool
|
|
LuaInstallGdbModifyCurve( LuaMgr& luaMgr)
|
|
{
|
|
bool bOk = ( &luaMgr != nullptr) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertCurve", LuaInvertCurve) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtOffsetCurve", LuaOffsetCurve) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtOffsetCurveAdv", LuaOffsetCurveAdv) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtApproxCurve", LuaApproxCurve) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtProjectCurveOnPlane", LuaProjectCurveOnPlane) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtChangeClosedCurveStartPoint", LuaChangeClosedCurveStartPoint) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveStartPoint", LuaModifyCurveStartPoint) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveEndPoint", LuaModifyCurveEndPoint) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveExtrusion", LuaModifyCurveExtrusion) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveThickness", LuaModifyCurveThickness) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveStartAtLen", LuaTrimCurveStartAtLen) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveEndAtLen", LuaTrimCurveEndAtLen) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveStartAtParam", LuaTrimCurveStartAtParam) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveEndAtParam", LuaTrimCurveEndAtParam) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveStartEndAtParam", LuaTrimCurveStartEndAtParam) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimExtendCurveByLen", LuaTrimExtendCurveByLen) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtTrimCurveWithRegion", LuaTrimCurveWithRegion) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurve", LuaSplitCurve) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtPoint", LuaSplitCurveAtPoint) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtParam", LuaSplitCurveAtParam) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtCorners", LuaSplitCurveAtCorners) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtSplitCurveAtSelfInters", LuaSplitCurveAtSelfInters) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcRadius", LuaModifyArcRadius) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcToExplementary", LuaModifyArcToExplementary) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyArcByFlip", LuaModifyArcByFlip) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtCloseCurveCompo", LuaCloseCurveCompo) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoLine", LuaAddCurveCompoLine) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoArcTg", LuaAddCurveCompoArcTg) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoArc2P", LuaAddCurveCompoArc2P) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtAddCurveCompoJoint", LuaAddCurveCompoJoint) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtModifyCurveCompoJoint", LuaModifyCurveCompoJoint) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveCurveCompoJoint", LuaRemoveCurveCompoJoint) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeCurveCompo", LuaExplodeCurveCompo) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtMergeCurvesInCurveCompo", LuaMergeCurvesInCurveCompo) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtRemoveCurveCompoUndercutOnY", LuaRemoveCurveCompoUndercutOnY) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtChainCurvesInGroup", LuaChainCurvesInGroup) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtReorderCurvesInGroup", LuaReorderCurvesInGroup) ;
|
|
return bOk ;
|
|
}
|