Files
envi-code/SourceCode/Code2026/PIDLineCmd/KT3DModel.cpp
T
gjm 164968b62e chore
把非utf8-bom编码的cpp/h文件改为 utf8 bom 编码, msvc识别utf8编码时,如果不是bom格式的,会使用当前cp_oem来解码.
2026-10-04 00:04:20 +08:00

720 lines
17 KiB
C++

#include "stdafx.h"
#include "KT3DModel.h"
#include "geell3d.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
int KT3DModel::m_nChordSegs = 20;
KT3DModel::KT3DModel()
{
}
KT3DModel::~KT3DModel()
{
}
BOOL KT3DModel::Cube(const AcGePoint3d& ptCen,const AcGeVector3d& vtX,const AcGeVector3d& vtY,const AcGeVector3d& vtZ,AcDbVoidPtrArray& arFacePtrs)
{
AcGePoint3d ptGe[4],ptGeT[4];
AcDbFace* pFace = NULL;
//1.底面
ptGe[0] = ptCen;
ptGe[0] += 0.5 * vtX;
ptGe[0] += 0.5 * vtY;
ptGe[1] = ptGe[0] - vtY;
ptGe[2] = ptGe[1] - vtX;
ptGe[3] = ptGe[2] + vtY;
pFace = new AcDbFace;
for (int i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGe[i]);
}
arFacePtrs.append(pFace);
//2. 顶面
pFace = new AcDbFace;
for (i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGe[i] + vtZ);
}
arFacePtrs.append(pFace);
//3. 侧面1,2
ptGeT[0] = ptGe[0];
ptGeT[1] = ptGe[1];
ptGeT[2] = ptGe[1] + vtZ;
ptGeT[3] = ptGe[0] + vtZ;
pFace = new AcDbFace;
for (i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGeT[i]);
}
arFacePtrs.append(pFace);
ptGeT[0] = ptGe[2];
ptGeT[1] = ptGe[3];
ptGeT[2] = ptGe[3] + vtZ;
ptGeT[3] = ptGe[2] + vtZ;
pFace = new AcDbFace;
for (i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGeT[i]);
}
arFacePtrs.append(pFace);
//4. 侧面3,4
ptGeT[0] = ptGe[0];
ptGeT[1] = ptGe[3];
ptGeT[2] = ptGe[3] + vtZ;
ptGeT[3] = ptGe[0] + vtZ;
pFace = new AcDbFace;
for (i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGeT[i]);
}
arFacePtrs.append(pFace);
ptGeT[0] = ptGe[1];
ptGeT[1] = ptGe[2];
ptGeT[2] = ptGe[2] + vtZ;
ptGeT[3] = ptGe[1] + vtZ;
pFace = new AcDbFace;
for (i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGeT[i]);
}
arFacePtrs.append(pFace);
return TRUE;
}
BOOL KT3DModel::Cylinder(const AcGePoint3d& ptCen,double dRad,const AcGeVector3d& vtDirZ,AcDbVoidPtrArray& arFacePtrs)
{
AcGeCircArc3d cir;
cir.set(ptCen,vtDirZ,dRad);
AcGePoint3dArray arPts;
arPts.setLogicalLength(m_nChordSegs);
cir.getSamplePoints(m_nChordSegs,arPts);
AcDbFace* pFace = NULL;
for (int i = 0;i < arPts.length() - 1;i++)
{
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts.at(i));
pFace->setVertexAt(1,arPts.at(i + 1));
pFace->setVertexAt(2,arPts.at(i + 1) + vtDirZ);
pFace->setVertexAt(3,arPts.at(i ) + vtDirZ);
arFacePtrs.append(pFace);
//底面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptCen);
pFace->setVertexAt(1,arPts.at(i));
pFace->setVertexAt(2,arPts.at(i + 1));
pFace->setVertexAt(3,ptCen);
arFacePtrs.append(pFace);
//顶面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptCen + vtDirZ);
pFace->setVertexAt(1,arPts.at(i) + vtDirZ);
pFace->setVertexAt(2,arPts.at(i + 1) + vtDirZ);
pFace->setVertexAt(3,ptCen + vtDirZ);
arFacePtrs.append(pFace);
}
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts.at(arPts.length() - 1));
pFace->setVertexAt(1,arPts.at(0));
pFace->setVertexAt(2,arPts.at(0) + vtDirZ);
pFace->setVertexAt(3,arPts.at(arPts.length() - 1) + vtDirZ);
arFacePtrs.append(pFace);
//底面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptCen);
pFace->setVertexAt(1,arPts.at(arPts.length() - 1));
pFace->setVertexAt(2,arPts.at(0));
pFace->setVertexAt(3,ptCen);
arFacePtrs.append(pFace);
//顶面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptCen + vtDirZ);
pFace->setVertexAt(1,arPts.at(arPts.length() - 1) + vtDirZ);
pFace->setVertexAt(2,arPts.at(0) + vtDirZ);
pFace->setVertexAt(3,ptCen + vtDirZ);
arFacePtrs.append(pFace);
return TRUE;
}
BOOL KT3DModel::Cylinder(const AcGePoint3d& ptSta,const AcGePoint3d& ptEnd,double dRad,AcDbVoidPtrArray& arFacePtrs)
{
return Cylinder(ptSta,dRad,ptEnd - ptSta,arFacePtrs);
}
BOOL KT3DModel::Cone(const AcGePoint3d& ptCen,double dRad,const AcGeVector3d& vtH,AcDbVoidPtrArray& arFacePtrs)
{
AcGePoint3d ptTop = ptCen + vtH;
AcGeCircArc3d cir;
cir.set(ptCen,vtH,dRad);
AcGePoint3dArray arPts;
arPts.setLogicalLength(m_nChordSegs);
cir.getSamplePoints(m_nChordSegs,arPts);
AcDbFace* pFace = NULL;
for (int i = 0;i < arPts.length() - 1;i++)
{
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts.at(i));
pFace->setVertexAt(1,arPts.at(i + 1));
pFace->setVertexAt(2,ptTop);
pFace->setVertexAt(3,arPts.at(i));
arFacePtrs.append(pFace);
}
//封闭
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts.first());
pFace->setVertexAt(1,arPts.last());
pFace->setVertexAt(2,ptTop);
pFace->setVertexAt(3,arPts.first());
arFacePtrs.append(pFace);
return TRUE;
}
static void FreeBuffer(AcDbVoidPtrArray& arSubEnts)
{
AcDbEntity* pSubEnt = NULL;
for (int j = 0;j < arSubEnts.length();j++)
{
pSubEnt = (AcDbEntity*)arSubEnts.at(j);
if (pSubEnt != NULL) delete pSubEnt;
}
}
BOOL KT3DModel::Elbow(const AcGePoint3d& ptGe1,const AcGePoint3d& ptGe2,const AcGePoint3d& ptGe3,double dR,AcDbVoidPtrArray& arFacePtrs)
{
AcGeCircArc3d circArc;
circArc.set(ptGe1,ptGe2,ptGe3);
AcDbCircle cir(circArc.center(),circArc.normal(),circArc.radius());
AcGePoint3dArray pts;
AcDbVoidPtrArray arCurPtrs;
pts.append(ptGe1);
pts.append(ptGe3);
cir.getSplitCurves(pts,arCurPtrs);
AcDbArc* pArc = NULL;
if (arCurPtrs.length() == 2)
{
AcGePoint3d ptGeOn;
AcDbCurve* pCurve = NULL;
for (int i = 0;i < 2;i++)
{
pCurve = (AcDbCurve*)arCurPtrs.at(i);
if (pCurve != NULL)
{
pCurve->getClosestPointTo(ptGe2,ptGeOn);
double dDist = ptGeOn.distanceTo(ptGe2);
if (dDist < 1.e-3)
{
pArc = AcDbArc::cast(pCurve);
break;
}
}
}
}
BOOL bSuccess = FALSE;
if (pArc != NULL)
{
bSuccess = Elbow(pArc,dR,arFacePtrs);
}
FreeBuffer(arCurPtrs);
return bSuccess;
}
BOOL KT3DModel::Elbow(const AcDbArc* pArc,double dR,AcDbVoidPtrArray& arFacePtrs)
{
if (pArc == NULL) return FALSE;
double dSta,dEnd,dStep,dPar;
pArc->getStartParam(dSta);
pArc->getEndParam(dEnd);
dStep = 2 * (dEnd - dSta) / m_nChordSegs;
AcGePoint3d ptGe;
AcGeVector3d vtNorm,vtRef;
AcGeCircArc3d cir,cirL;
AcGePoint3dArray arPtsL,arPts2;
pArc->getFirstDeriv(dSta,vtNorm);
pArc->getPointAtParam(dSta,ptGe);
vtRef = ptGe - pArc->center();
cirL.set(ptGe,vtNorm,dR);
cirL.setAxes(vtNorm,vtRef);
arPtsL.setLogicalLength(m_nChordSegs);
cirL.getSamplePoints(m_nChordSegs,arPtsL);
dPar = dSta;
AcDbFace* pFace = NULL;
for (int i = 1;i < m_nChordSegs + 1;i++)
{
dPar += dStep;
pArc->getFirstDeriv(dPar,vtNorm);
pArc->getPointAtParam(dPar,ptGe);
vtRef = ptGe - pArc->center();
cir.set(ptGe,vtNorm,dR);
cir.setAxes(vtNorm,vtRef);
arPts2.setLogicalLength(m_nChordSegs);
cir.getSamplePoints(m_nChordSegs,arPts2);
//face
for (int j = 0;j < arPtsL.length() - 1;j++)
{
pFace = new AcDbFace;
pFace->setVertexAt(0,arPtsL.at(j));
pFace->setVertexAt(1,arPtsL.at(j + 1));
pFace->setVertexAt(2,arPts2.at(j + 1));
pFace->setVertexAt(3,arPts2.at(j));
arFacePtrs.append(pFace);
}
//
pFace = new AcDbFace;
pFace->setVertexAt(0,arPtsL.last());
pFace->setVertexAt(1,arPtsL.first());
pFace->setVertexAt(2,arPts2.first());
pFace->setVertexAt(3,arPts2.last());
arFacePtrs.append(pFace);
arPtsL = arPts2;
}
return TRUE;
}
BOOL KT3DModel::Pipe(const AcGePoint3d& ptCen,double dRad,const AcGeVector3d& vtDirZ,AcDbVoidPtrArray& arFacePtrs)
{
AcGeCircArc3d cir;
cir.set(ptCen,vtDirZ,dRad);
AcGePoint3dArray arPts;
arPts.setLogicalLength(m_nChordSegs);
cir.getSamplePoints(m_nChordSegs,arPts);
AcDbFace* pFace = NULL;
for (int i = 0;i < arPts.length() - 1;i++)
{
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts.at(i));
pFace->setVertexAt(1,arPts.at(i + 1));
pFace->setVertexAt(2,arPts.at(i + 1) + vtDirZ);
pFace->setVertexAt(3,arPts.at(i ) + vtDirZ);
arFacePtrs.append(pFace);
}
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts.at(arPts.length() - 1));
pFace->setVertexAt(1,arPts.at(0));
pFace->setVertexAt(2,arPts.at(0) + vtDirZ);
pFace->setVertexAt(3,arPts.at(arPts.length() - 1) + vtDirZ);
arFacePtrs.append(pFace);
return TRUE;
}
BOOL KT3DModel::Pipe(const AcGePoint3d& ptSta,const AcGePoint3d& ptEnd,double dRad,AcDbVoidPtrArray& arFacePtrs)
{
return Pipe(ptSta,dRad,ptEnd - ptSta,arFacePtrs);
}
BOOL KT3DModel::Duct(const AcGePoint3d& ptCen,const AcGeVector3d& vtX,const AcGeVector3d& vtY,const AcGeVector3d& vtZ,AcDbVoidPtrArray& arFacePtrs)
{
AcGePoint3d ptGe[4],ptGeT[4];
AcDbFace* pFace = NULL;
//1.底面
ptGe[0] = ptCen;
ptGe[0] += 0.5 * vtX;
ptGe[0] += 0.5 * vtY;
ptGe[1] = ptGe[0] - vtY;
ptGe[2] = ptGe[1] - vtX;
ptGe[3] = ptGe[2] + vtY;
/*
pFace = new AcDbFace;
for (int i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGe[i]);
}
arFacePtrs.append(pFace);
//2. 顶面
pFace = new AcDbFace;
for (i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGe[i] + vtZ);
}
arFacePtrs.append(pFace);
*/
//3. 侧面1,2
ptGeT[0] = ptGe[0];
ptGeT[1] = ptGe[1];
ptGeT[2] = ptGe[1] + vtZ;
ptGeT[3] = ptGe[0] + vtZ;
pFace = new AcDbFace;
for (int i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGeT[i]);
}
arFacePtrs.append(pFace);
ptGeT[0] = ptGe[2];
ptGeT[1] = ptGe[3];
ptGeT[2] = ptGe[3] + vtZ;
ptGeT[3] = ptGe[2] + vtZ;
pFace = new AcDbFace;
for (i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGeT[i]);
}
arFacePtrs.append(pFace);
//4. 侧面3,4
ptGeT[0] = ptGe[0];
ptGeT[1] = ptGe[3];
ptGeT[2] = ptGe[3] + vtZ;
ptGeT[3] = ptGe[0] + vtZ;
pFace = new AcDbFace;
for (i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGeT[i]);
}
arFacePtrs.append(pFace);
ptGeT[0] = ptGe[1];
ptGeT[1] = ptGe[2];
ptGeT[2] = ptGe[2] + vtZ;
ptGeT[3] = ptGe[1] + vtZ;
pFace = new AcDbFace;
for (i = 0;i < 4;i++)
{
pFace->setVertexAt(i,ptGeT[i]);
}
arFacePtrs.append(pFace);
return TRUE;
}
BOOL KT3DModel::PipeEccRed(const AcGePoint3d& ptCen1,double dRad1,const AcGePoint3d& ptCen2,double dRad2,const AcGeVector3d& vtOffset,AcDbVoidPtrArray& arFacePtrs)
{
AcGeVector3d vt1 = ptCen2 - ptCen1;
AcGeVector3d vtNorm = vt1.orthoProject(vtOffset);
AcGeCircArc3d cir1,cir2;
cir1.set(ptCen1,vtNorm,dRad1);
cir1.setAxes(vtNorm,vtOffset);
cir2.set(ptCen2,vtNorm,dRad2);
cir2.setAxes(vtNorm,vtOffset);
AcGePoint3dArray arPts1,arPts2;
arPts1.setLogicalLength(m_nChordSegs);
cir1.getSamplePoints(m_nChordSegs,arPts1);
arPts2.setLogicalLength(m_nChordSegs);
cir2.getSamplePoints(m_nChordSegs,arPts2);
AcDbFace* pFace = NULL;
for (int i = 0;i < arPts1.length() - 1;i++)
{
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts1.at(i));
pFace->setVertexAt(1,arPts1.at(i + 1));
pFace->setVertexAt(2,arPts2.at(i + 1));
pFace->setVertexAt(3,arPts2.at(i));
arFacePtrs.append(pFace);
}
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts1.first());
pFace->setVertexAt(1,arPts1.last());
pFace->setVertexAt(2,arPts2.last());
pFace->setVertexAt(3,arPts2.first());
arFacePtrs.append(pFace);
return TRUE;
}
BOOL KT3DModel::PipeRed(const AcGePoint3d& ptFr,double dRad1,const AcGePoint3d& ptTo,double dRad2,AcDbVoidPtrArray& arFacePtrs)
{
AcGeVector3d vtNorm = ptTo - ptFr;
AcGeCircArc3d cir1,cir2;
cir1.set(ptFr,vtNorm,dRad1);
cir2.set(ptTo,vtNorm,dRad2);
AcGePoint3dArray arPts1,arPts2;
arPts1.setLogicalLength(m_nChordSegs);
cir1.getSamplePoints(m_nChordSegs,arPts1);
arPts2.setLogicalLength(m_nChordSegs);
cir2.getSamplePoints(m_nChordSegs,arPts2);
AcDbFace* pFace = NULL;
for (int i = 0;i < arPts1.length() - 1;i++)
{
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts1.at(i));
pFace->setVertexAt(1,arPts1.at(i + 1));
pFace->setVertexAt(2,arPts2.at(i + 1));
pFace->setVertexAt(3,arPts2.at(i));
arFacePtrs.append(pFace);
}
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts1.first());
pFace->setVertexAt(1,arPts1.last());
pFace->setVertexAt(2,arPts2.last());
pFace->setVertexAt(3,arPts2.first());
arFacePtrs.append(pFace);
return TRUE;
}
BOOL KT3DModel::ConeRed(const AcGePoint3d& ptFr,double dRad1,const AcGePoint3d& ptTo,double dRad2,AcDbVoidPtrArray& arFacePtrs)
{
AcGeVector3d vtNorm = ptTo - ptFr;
AcGeCircArc3d cir1,cir2;
cir1.set(ptFr,vtNorm,dRad1);
cir2.set(ptTo,vtNorm,dRad2);
AcGePoint3d ptCen1,ptCen2;
ptCen1 = cir1.center();
ptCen2 = cir2.center();
AcGePoint3dArray arPts1,arPts2;
arPts1.setLogicalLength(m_nChordSegs);
cir1.getSamplePoints(m_nChordSegs,arPts1);
arPts2.setLogicalLength(m_nChordSegs);
cir2.getSamplePoints(m_nChordSegs,arPts2);
AcDbFace* pFace = NULL;
for (int i = 0;i < arPts1.length() - 1;i++)
{
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts1.at(i));
pFace->setVertexAt(1,arPts1.at(i + 1));
pFace->setVertexAt(2,arPts2.at(i + 1));
pFace->setVertexAt(3,arPts2.at(i));
arFacePtrs.append(pFace);
//底面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptCen1);
pFace->setVertexAt(1,arPts1.at(i));
pFace->setVertexAt(2,arPts1.at(i + 1));
pFace->setVertexAt(3,ptCen1);
arFacePtrs.append(pFace);
//顶面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptCen2);
pFace->setVertexAt(1,arPts2.at(i));
pFace->setVertexAt(2,arPts2.at(i + 1));
pFace->setVertexAt(3,ptCen2);
arFacePtrs.append(pFace);
}
pFace = new AcDbFace;
pFace->setVertexAt(0,arPts1.first());
pFace->setVertexAt(1,arPts1.last());
pFace->setVertexAt(2,arPts2.last());
pFace->setVertexAt(3,arPts2.first());
arFacePtrs.append(pFace);
//底面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptCen1);
pFace->setVertexAt(1,arPts1.first());
pFace->setVertexAt(2,arPts1.last());
pFace->setVertexAt(3,ptCen1);
arFacePtrs.append(pFace);
//顶面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptCen2);
pFace->setVertexAt(1,arPts2.first());
pFace->setVertexAt(2,arPts2.last());
pFace->setVertexAt(3,ptCen2);
arFacePtrs.append(pFace);
return TRUE;
}
BOOL KT3DModel::HemiSph(const AcGePoint3d& ptCen,double dRad,double dH,const AcGeVector3d& vtNorm,AcDbVoidPtrArray& arFacePtrs)
{
AcGeEllipArc3d elArc;
elArc.set(ptCen,vtNorm.perpVector(),vtNorm,dRad,dH,0,PI / 2);
AcDbLine line(ptCen,ptCen + 2.0 * dH * vtNorm);
AcGeCircArc3d cirL,cir2;
AcGePoint3dArray arPtsL,arPts2,arPtsE;
cirL.set(ptCen,vtNorm,dRad);
arPtsL.setLogicalLength(m_nChordSegs);
arPts2.setLogicalLength(m_nChordSegs);
arPtsE.setLogicalLength(m_nChordSegs);
cirL.getSamplePoints(m_nChordSegs,arPtsL);
elArc.getSamplePoints(m_nChordSegs,arPtsE);
AcDbFace* pFace = NULL;
AcGePoint3d ptGeT,ptGeT2;
for (int i = 1;i < arPtsE.length();i++)
{
ptGeT = arPtsE.at(i);
line.getClosestPointTo(ptGeT,ptGeT2);
cir2.set(ptGeT2,vtNorm,ptGeT2.distanceTo(ptGeT));
cir2.getSamplePoints(m_nChordSegs,arPts2);
//face
for (int j = 0;j < arPtsL.length() - 1;j++)
{
pFace = new AcDbFace;
pFace->setVertexAt(0,arPtsL.at(j));
pFace->setVertexAt(1,arPtsL.at(j + 1));
pFace->setVertexAt(2,arPts2.at(j + 1));
pFace->setVertexAt(3,arPts2.at(j));
arFacePtrs.append(pFace);
}
//
pFace = new AcDbFace;
pFace->setVertexAt(0,arPtsL.last());
pFace->setVertexAt(1,arPtsL.first());
pFace->setVertexAt(2,arPts2.first());
pFace->setVertexAt(3,arPts2.last());
arFacePtrs.append(pFace);
arPtsL = arPts2;
}
return TRUE;
}
BOOL KT3DModel::PyRam(const AcGePoint3d& ptSta,const AcGeVector3d& _vtX,const AcGeVector3d& _vtY,const AcGePoint3d& ptEnd,double dX2,double dY2,
AcDbVoidPtrArray& arFacePtrs)
{
AcGePoint3d ptGeB[4],ptGeT[4];
AcGeVector3d vtX(_vtX), vtY(_vtY);
ptGeB[0] = ptSta + 0.5 * vtX;
ptGeB[0] += 0.5 * vtY;
ptGeB[1] = ptGeB[0] - vtY;
ptGeB[2] = ptGeB[1] - vtX;
ptGeB[3] = ptGeB[0] - vtX;
vtX.normalize();
vtX *= dX2;
vtY.normalize();
vtY *= dY2;
ptGeT[0] = ptEnd + 0.5 * vtX;
ptGeT[0] += 0.5 * vtY;
ptGeT[1] = ptGeT[0] - vtY;
ptGeT[2] = ptGeT[1] - vtX;
ptGeT[3] = ptGeT[0] - vtX;
AcDbFace* pFace = NULL;
//底面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptGeB[0]);
pFace->setVertexAt(1,ptGeB[1]);
pFace->setVertexAt(2,ptGeB[2]);
pFace->setVertexAt(3,ptGeB[3]);
arFacePtrs.append(pFace);
//顶面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptGeT[0]);
pFace->setVertexAt(1,ptGeT[1]);
pFace->setVertexAt(2,ptGeT[2]);
pFace->setVertexAt(3,ptGeT[3]);
arFacePtrs.append(pFace);
//侧面
pFace = new AcDbFace;
pFace->setVertexAt(0,ptGeB[0]);
pFace->setVertexAt(1,ptGeB[1]);
pFace->setVertexAt(2,ptGeT[1]);
pFace->setVertexAt(3,ptGeT[0]);
arFacePtrs.append(pFace);
pFace = new AcDbFace;
pFace->setVertexAt(0,ptGeB[1]);
pFace->setVertexAt(1,ptGeB[2]);
pFace->setVertexAt(2,ptGeT[2]);
pFace->setVertexAt(3,ptGeT[1]);
arFacePtrs.append(pFace);
pFace = new AcDbFace;
pFace->setVertexAt(0,ptGeB[2]);
pFace->setVertexAt(1,ptGeB[3]);
pFace->setVertexAt(2,ptGeT[3]);
pFace->setVertexAt(3,ptGeT[2]);
arFacePtrs.append(pFace);
pFace = new AcDbFace;
pFace->setVertexAt(0,ptGeB[0]);
pFace->setVertexAt(1,ptGeB[3]);
pFace->setVertexAt(2,ptGeT[3]);
pFace->setVertexAt(3,ptGeT[0]);
arFacePtrs.append(pFace);
return TRUE;
}
BOOL KT3DModel::Container(const AcGePoint3d& ptSta,const AcGePoint3d& ptEnd,double dR,double dH,AcDbVoidPtrArray& arFacePtrs)
{
KT3DModel::Pipe(ptSta,ptEnd,dR,arFacePtrs);
//上封头
KT3DModel::HemiSph(ptEnd,dR,dH,ptEnd - ptSta,arFacePtrs);
//下封头
KT3DModel::HemiSph(ptSta,dR,dH,ptSta - ptEnd,arFacePtrs);
return TRUE;
}
BOOL KT3DModel::Cap(const AcGePoint3d& ptSta,const AcGePoint3d& ptEnd,double dR,double dH,AcDbVoidPtrArray& arFacePtrs)
{
KT3DModel::Pipe(ptSta,ptEnd,dR,arFacePtrs);
//上封头
KT3DModel::HemiSph(ptEnd,dR,dH,ptEnd - ptSta,arFacePtrs);
return TRUE;
}