101 lines
1.7 KiB
C++
101 lines
1.7 KiB
C++
#include "StdAfx.h"
|
|
#include "GeTrianglePface.h"
|
|
#include "ADSGePoint3d.h"
|
|
#include "GePolyFacet.h"
|
|
#include "GePface.h"
|
|
|
|
#include "globalFunc.h"
|
|
|
|
GeTrianglePface::~GeTrianglePface()
|
|
{
|
|
|
|
}
|
|
|
|
int GeTrianglePface::MakeSolid(const TCHAR *pszLay)
|
|
{
|
|
TCHAR szLayer[80] = _T("");
|
|
if (pszLay)
|
|
{
|
|
_tcscpy(szLayer, pszLay);
|
|
}
|
|
else
|
|
{
|
|
GlobalFunc::TGGetVar(_T("CLAYER"), szLayer);
|
|
}
|
|
|
|
int nLen = Length();
|
|
int nRet = RTERROR;
|
|
|
|
for (int i = 0; i < nLen; i++)
|
|
{
|
|
GeTriangle *pTri = (*this)[i];
|
|
nRet = GlobalFunc::MakeEntity(RTDXF0, _T("SOLID"), 8, szLayer, 10, &pTri->vertex1, 11, &pTri->vertex2,
|
|
12, &pTri->vertex3, 13, &pTri->vertex3, NULL);
|
|
}
|
|
|
|
return nRet;
|
|
}
|
|
|
|
// ´´½¨ Pface
|
|
int GeTrianglePface::MakePolyface(const TCHAR *pszLay)
|
|
{
|
|
GePface pface;
|
|
int nLen = Length();
|
|
|
|
for (int i = 0; i < nLen; i++)
|
|
{
|
|
GeTriangle *pTri = (*this)[i];
|
|
int nIndex1, nIndex2, nIndex3;
|
|
|
|
if (pface.FindPoint(pTri->vertex1))
|
|
{
|
|
nIndex1 = pface.CurPosition()+1;
|
|
}
|
|
else
|
|
{
|
|
pface.Append(new ADSGePoint3d(pTri->vertex1));
|
|
nIndex1 = pface.Length();
|
|
}
|
|
|
|
if (pface.FindPoint(pTri->vertex2))
|
|
{
|
|
nIndex2 = pface.CurPosition() + 1;
|
|
}
|
|
else
|
|
{
|
|
pface.Append(new ADSGePoint3d(pTri->vertex2));
|
|
nIndex2 = pface.Length();
|
|
}
|
|
|
|
if (pface.FindPoint(pTri->vertex3))
|
|
{
|
|
nIndex3 = pface.CurPosition() + 1;
|
|
}
|
|
else
|
|
{
|
|
pface.Append(new ADSGePoint3d(pTri->vertex3));
|
|
nIndex3 = pface.Length();
|
|
}
|
|
|
|
if (pTri->m_nFlag & SIDE1_INVISIBLE)
|
|
{
|
|
nIndex1 = -nIndex1;
|
|
}
|
|
|
|
if (pTri->m_nFlag & SIDE2_INVISIBLE)
|
|
{
|
|
nIndex2 = -nIndex2;
|
|
}
|
|
|
|
if (pTri->m_nFlag & SIDE3_INVISIBLE)
|
|
{
|
|
nIndex3 = -nIndex3;
|
|
}
|
|
|
|
pface.faces.Append(new GePolyFacet(nIndex1, nIndex2, nIndex3));
|
|
}
|
|
|
|
return pface.Make(pszLay);
|
|
}
|
|
|