275 lines
11 KiB
C++
275 lines
11 KiB
C++
#pragma once
|
|
|
|
#include "EarThwormDef.h"
|
|
#include "shJson.h"
|
|
|
|
#ifdef EARTHWORM_EXPORT
|
|
#define DLLIMPEXP __declspec(dllexport)
|
|
#else
|
|
#define DLLIMPEXP __declspec(dllimport)
|
|
#endif
|
|
|
|
#ifndef MAX_AXISROTATS
|
|
#define MAX_AXISROTATS 16
|
|
#endif
|
|
|
|
#include "AcGiDraw.h"
|
|
|
|
|
|
class DLLIMPEXP AcDbX3dSolid
|
|
{
|
|
public:
|
|
|
|
enum Primitive
|
|
{
|
|
kUnknownPrim = 0, //未知
|
|
kBox = 1, //BOX LxWxH
|
|
kCylinder = 2, //CYL RxH
|
|
kCone = 3, //CON R1xR2xH
|
|
kQPyramid = 4, //四方台 LxWxHxAng
|
|
kPipe = 5, //圆管rxtxH
|
|
kRectTube = 6, //方管子LxWxtxH
|
|
kEarthWorm = 7, //管廊段 SxL
|
|
kStairway = 8, //坡道
|
|
kLadder = 9, //爬梯和扶梯
|
|
kExtrude = 10, //拉伸体
|
|
kTorus = 11, //环形 Rxr
|
|
kWPyramid = 12, //梯形方台 LxWxHxAng1xAng2
|
|
kElbow = 13, //弯头 RxRr //半径x曲率
|
|
kTee = 14, //三通 RxLxT
|
|
kCross = 15, //四通 RxL
|
|
kReducer = 16, //变径 RxrxL
|
|
kFromSat = 17, //sat 文件
|
|
kExtrudePath = 18, //路径拉伸
|
|
kLoftExtrudePath=19,//螺旋上升拉伸体,比如弹簧
|
|
kPathPipe = 20, //路径管道
|
|
kRevolve = 21, //旋转体
|
|
kLoftReducer = 22, //两层loft变径腔体
|
|
kSHEarthWorm = 23, //盾构管廊段 SxL
|
|
kFrom3JS = 24, //从外部数据导入的三角面,构成subDMesh实体
|
|
kFenceExtrude= 25, //围栏拉伸Ponts->Extrude
|
|
kSlicePipe = 26, //斜切管状物拉伸体
|
|
kExtrude2 = 27, //标准拉伸体,region+path
|
|
kIntersect = 28, //solid的交集
|
|
kSliceSolid = 29, //切割体
|
|
kConePipe = 30, //Cone斜管杯体
|
|
kTydf = 31, //天圆地方
|
|
kDrum = 32, //鼓
|
|
kFrustum = 33, //球台
|
|
kNozzle = 34, //管嘴
|
|
kTriPyramid = 35, //三棱锥
|
|
kWedge = 36, //楔形体
|
|
kSpere = 37, //球体
|
|
kRevolve2 = 38, //旋转2
|
|
kPyramid = 39, //四方台,上下面不一至,用loft方法画出
|
|
kSweep = 40, //标准扫掠体
|
|
kLoft = 41, //标准放样体
|
|
};
|
|
|
|
public:
|
|
|
|
AcDbX3dSolid(void);
|
|
AcDbX3dSolid(const AcDbX3dSolid& xSolid);
|
|
~AcDbX3dSolid(void);
|
|
|
|
static Adesk::UInt32 kCurrentVersionNumber;
|
|
|
|
//ext: Create(kBox,3,10.0,10.0,12.0);
|
|
bool Create(AcDbX3dSolid::Primitive eType,const AcGePoint3d& ptOrg,const AcGeVector3d& vtZ,int n,...);
|
|
Acad::ErrorStatus ReCreate();
|
|
|
|
//起点长度管廊段
|
|
bool CreateEarthWorm(const AcGePoint3d& ptOrg,const AcGeVector3d& vtZ,LPCTSTR pszScr,double dLen,const AcGeVector3d& vtLast,const AcGeVector3d& vtNext);
|
|
//三点直线管廊段或圆弧管廊段
|
|
bool CreateEarthWorm(const AcGePoint3d& ptSta,const AcGePoint3d& ptMid,const AcGePoint3d& ptEnd,LPCTSTR pszScr,const AcGeVector3d& vtLast,const AcGeVector3d& vtNext);
|
|
|
|
//盾构管廊段
|
|
bool CreateSHEarthWorm(const AcGePoint3d& ptOrg,const AcGeVector3d& vtZ,STSection* pSection,double dLen,const AcGeVector3d& vtLast,const AcGeVector3d& vtNext);
|
|
|
|
bool CreateStairWay(const AcGePoint3d& ptFr,const AcGePoint3d& ptTo,const AcGeVector3d& vtDirX,float fStepH,float fStepW,float fStairW);
|
|
bool CreateLadder(const AcGePoint3d& ptFr,const AcGeVector3d& vtDirX,const AcGeVector3d& vtDirXY,double dH,double dW,int nKind);
|
|
bool CreateExtrude(const AcGePoint3d& ptOrg,const AcGeVector3d& vtZ,LPCTSTR pszPoint2ds,double dH,double dT,BOOL bOpenTop = FALSE);
|
|
bool CreateExtrude(const AcDbRegion* pRegion,const AcDbLine& lnPath,double dTapAngle = 0.0);
|
|
bool CreateConePipe(const AcDbRegion* pRegionOut,const AcDbRegion* pRegionIn,const AcDbLine& lnPath,double dTapAngle,double dThick);
|
|
|
|
bool CreatePathExtrude(const AcGePoint3d& ptOrg,LPCTSTR pszPath,int nShape,int nF,double dW,double dH,double dT,double dT2,double dT3,double dE0,double dE1,AcGeVector3d& vtCut1,AcGeVector3d& vtCut2);
|
|
bool CreateFenceExtrude(const AcGePoint3d& ptOrg,const AcGePoint3d* pPoints,int nPoints,const AcGeVector3d& vtZ,double dH);
|
|
|
|
bool CreateTriangularPyramid(const AcGePoint3d &pt0
|
|
, const AcGePoint3d &pt1
|
|
, const AcGePoint3d &pt2
|
|
, const AcGePoint3d &pt3);
|
|
|
|
//管道示意
|
|
bool CreatePipe(const AcGePoint3d& ptOrg,LPCTSTR pszPath,int nShape,double dW,double dH,double dT1,double dT2,double dT3,AcGeVector3d& vtCut1,AcGeVector3d& vtCut2);
|
|
bool CreateElbow(const AcGePoint3d& ptMid,const AcGeVector3d& vtMaj,const AcGeVector3d& vtMin,double dSweepAngle,double dR,double dRatio);
|
|
bool CreateTee(const AcGePoint3d& ptMid,const AcGeVector3d& vtMaj,const AcGeVector3d& vtMin,double dR ,double dL,double dt);
|
|
bool CreateCross(const AcGePoint3d& ptMid,const AcGeVector3d& vtMaj,const AcGeVector3d& vtMin,double dR,double dL);
|
|
bool CreateReducer(const AcGePoint3d& ptMid,const AcGeVector3d& vtMaj,double dR,double dr,double dL);
|
|
bool CreateFromSat(LPCTSTR pszSatFile,double dUnitScale);
|
|
bool CreateLoftReducer(LPCTSTR pszarTopPts,LPCTSTR pszarBomPts,double dBomEl,double dH,double dThick,double dBomThick);
|
|
bool CreateSlicePipe(const AcDbRegion* pRegion,const AcDbLine& lnPath,const AcGePoint3d& ptPlanOrg,const AcGeVector3d& vtPlanNormal);
|
|
bool CreateIntersect(const AcDbRegion* pRegion,const AcDbLine& lnPath,const AcGePoint3d& ptOrg,AcDbCurve* pFenceCrv,const AcGeVector3d& vtExDir);
|
|
bool CreateSliceSolid(const AcDbCurve* pPlFenceTop,const AcDbLine& lnPath,const AcGePoint3d& ptOrg,const AcDbRegion* pRegionWall,double dWallHeight,const AcGeVector3d& vtExDir);
|
|
bool CreateRevolve(const AcDbRegion* pRegion,const AcGePoint3d& ptOrg,const AcGeVector3d& vtAxis,double dSweepAngle);
|
|
bool CreateRevolve2(AcDbRegion *pegion
|
|
, const AcGePoint3d &ptOrg
|
|
, const AcGeVector3d &vtAxis
|
|
, double dSweepAngle
|
|
, double dStartAngle);
|
|
|
|
// 标准loft体
|
|
bool CreateLoft(const AcArray<AcDbRegion*> &crossSectionCruves, AcDbCurve *pCurve = NULL);
|
|
// 标准sweep体
|
|
bool CreateSweep(const AcDbRegion* pSweepEnt, const AcDbPolyline *pPathEnt);
|
|
|
|
// subDMesh
|
|
bool CreateFrom3JS(
|
|
double dUnitScale
|
|
, const AcGeVector3d &vtMove
|
|
, const AcGePoint3dArray &pts2d
|
|
, const AcGePoint3dArray &pts
|
|
, const AcArray<Adesk::Int32> &faces);
|
|
|
|
bool CreateTydf(const AcGePoint3d &ptPos,
|
|
const AcGeVector3d &vtMove,
|
|
const double &Tr,
|
|
const double &Bx,
|
|
const double &By,
|
|
const double &H,
|
|
const double &xOffset,BOOL bIsTfdy = FALSE);
|
|
|
|
AcDb3dSolid* GetDraw3dSolid() const;
|
|
AcDb3dSolid* GetNative3dSolid() const;
|
|
|
|
#if ARX > 17
|
|
AcDbSubDMesh* GetDrawSubDMesh() const;
|
|
void GetDrawSubDMesh2D(AcArray<AcGeLineSeg3d> &ar) const;
|
|
AcDbSubDMesh* GetNativeSubDMesh() const;
|
|
bool CreateSubDMeshByMemory();
|
|
void UpdateSubDMeshData();
|
|
#endif
|
|
|
|
bool GetDraw2d(AcDbVoidPtrArray& arCurPtrs);
|
|
|
|
AcGePoint3d GetOrgPoint() const;
|
|
void SetOrgPoint(const AcGePoint3d &pt);
|
|
int SetActiveFace(int nFace);
|
|
void SetGSMarkerID(Adesk::Int32 nMarker);
|
|
Adesk::Int32 GetGSMarkerID() const;
|
|
|
|
AcDbX3dSolid::Primitive GetPrimitive() const {return m_eType;}
|
|
AcGeVector3d GetvtZ() const {return m_vtZ;}
|
|
int GetSizes(AcArray<double>& arSizes) const;
|
|
|
|
bool GetInterface(AcArray<AecInterface>& arInfs) const;
|
|
|
|
//获取轴向
|
|
int GetAxisCount() const;
|
|
AcGeVector3d GetAxis(int nIndex) const;
|
|
|
|
//移动
|
|
void AddMove(const AcGeVector3d& vtMove);
|
|
void ResetMove();
|
|
|
|
//旋转
|
|
void AddRotate(double dRot,int nAxisIndex);
|
|
void ResetRotate(int nAxisIndex);
|
|
|
|
AcDb3dSolid* CreateLoftSolid(const AcGePoint3d& ptOrg,AcDbPolyline& pl,int nShape,double dW,double dH,double dT,double dT2,double dT3,int nF,double dE0,double dE1,AcGeVector3d& vtCut1,AcGeVector3d& vtCut2);
|
|
AcDb3dSolid* CreatePathSolid(const AcGePoint3d& ptOrg,AcDbPolyline& pl,int nShape,double dW,double dH,double dT,double dT2,double dT3,double dE0,double dE1,AcGeVector3d& vtCut1,AcGeVector3d& vtCut2);
|
|
SHJson::WValue& ToJson() const;
|
|
bool ByJson(const SHJson::WValue &v);
|
|
|
|
AcGePoint3d GetCentoridPoint();
|
|
|
|
void TransformBy(const AcGeMatrix3d &mat);
|
|
|
|
AcDbX3dSolid* Clone();
|
|
|
|
public:
|
|
|
|
Acad::ErrorStatus Draw3d(AcGiDraw &dc) const;
|
|
Acad::ErrorStatus DrawActiveFace(AcGiDraw &dc) const;
|
|
|
|
Acad::ErrorStatus dwgInFields (AcDbDwgFiler* pFiler);
|
|
Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
|
|
|
|
static bool GetLoftReducerSides(CString& sPoint2ds,AcGePoint2dArray& arTopPts,AcGePoint2dArray& arBomPts);
|
|
|
|
bool GetSolidData(const Primitive &type, AcArray<double> &ar, CString *pSrc = NULL);
|
|
bool SetSolidData(const Primitive &type, const AcArray<double> &ar, LPCTSTR srcRegion = NULL);
|
|
void SetSatBuffer(const int &len, const void *pBuffer);
|
|
int GetSatBuffer(void **pBuffer);
|
|
|
|
// 下面函数为 单体异构-修改 功能所用
|
|
bool GetExturd2Data(CString &sReg, AcGePoint3d &ptFr, AcGePoint3d &ptTo);
|
|
void SetExturd2Data(const CString &sReg, const AcGePoint3d &ptFr, const AcGePoint3d &ptTo);
|
|
|
|
bool GetRevolve2Data(CString &sReg, AcGePoint3d &ptOrg, AcGeVector3d &vt, double &dSweepAngle, double &dStartAngle);
|
|
void SetRevolve2Data(const CString &sReg, const AcGePoint3d &ptOrg, const AcGeVector3d &vt, const double &dSweepAngle, double const &dStartAngle);
|
|
|
|
bool GetSweepData(CString &sReg, AcDbCurve *&pCurve);
|
|
void SetSweepData(const CString &sReg, const AcDbCurve *pCurve);
|
|
|
|
bool GetLoftData(std::vector<CString> ®s);
|
|
void SetLoftData(const std::vector<CString> ®s);
|
|
//------------
|
|
|
|
Primitive GetSolidType() { return m_eType; }
|
|
|
|
|
|
protected:
|
|
|
|
//以下数据序列化,根据 m_eType 类型选用.
|
|
AcDbX3dSolid::Primitive m_eType; //类型
|
|
AcGeVector3d m_vtZ; //放置方向向量
|
|
AcArray<double> m_arSizes; //参数
|
|
AcGePoint3d m_ptOrg; //中心点
|
|
CString m_sszPoint2ds; //
|
|
double m_dH; //
|
|
double m_dT; //
|
|
double m_dW; //
|
|
CString m_sScr; //管廊段脚本,及其他脚本
|
|
double m_dLen;
|
|
AcGeVector3d m_vtLast; //管廊段上向量,管线 其他使用
|
|
AcGeVector3d m_vtNext; //管廊段下向量,管线 其他使用
|
|
|
|
//楼梯
|
|
AcGePoint3d m_ptFr;
|
|
AcGePoint3d m_ptTo;
|
|
AcGeVector3d m_vtDirx;
|
|
AcGeVector3d m_vtDirXY;
|
|
float m_fStair[3]; //
|
|
Adesk::Int32 m_nKind; //类型
|
|
|
|
//变换部分
|
|
AcGeVector3d m_vtMove; //总移动
|
|
AcGeVector3dArray m_arAxisVector; //轴向向量
|
|
double m_dAxisRotats[MAX_AXISROTATS];//最多10个轴向旋转
|
|
|
|
Adesk::UInt32 m_nSatLen;
|
|
void* m_pSatBuffer;
|
|
|
|
//以上数据创建的模型,->不序列化
|
|
AcDb3dSolid* m_pSolid; //原始solid元,不序列化
|
|
AcDbVoidPtrArray m_arCurPtrs; //创建的二维曲线
|
|
|
|
#if ARX > 17
|
|
AcDbSubDMesh *m_pSubDMesh; //支持外部导入的三角面
|
|
AcArray<AcGeLineSeg3d> m_pSubDMesh2Ds; //三角面的2D显示,一堆直线
|
|
mutable AcDbSubDMesh* m_pSubDMeshDraw; //临时绘制SubDMesh元不序列化
|
|
#endif
|
|
|
|
//临时,不序列化
|
|
mutable AcDb3dSolid* m_pSolidDraw; //临时绘制solid元不序列化
|
|
mutable AcDbVoidPtrArray m_arRegionFaces; //各个face 面 不序列化
|
|
mutable SHJson::WValue m_json;
|
|
};
|
|
|
|
typedef struct X3dSolidRec
|
|
{
|
|
AcDbX3dSolid* pXSolid;
|
|
AcDb::BoolOperType bType;//AcDb::kBoolIntersect特指可剖开的外皮
|
|
TCHAR szLockId[39];
|
|
}X3DSOLIDREC; |