259 lines
6.3 KiB
C++
259 lines
6.3 KiB
C++
#pragma once
|
|
|
|
#define MAX_T_STRS 512
|
|
|
|
typedef struct WallEnd
|
|
{
|
|
double dParamOnM;
|
|
double dThick;
|
|
int nWallWeight;
|
|
AcGePoint3d ptEnd;
|
|
AcGeVector3d vtEnd;
|
|
AcDbObjectId id;
|
|
AcDbObjectId idCol; //本处的可能柱子 T结构
|
|
AecComplexCurve* pWallCmpl;
|
|
}WALLEND;
|
|
|
|
typedef struct WallLn
|
|
{
|
|
double dThick;
|
|
short nType;
|
|
int nWallWeight;
|
|
AcGePoint3d ptGe[3];
|
|
AcDbObjectId id;
|
|
AecComplexCurve* pWallCmpl;
|
|
}WALLLN;
|
|
|
|
typedef struct ColEnd
|
|
{
|
|
AcGePoint3d ptPos;
|
|
AcDbObjectId id;
|
|
AecComplexCurve* pColCmpl;
|
|
}COLEND;
|
|
|
|
//柱子关联墙体结构
|
|
typedef struct ColOnWall
|
|
{
|
|
AcGePoint3d ptPos;
|
|
AcDbObjectId idCol;
|
|
AcDbObjectId idWall;
|
|
AecComplexCurve* pColCmpl;
|
|
}COLONWALL;
|
|
|
|
//端部 X字结
|
|
typedef struct WallXJoin
|
|
{
|
|
AcGePoint3d ptJoin;
|
|
int nValid;
|
|
double dThick;
|
|
int nWallWeight[4];
|
|
AcDbObjectId ids[4];//一般建筑最多为十字结
|
|
AcGeVector3d vtEnd[4];
|
|
double dThicks[4];
|
|
AcDbObjectId idCol; //本处的可能柱子
|
|
}WALLJOIN;
|
|
|
|
//端部 T字结
|
|
typedef struct WallTJoin
|
|
{
|
|
AcDbObjectId idMain;
|
|
int nValid;
|
|
int nWallWeight;
|
|
WallEnd wes[MAX_T_STRS];//搭接的墙体,最多为512个
|
|
}WALLTJOIN;
|
|
|
|
//中间 相交结构
|
|
typedef struct WallIntJoin
|
|
{
|
|
AcDbObjectId id1;
|
|
AcDbObjectId id2;
|
|
AcGePoint3d ptInt;
|
|
}WALLINTJOIN;
|
|
|
|
//两墙体==平行连接结构
|
|
typedef struct WallCJoin
|
|
{
|
|
AcGePoint3d ptJoin;
|
|
int nValid;
|
|
double dThick;
|
|
int nWallWeight[2];
|
|
AcDbObjectId ids[2];//两墙体==平行连接
|
|
AcGeVector3d vtEnd[2];
|
|
double dThicks[2];
|
|
AcDbObjectId idCol; //本处的可能柱子
|
|
}WALLCJOIN;
|
|
|
|
typedef struct WallExtend
|
|
{
|
|
AcDbObjectId idWall;
|
|
AcDbObjectId idMain;
|
|
int nEnds;
|
|
int nNearSide;
|
|
Adesk::Boolean bExtendSta[2];
|
|
AcGePoint3d ptOn[2];
|
|
AcGeVector3d vtEnd[2];
|
|
AecEqui::AecCurveElement el[2];
|
|
}WALLEXTEND;
|
|
|
|
//Extend(pWallE,bExtendSta,ptOn1);
|
|
//pWallE->GetStandardDraw2d();
|
|
//pWallE->RemoveTailDraw2d(ptOn1);
|
|
//TrimEnd(pWallE,el,we.vtEnd);
|
|
|
|
typedef struct ColumnJoin
|
|
{
|
|
AcGePoint3d ptPos;
|
|
AcDbObjectId idCol;
|
|
}COLUMNJOIN;
|
|
|
|
typedef struct IdParamEl
|
|
{
|
|
AcDbObjectId id;
|
|
double dParam;
|
|
bool bIsOverParallel;
|
|
int nWallWeight;
|
|
AecEqui::AecCurveElement eL;
|
|
AecEqui::AecCurveElement eR;
|
|
}IDPARAM;
|
|
|
|
typedef struct IdAngleEl
|
|
{
|
|
AcDbObjectId id;
|
|
double dParam;
|
|
bool bIsOverParallel;//共线平行
|
|
int nWallWeight;
|
|
AecEqui::AecCurveElement el;
|
|
}IDANGLEEL;
|
|
|
|
/*--------------------------------------
|
|
墙体端部
|
|
X 结构的连接处理
|
|
T 结构的连接处理
|
|
不支持相交结构的处理
|
|
---------------------------------------*/
|
|
#ifdef EARTHWORM_EXPORT
|
|
#define DLLIMPEXP __declspec(dllexport)
|
|
#else
|
|
#define DLLIMPEXP __declspec(dllimport)
|
|
#endif
|
|
|
|
class DLLIMPEXP AecWall2DJoin
|
|
{
|
|
public:
|
|
AecWall2DJoin(void);
|
|
~AecWall2DJoin(void);
|
|
|
|
//结构视图
|
|
bool DoStruDraw(bool b3dUnit = false);
|
|
|
|
public:
|
|
|
|
//区域命令
|
|
bool DoStruDraw(AcDbObjectIdArray& arIds,bool b3dUnit = false);
|
|
bool DoWall2DDraw(AcDbObjectIdArray& arIds);
|
|
|
|
protected:
|
|
|
|
//区域命令调用
|
|
bool BuildXTJoins(AcDbObjectIdArray& arIds);
|
|
|
|
//先BuildXTJoins 然后执行总墙体融合
|
|
//融合算法方法->在该点逆时针旋转圆排序
|
|
//不处理大尺寸相交结构,如果大尺寸相交
|
|
//事先打断
|
|
bool DoWall2DJoin();
|
|
|
|
//情况缓存
|
|
void ClearBuffer();
|
|
|
|
//添加WE结构,初步构建X结构集合
|
|
void AppendWallEnd(const WallEnd& wallEnd,int nFlag);
|
|
|
|
//添加搭边
|
|
void AppendWallTJoin(AcDbObjectId& idMain,const WallEnd& we, int nMainWeight);
|
|
|
|
//判断是否相交
|
|
bool IsIntJoin(WallLn& wl,WallLn& wl2,AcGePoint3d& ptInt) const;
|
|
|
|
//判断是否搭接结构
|
|
bool IsTJoin(WallEnd& we,WallLn& wl) const;
|
|
|
|
//相交的裁剪
|
|
void IntJoinsBoolSubtract();
|
|
|
|
//延伸到柱子
|
|
virtual void ExtendToColumnRegion(const WallXJoin& wj);
|
|
|
|
//逆时针排序然后R-L裁剪
|
|
virtual void XJoinSortAndTrimByUClock(const WallXJoin& wj);
|
|
|
|
//R-L裁剪
|
|
bool TrimCurveElement(IdAngleEl& ael1,IdAngleEl& ael2,AcGePoint3d& ptInt);
|
|
|
|
//Main上排序,然后裁剪M,融合
|
|
virtual void TJoinSortAndTrimByMain(const WallTJoin& wt);
|
|
|
|
void UnClockWiseSortLR(std::vector<IdParamEl>& vtIdParams,const AcGePoint3d& ptOn,std::vector<IdAngleEl>& vtIdAngleEl);
|
|
|
|
//考虑到立面墙体问题
|
|
AcGePoint3d GetWallStartPoint(AecDbXWall* pWall) const;
|
|
|
|
AcGePoint3d GetWallEndPoint(AecDbXWall* pWall) const;
|
|
|
|
//获取切线
|
|
AcGeVector3d GetWallFirstDeriv(AecDbXWall* pWall,const AcGePoint3d& ptGeOn) const;
|
|
|
|
Acad::ErrorStatus Extend(AecDbXWall*pWall,Adesk::Boolean extendStart,const AcGePoint3d& toPoint, AcGeVector3d &vtEnd, AcDbObjectId &idMain, int nNearSide);
|
|
|
|
void GetMidPoint(AecDbXWall* pWall,AcGePoint3d& ptMid);
|
|
|
|
//获取统一的墙体基线,用完需要删除
|
|
AcDbCurve* GetWallBaseCurve(AecDbXWall* pWall);
|
|
|
|
bool TrimLineArcElement(AcDbLine* pLn,AecEqui::AecCurveElement& el1,AcDbArc* pArc,AecEqui::AecCurveElement& el2,AcGePoint3d& ptInt);
|
|
|
|
void GetBreakPoint(AcDbCurve* pCurE,AcDbCurve* pCutTo,AcGePoint3d& ptEnd,AecEqui::AecCurveElement& el,const AcGeVector3d& vtEnd,double dThick);
|
|
|
|
Acad::ErrorStatus TrimEnd(AecDbXWall* pWallE,AecEqui::AecCurveElement& el,const AcGeVector3d& vtEnd);
|
|
|
|
int GetNearSideTo(AcDbCurve* pCurE,AcGePoint3d& ptEnd,const AcGeVector3d& vtEnd,AcDbCurve* pCurM,AcDbCurve* pLeft,AcDbCurve* pRight,double dThick);
|
|
|
|
void AppendExtend(const AcDbObjectId& id,Adesk::Boolean bExtendSta,const AcGePoint3d& ptOn,AecEqui::AecCurveElement& el,const AcGeVector3d& vtEnd, int nNearSide, const AcDbObjectId &idMain);
|
|
|
|
void AddXPart(AecDbXWall* pWallE,const AcGePoint3d& ptEnd,const AcGeVector3d& vtEnd,Adesk::Boolean bExtendSta,const AecEqui::AecCurveElement& el);
|
|
|
|
//补空洞
|
|
void AddXPart(AecDbXWall* pWall,AcGePoint3dArray& arPtInts,const AcGePoint3d& ptOn);
|
|
|
|
//创建挖去的柱子
|
|
AecDbX3dPart* Create3DSolid(AecComplexCurve& cmplCol,WallData& data1,WallData& data2);
|
|
|
|
//柱子关联墙体
|
|
bool ColumnAssocWall(ColEnd& ce,WallEnd& weT);
|
|
bool ColumnAssocWall(ColEnd& ce,AcGePoint3d& ptPos);
|
|
bool ColumnAssocWall(ColEnd& ce,WallLn& weT);
|
|
|
|
void ColumnClipWall(ColOnWall& colWall);
|
|
|
|
//材料比重,用于墙体的比较
|
|
int MaterialWeight(LPCTSTR pszMaterial);
|
|
|
|
//工艺线后重墙的端线
|
|
bool CalWeightWallEndLine(IdParamEl &idPW, IdParamEl &idPQ, AecEqui::AecCurveElement &elWEnd, AecEqui::AecCurveElement &elWExt);
|
|
|
|
protected:
|
|
|
|
AcArray<WallXJoin> m_arXJoins; //x结构
|
|
AcArray<WallTJoin> m_arTJoins; //T结构
|
|
AcArray<WallIntJoin> m_arIntJoins; //+相交结构
|
|
AcArray<WallCJoin> m_arCJoins; //==连接结构 墙体break等两墙体连接
|
|
|
|
AcArray<WallExtend> m_arWallExtends;//计算产生延长结构
|
|
AcArray<ColOnWall> m_arColOnWall; //柱子关联墙体
|
|
|
|
AcArray<AecComplexCurve*> m_arCmplPtrs;//临时缓存
|
|
CMapStringToPtr m_mapIdToPtr;//获取墙体的id和基线映射
|
|
AcDbObjectIdArray m_arIDsWallHasOpening;
|
|
mutable AcDbVoidPtrArray m_arTestEntPtrs;//TEST
|
|
};
|