Files
envi-code/SourceCode/Code2026/inc/AecWall2DJoin.h
T

258 lines
6.6 KiB
C++
Raw Normal View History

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