163 lines
4.0 KiB
C++
163 lines
4.0 KiB
C++
#ifndef _KTFITTING_H__
|
|
#define _KTFITTING_H__
|
|
|
|
#include "earthwormdef.h"
|
|
|
|
#if _MSC_VER > 1000
|
|
#pragma once
|
|
#endif
|
|
|
|
class AecDbObjXDataMap;
|
|
class KTFitting
|
|
{
|
|
protected:
|
|
KTFitting();
|
|
public:
|
|
|
|
virtual ~KTFitting();
|
|
|
|
//类型
|
|
enum Fitting
|
|
{
|
|
kPipe = 0,
|
|
kElbow = 1,
|
|
kReducer = 2,
|
|
kCap = 3,
|
|
kTee = 4,
|
|
kCross = 5,
|
|
kWye = 6,
|
|
kLateral = 7,
|
|
|
|
//...
|
|
|
|
kNone = 1000,
|
|
};
|
|
|
|
enum InterfacePs
|
|
{
|
|
kStart = 0,
|
|
kEnd = 1
|
|
};
|
|
|
|
typedef struct KTInterface
|
|
{
|
|
AcGePoint3d m_ptGe;
|
|
AcGeVector3d m_vtDir;
|
|
double m_dEl;
|
|
double m_dD;
|
|
}KTINTERFACE;
|
|
|
|
public:
|
|
|
|
//基本参数
|
|
void SetPipeParam(WPipe::PipeParam* pPipePar,BOOL bCopyFrom = FALSE);
|
|
WPipe::PipeParam* GetPipeParam();
|
|
|
|
void SetInitXData(AecDbObjXDataMap* pInitXData);
|
|
AecDbObjXDataMap* GetInitXData();
|
|
|
|
//出图比例
|
|
double GetDocScale();
|
|
|
|
//写扩展数据
|
|
void WriteXData(AcDbEntity* pEnt);
|
|
void WriteXData(AcDbEntity* pEnt,WPipe::PipeParam* pPipePar,AcGeVector3d vtDir,KTFitting::Fitting eType);
|
|
BOOL GetFitMtoInfoAll(WPipe::PipeParam* pPipePar,CString& sInfo,WPipe::PipeParam* pPipePar2 = NULL);
|
|
|
|
virtual void SaveTempXData(){}
|
|
|
|
//接口
|
|
AcGePoint3d GetInteracePoint(int nIndex = 0);
|
|
double GetInterfaceElevation(int nIndex = 0);
|
|
AcGeVector3d GetInterfaceVector(int nIndex = 0);
|
|
int GetInterfaceCount();
|
|
BOOL GetInterface(int nIndex,KTFitting::KTInterface* pInterface);
|
|
|
|
//长度
|
|
virtual double GetLength(BOOL bForIns = TRUE){return 0.0;}
|
|
|
|
//法向量
|
|
virtual void SetNormal(const AcGeVector3d& vtNormal);
|
|
virtual AcGeVector3d Normal(){return AcGeVector3d::kXAxis;}
|
|
|
|
//类型
|
|
virtual Fitting KindOf(){return kNone;};
|
|
|
|
//加Db
|
|
virtual BOOL CopyToModelSpace(){return FALSE;}
|
|
virtual BOOL AddToModelSpace(){return FALSE;}
|
|
|
|
//名称
|
|
virtual void GetName(CString& sName);
|
|
|
|
//图形
|
|
virtual BOOL GetGeomExtents(AcDbExtents& extents){return FALSE;}
|
|
virtual void TransformBy(AcGeMatrix3d& xform){};
|
|
|
|
public:
|
|
|
|
//绘制
|
|
virtual BOOL Draw(AcGiWorldDraw* mode){return FALSE;}
|
|
|
|
//设计
|
|
virtual BOOL Design(const AcGePlane* pPlane = NULL){return FALSE;}
|
|
|
|
//空间遮挡处理2D 布尔运算
|
|
virtual BOOL BooleanClip(KTFitting* pLast){return FALSE;}
|
|
|
|
//备份
|
|
virtual BOOL ClonemeForRestore(){return FALSE;}
|
|
|
|
//恢复
|
|
virtual BOOL Restore(){return FALSE;}
|
|
|
|
//删除备份
|
|
virtual BOOL DeleteForRestore(){return FALSE;}
|
|
|
|
//复制
|
|
virtual BOOL CopyFrom(KTFitting* pSrc){return FALSE;}
|
|
|
|
public:
|
|
|
|
//创建曲线
|
|
static AcDbCurve* CreateCurve(AcDbEntity* pEnt,AcRxClass* pRxClass);
|
|
static BOOL FormatDot(AcGePoint3d& ptGeCen, double dPlotWidth,AcDbPolyline* pDot,AcGePlane& plane,const AcGeVector3d& vtNorm);
|
|
static BOOL FormatArc(AcDbArc* pArc,const AcGePoint3d& ptGe1,AcGePoint3d& ptGeMid,const AcGePoint3d& ptGe2,AcGeVector3d& vtNormalOut);
|
|
static BOOL CreateCirBreakArc(AcDbCurve* pCurve,AcGePoint3d& ptGe3d,AcGeVector3d& vtDir,double dBreakSpace,double dRadius,double dPlW);
|
|
|
|
static BOOL XData2PipeParam(WPipe::PipeParam* pParamL,AecDbObjXDataMap* pObjXData,KTFitting* pFitting);
|
|
static BOOL PipeParam2XData(WPipe::PipeParam* pPipePar,AecDbObjXDataMap& xDataMap,KTFitting* pFitting);
|
|
|
|
//画承插焊的结构
|
|
static void DesignEnterCap(WPipe::PipeParam* pParam,AcGePoint3d& ptGeFr,AcGeVector3d& vtDir2Out,
|
|
AcGeVector3d& vt2D,AcDbEntity** pSubEnt,int& nFr,BOOL bEndLine = FALSE);
|
|
|
|
void AddDimPoint(AcGePoint3d& ptGe,LPCTSTR pszType,AcDbObjectIdArray& arIDs);
|
|
|
|
void AddMetPoint(WPipe::PipeParam* pParam,AecDbObjXDataMap& xDataMap,AcGePoint3d& ptGe,
|
|
LPCTSTR pszType,AcDbObjectIdArray& arIDs,KTFitting* pFitting);
|
|
|
|
protected:
|
|
|
|
WPipe::PipeParam* m_pPipeParam; //管子参数
|
|
AecDbObjXDataMap* m_pInitXData; //初始化数据
|
|
BOOL m_bPipeParamCreated; //
|
|
AcArray<KTInterface> m_arInterfaces;
|
|
};
|
|
|
|
inline double KTFitting::GetDocScale()
|
|
{
|
|
if (m_pInitXData == NULL) return 1.0;
|
|
|
|
CString sDocScale = "";
|
|
m_pInitXData->GetAt(_T("Scale"),sDocScale);
|
|
int nIndex = sDocScale.Find(':',0);
|
|
double dDocScale = 1.0;
|
|
if (nIndex != -1)
|
|
{
|
|
dDocScale = _ttof(sDocScale.Mid(nIndex + 1)) / _ttof(sDocScale.Mid(0,nIndex));
|
|
}
|
|
return dDocScale;
|
|
}
|
|
|
|
#endif //_KTFITTING_H__
|