108 lines
2.7 KiB
C++
108 lines
2.7 KiB
C++
#include "StdAfx.h"
|
|
#include "uiiado.h"
|
|
#include "ktsetting.h"
|
|
#include "AecDbEwEquipment.h"
|
|
#include "CoreTools.h"
|
|
#include "EarThwormDef.h"
|
|
|
|
#define LAY_PIPE_CENTER _T("PIPE_CEN")
|
|
#define LAY_PIPE_OUTSIDE _T("PIPE_OUT")
|
|
#define LAY_FITN_CENTER LAY_PIPE_CENTER
|
|
#define LAY_FITN_DASH _T("FITN_DSH")
|
|
|
|
namespace FENGJI
|
|
{
|
|
namespace
|
|
{
|
|
AcDbObjectId AecInitLayerEx(LPCTSTR pszLayer, LPCTSTR pszSys, int nColorIndex, LPCTSTR pszLineType, AcDbDatabase* pDb)
|
|
{
|
|
return CoreTools::AecInitLayerEx(pszLayer, pszSys, nColorIndex, pszLineType, pDb);
|
|
}
|
|
|
|
AecDbEwEquipment* makeBaseEquiment(LPCTSTR name, bool bHvac = false)
|
|
{
|
|
if (!name) return NULL;
|
|
AecDbEwEquipment* pWEquip = new AecDbEwEquipment;
|
|
AecDbObjXDataMap* pXDataMap = pWEquip->GetSpecialtyData();
|
|
pXDataMap->SetAt(KEY_NAME, name);
|
|
pXDataMap->SetAt(KEY_FITSRV, KEY_FITWPIPE);
|
|
pXDataMap->SetAt(KEY_RUNTIME, eEquipment);
|
|
|
|
//ÉèÖÃͼ²ã
|
|
CString sSys;
|
|
pXDataMap->GetAt(PIPE_SYS, sSys);
|
|
AcDbObjectId idLayer = AecInitLayerEx(LAY_PIPE_OUTSIDE, sSys, 7, _T("Continuous"), NULL);
|
|
|
|
pWEquip->setLayer(idLayer);
|
|
pWEquip->SetDashLayer(KTSetting::InitLayer(LAY_FITN_DASH));
|
|
pWEquip->SetCenterLayer(KTSetting::InitLayer(LAY_FITN_CENTER));
|
|
|
|
return pWEquip;
|
|
}
|
|
|
|
AcDbRegion* makeRectRegion(const AcGePoint3d& ptOrg
|
|
, const double& dL
|
|
, const double& dW)
|
|
{
|
|
AcGePoint3d pt0(-dL * .5, dW * .5, .0)
|
|
, pt1(dL * .5, dW * .5, .0)
|
|
, pt2(dL * .5, -dW * .5, .0)
|
|
, pt3(-dL * .5, -dW * .5, .0);
|
|
|
|
AcDbVoidPtrArray ar;
|
|
ar.append(new AcDbLine(pt0, pt1));
|
|
ar.append(new AcDbLine(pt1, pt2));
|
|
ar.append(new AcDbLine(pt2, pt3));
|
|
ar.append(new AcDbLine(pt3, pt0));
|
|
AcDbRegion* pReg = CoreTools::createRegion(ar);
|
|
|
|
if (pReg)
|
|
{
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(ptOrg.asVector());
|
|
pReg->transformBy(mat);
|
|
}
|
|
|
|
deleteArrayVoidPtrs< AcDbLine>(ar);
|
|
return pReg;
|
|
}
|
|
|
|
template <typename T>
|
|
void setData(AecEqui::XPrimData* pXPData, void* pData)
|
|
{
|
|
pXPData->m_nID = ::_time32(NULL);
|
|
switch (pXPData->m_eType)
|
|
{
|
|
case AecEqui::kExtrude:
|
|
case AecEqui::kRevolve:
|
|
pXPData->m_nSize = ((AecEqui::XBuffer*)pData)->nSize;
|
|
if (pXPData->m_nSize > 0)
|
|
{
|
|
pXPData->m_pData = new byte[pXPData->m_nSize];
|
|
::memcpy(pXPData->m_pData, ((AecEqui::XBuffer*)pData)->pData, pXPData->m_nSize);
|
|
}
|
|
break;
|
|
default:
|
|
pXPData->m_pData = new T;
|
|
::memcpy(pXPData->m_pData, pData, sizeof(T));
|
|
pXPData->m_nSize = sizeof(T);
|
|
break;
|
|
}
|
|
}
|
|
|
|
void clearData(AecEqui::XPrimData& data)
|
|
{
|
|
switch (data.m_eType)
|
|
{
|
|
case AecEqui::kExtrude:
|
|
case AecEqui::kRevolve:
|
|
DELETE_ARR_(data.m_pData);
|
|
break;
|
|
default:
|
|
DELETE_PTR(data.m_pData);
|
|
break;
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
} |