2026-10-04 00:04:20 +08:00
|
|
|
|
#include "stdafx.h"
|
2026-09-28 15:28:50 +08:00
|
|
|
|
#include "AecDbArcSegStairDraw.h"
|
|
|
|
|
|
#include "AecDbArcSegStair.h"
|
|
|
|
|
|
#include "AecDbEarthWorm.h"
|
|
|
|
|
|
#include "AcDbX3dSolid.h"
|
|
|
|
|
|
#include "EarThwormDef.h"
|
|
|
|
|
|
#include "CoreTools.h"
|
|
|
|
|
|
|
|
|
|
|
|
static const Adesk::UInt16 kColorByBlock = 0;
|
|
|
|
|
|
static const Adesk::UInt16 kRed = 1;
|
|
|
|
|
|
static const Adesk::UInt16 kYellow = 2;
|
|
|
|
|
|
static const Adesk::UInt16 kGreen = 3;
|
|
|
|
|
|
static const Adesk::UInt16 kCyan = 4;
|
|
|
|
|
|
static const Adesk::UInt16 kBlue = 5;
|
|
|
|
|
|
static const Adesk::UInt16 kMagenta = 6;
|
|
|
|
|
|
static const Adesk::UInt16 kWhite = 7;
|
|
|
|
|
|
static const Adesk::UInt16 kColorByLayer = 256;
|
|
|
|
|
|
|
|
|
|
|
|
DLLIMPEXP AcDbPolyline* FormatPolyline(AcGePoint3d* ppPts, int nCount);
|
|
|
|
|
|
DLLIMPEXP AcDb3dPolyline* Format3dPolyline(const AcGePoint3dArray& arPts);
|
|
|
|
|
|
|
|
|
|
|
|
ACRX_CONS_DEFINE_MEMBERS(AecDbArcSegStairDraw,AecDbXDraw,0);
|
|
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
|
|
{
|
|
|
|
|
|
AcDbRegion* makeRectRegion(const AcGePoint3d& ptOrg
|
|
|
|
|
|
, const bool& bIsCenterPt
|
|
|
|
|
|
, const double& dL
|
|
|
|
|
|
, const double& dW
|
|
|
|
|
|
, const AcGeVector3d& vecL
|
|
|
|
|
|
, const AcGeVector3d& vecW
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
AcGePoint3d ptGe[5];
|
|
|
|
|
|
|
|
|
|
|
|
if (bIsCenterPt)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// ptOrg为矩形的中心点
|
2026-09-28 15:28:50 +08:00
|
|
|
|
ptGe[0] = ptOrg + vecW * dW * .5;
|
|
|
|
|
|
ptGe[0] += vecL * dL * .5;
|
|
|
|
|
|
ptGe[1] = ptGe[0] - vecW * dW;
|
|
|
|
|
|
ptGe[2] = ptGe[1] - vecL * dL;
|
|
|
|
|
|
ptGe[3] = ptGe[2] + vecW * dW;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// ptOrg为矩形的顶点
|
2026-09-28 15:28:50 +08:00
|
|
|
|
ptGe[0] = ptOrg - vecL * dL;
|
|
|
|
|
|
ptGe[1] = ptGe[0] - vecW * dW;
|
|
|
|
|
|
ptGe[2] = ptGe[1] + vecL * dL;
|
|
|
|
|
|
ptGe[3] = ptGe[2] + vecW * dW;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[4] = ptGe[0];
|
|
|
|
|
|
|
|
|
|
|
|
return AecDbEarthWorm::CreatePolygonRegionOnly(ptGe, 5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 通过两个点获取矩形截面
|
2026-09-28 15:28:50 +08:00
|
|
|
|
AcDbRegion* makeRectRegionByPts(const AcGePoint3d& ptL
|
|
|
|
|
|
, const AcGePoint3d& ptR
|
|
|
|
|
|
, const double& dL
|
|
|
|
|
|
, const double& dW
|
|
|
|
|
|
, const AcGeVector3d& vecL
|
|
|
|
|
|
, const AcGeVector3d& vecW
|
|
|
|
|
|
)
|
|
|
|
|
|
{
|
|
|
|
|
|
AcGePoint3d ptGe[5];
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[0] = ptL;
|
|
|
|
|
|
ptGe[1] = ptR;
|
|
|
|
|
|
ptGe[2] = ptGe[1] - vecW * dW;
|
|
|
|
|
|
ptGe[3] = ptGe[2] + vecL * dL;
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[4] = ptGe[0];
|
|
|
|
|
|
|
|
|
|
|
|
return AecDbEarthWorm::CreatePolygonRegionOnly(ptGe, 5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDbRegion* makeCircleRegion(const AcGePoint3d& ptOrg
|
|
|
|
|
|
, const AcGeVector3d& vtZ
|
|
|
|
|
|
, const double& dR)
|
|
|
|
|
|
{
|
|
|
|
|
|
AcDbCircle* pCir(new AcDbCircle(ptOrg, vtZ, dR));
|
|
|
|
|
|
if (!pCir) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
return CoreTools::createRegion(pCir);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 获取圆弧长度
|
2026-09-28 15:28:50 +08:00
|
|
|
|
double getArcLen(const AcDbArc* pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
AcGePoint3d ptE;
|
|
|
|
|
|
pArc->getEndPoint(ptE);
|
|
|
|
|
|
|
|
|
|
|
|
double dLen(.0);
|
|
|
|
|
|
pArc->getDistAtPoint(ptE, dLen);
|
|
|
|
|
|
|
|
|
|
|
|
return dLen;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 2D 获取圆弧凸度
|
2026-09-28 15:28:50 +08:00
|
|
|
|
double getBulge(const AcDbArc* pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
double dStaAngle = pArc->startAngle();
|
|
|
|
|
|
double dEndAngle = pArc->endAngle();
|
|
|
|
|
|
double dAngleDiff = dEndAngle - dStaAngle;
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 终止角度小于起始角度
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (dAngleDiff < 0.0)
|
|
|
|
|
|
{
|
|
|
|
|
|
dAngleDiff = 2 * PI + dAngleDiff;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return tan(dAngleDiff / 4);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d getRegCenter(AcDbRegion* pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
AcDbExtents ext;
|
|
|
|
|
|
pReg->getGeomExtents(ext);
|
|
|
|
|
|
AcGePoint3d ptCen(CoreTools::MidPt(ext.maxPoint(), ext.minPoint()));
|
|
|
|
|
|
return ptCen;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 2D 楼梯 多段线包含圆弧
|
2026-09-28 15:28:50 +08:00
|
|
|
|
AcDbPolyline* makePoly(const AcDbVoidPtrArray& CurveAr
|
|
|
|
|
|
, const double& dBulge
|
|
|
|
|
|
, const BOOL& bIsLine)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CurveAr.length() < 1) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d ptGe[5];
|
|
|
|
|
|
|
|
|
|
|
|
AcDbArc* pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc) return NULL;
|
|
|
|
|
|
pArc->getStartPoint(ptGe[0]);
|
|
|
|
|
|
pArc->getEndPoint(ptGe[1]);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc) return NULL;
|
|
|
|
|
|
pArc->getEndPoint(ptGe[2]);
|
|
|
|
|
|
pArc->getStartPoint(ptGe[3]);
|
|
|
|
|
|
ptGe[4] = ptGe[0];
|
|
|
|
|
|
|
|
|
|
|
|
AcDbPolyline* pPoly = FormatPolyline(ptGe, 5);
|
|
|
|
|
|
if (!pPoly)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return NULL;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
if (!bIsLine) // 多段线包含圆弧
|
2026-09-28 15:28:50 +08:00
|
|
|
|
{
|
|
|
|
|
|
pPoly->setBulgeAt(0, dBulge);
|
|
|
|
|
|
pPoly->setBulgeAt(2, -dBulge);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return pPoly;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 画楼梯 3D 截面为直线, 不包括圆弧
|
2026-09-28 15:28:50 +08:00
|
|
|
|
AcDbRegion* makeStairsReg(const AcDbVoidPtrArray& CurveAr, const double& dBulge)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CurveAr.length() < 1) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d ptGe[5];
|
|
|
|
|
|
|
|
|
|
|
|
AcDbArc* pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc) return NULL;
|
|
|
|
|
|
pArc->getStartPoint(ptGe[0]);
|
|
|
|
|
|
pArc->getEndPoint(ptGe[1]);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc) return NULL;
|
|
|
|
|
|
pArc->getEndPoint(ptGe[2]);
|
|
|
|
|
|
pArc->getStartPoint(ptGe[3]);
|
|
|
|
|
|
ptGe[4] = ptGe[0];
|
|
|
|
|
|
|
|
|
|
|
|
return AecDbEarthWorm::CreatePolygonRegionOnly(ptGe, 5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDbCurve* makeOffsetArcByDir(AcDbCurve* pArc, const double& dOffset)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pArc) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
AcDbVoidPtrArray ar;
|
|
|
|
|
|
pArc->getOffsetCurves(dOffset, ar);
|
|
|
|
|
|
if (ar.isEmpty()) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
AcDbCurve* pArcOff = (AcDbCurve*)(((AcDbEntity*)ar.first())->clone());
|
|
|
|
|
|
deleteArrayVoidPtrs<AcDbEntity>(ar);
|
|
|
|
|
|
|
|
|
|
|
|
return pArcOff;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 通过截面获取拉伸体
|
2026-09-28 15:28:50 +08:00
|
|
|
|
void drawSolid(AcGiDraw& dc
|
|
|
|
|
|
, const AcDbRegion* pReg
|
|
|
|
|
|
, const double& dThick
|
|
|
|
|
|
, const double& dH
|
|
|
|
|
|
, const AcGeVector3d& vtThick
|
|
|
|
|
|
, const AcGeVector3d& vtH)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pReg) return;
|
|
|
|
|
|
|
|
|
|
|
|
AcDbExtents ext;
|
|
|
|
|
|
pReg->getGeomExtents(ext);
|
|
|
|
|
|
AcGePoint3d ptCen(CoreTools::MidPt(ext.maxPoint(), ext.minPoint()));
|
|
|
|
|
|
AcDbLine ln(ptCen, ptCen + vtThick * -dThick);
|
|
|
|
|
|
|
|
|
|
|
|
AcDbX3dSolid xSolid;
|
|
|
|
|
|
AcGeMatrix3d mat;
|
|
|
|
|
|
if (xSolid.CreateExtrude(pReg, ln) == FALSE) return;
|
|
|
|
|
|
AcDb3dSolid* pSolid = xSolid.GetDraw3dSolid();
|
|
|
|
|
|
if (!pSolid) return;
|
|
|
|
|
|
mat.setTranslation(vtH * dH);
|
|
|
|
|
|
pSolid->transformBy(mat);
|
|
|
|
|
|
dc.DrawEntity(pSolid);
|
|
|
|
|
|
dc.Add3dBuffer(pSolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 获取直线的中间点
|
2026-09-28 15:28:50 +08:00
|
|
|
|
AcGePoint3d getLineMidPt(AcDbLine* pLine)
|
|
|
|
|
|
{
|
|
|
|
|
|
AcGePoint3d ptS, ptE;
|
|
|
|
|
|
pLine->getStartPoint(ptS);
|
|
|
|
|
|
pLine->getEndPoint(ptE);
|
|
|
|
|
|
double len = ptS.distanceTo(ptE);
|
|
|
|
|
|
AcGeVector3d vec = (ptS - ptE).normalize();
|
|
|
|
|
|
AcGePoint3d pt = ptS - vec * len / 2;
|
|
|
|
|
|
return pt;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 获取直线的垂直向量
|
2026-09-28 15:28:50 +08:00
|
|
|
|
AcGeVector3d getLineVerVec(AcDbLine* pLine, const AcGeVector3d& vecNormal)
|
|
|
|
|
|
{
|
|
|
|
|
|
AcGePoint3d ptS, ptE;
|
|
|
|
|
|
pLine->getStartPoint(ptS);
|
|
|
|
|
|
pLine->getEndPoint(ptE);
|
|
|
|
|
|
AcGeVector3d vec = (ptS - ptE).normalize();
|
|
|
|
|
|
vec.rotateBy(-PI / 2.0, AcGeVector3d::kZAxis);
|
|
|
|
|
|
vec.normalize();
|
|
|
|
|
|
return vec;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void getAveCurves(const AcDbArc* pArc
|
|
|
|
|
|
, AcDbVoidPtrArray* pArArc
|
|
|
|
|
|
, const SFPXStair& data)
|
|
|
|
|
|
{
|
|
|
|
|
|
int nCount = data.nSteepS;
|
|
|
|
|
|
double dLen = getArcLen(pArc);
|
|
|
|
|
|
double dAveLen = dLen / (nCount - 1);
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d ptC, pt;
|
|
|
|
|
|
ptC = pArc->center();
|
|
|
|
|
|
AcGeVector3d vec;
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3dArray arPt3d;
|
|
|
|
|
|
arPt3d.removeAll();
|
|
|
|
|
|
AcGeVector3dArray acVec3d;
|
|
|
|
|
|
acVec3d.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < nCount; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
arPt3d.append(pt);
|
|
|
|
|
|
vec = (pt - ptC).normalize();
|
|
|
|
|
|
acVec3d.append(vec);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pArc->getSplitCurves(arPt3d, *pArArc);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AecDbArcSegStairDraw::AecDbArcSegStairDraw(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AecDbArcSegStairDraw::~AecDbArcSegStairDraw(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::Draw2d(AcGiDraw &dc) const
|
|
|
|
|
|
{
|
|
|
|
|
|
AcDbObjectId idCurLay = dc.GetLayerId();
|
|
|
|
|
|
AcDbObjectId idCurLty = dc.GetLineTypeId();
|
|
|
|
|
|
AcDbEntity* pEntReal = GetAttach();
|
|
|
|
|
|
if (pEntReal == NULL)
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
AecDbArcSegStair* pStair = AecDbArcSegStair::cast(pEntReal);
|
|
|
|
|
|
if (pStair == NULL)
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
Adesk::UInt16 nCrBk = 256;
|
|
|
|
|
|
nCrBk = pEntReal->colorIndex();
|
|
|
|
|
|
dc.SetLayer(pEntReal->layerId());
|
|
|
|
|
|
|
|
|
|
|
|
int nColor = nCrBk;
|
|
|
|
|
|
if (GetSpecialtyData()->GetAt(_T("COLOR"), nColor))
|
|
|
|
|
|
{
|
|
|
|
|
|
dc.SetColor(nColor);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SFPXStair data;
|
|
|
|
|
|
memset(&data, 0, sizeof(SFPXStair));
|
|
|
|
|
|
pStair->GetSFPXStair(data);
|
|
|
|
|
|
|
|
|
|
|
|
//.....
|
2026-10-04 00:04:20 +08:00
|
|
|
|
AcDbCurve* pBaseCurve = pStair->GetBaseCurve();//路径
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (!pBaseCurve) return Acad::eOk;
|
|
|
|
|
|
AcDbLine* pLn = AcDbLine::cast(pBaseCurve);
|
|
|
|
|
|
if (!pLn) return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
/*AcDbLine* pLnTest = (AcDbLine*)pLn->clone();
|
|
|
|
|
|
if (!pLnTest) return Acad::eOk;
|
|
|
|
|
|
pLnTest->setColorIndex(6);
|
|
|
|
|
|
CoreTools::AddToModelSpace(pLnTest);
|
|
|
|
|
|
AcDbCircle* pCir = new AcDbCircle(pLn->startPoint(), AcGeVector3d::kZAxis, 50);
|
|
|
|
|
|
pCir->setColorIndex(6);
|
|
|
|
|
|
CoreTools::AddToModelSpace(pCir);*/
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d ptC;
|
|
|
|
|
|
ptC = pLn->startPoint();
|
|
|
|
|
|
|
|
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis);
|
|
|
|
|
|
|
|
|
|
|
|
ptC += Z * data.dBomEl;
|
|
|
|
|
|
|
|
|
|
|
|
AcDbVoidPtrArray CurveAr;
|
|
|
|
|
|
CurveAr.removeAll();
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
double dStaAngle(.0); // 起始角度
|
|
|
|
|
|
double dEndAngle(.0); // 终止角度
|
2026-09-28 15:28:50 +08:00
|
|
|
|
|
|
|
|
|
|
AcDbArc* pArc(NULL);
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
dStaAngle = CoreTools::A2R(data.dRestPtMW);
|
|
|
|
|
|
dEndAngle = CoreTools::A2R(data.dRestPtMW + data.dRestPtML);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = new AcDbArc(ptC, Z, data.dRestPtW, dStaAngle, dEndAngle);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pBaseCurve);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
CurveAr.append(pArc);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = new AcDbArc(ptC, Z, data.dRestPtL, dStaAngle, dEndAngle);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pBaseCurve);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
CurveAr.append(pArc);
|
|
|
|
|
|
|
|
|
|
|
|
DrawUpStairs2d(dc, CurveAr, data.bLBeam, data.bRBeam, data);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
dStaAngle = CoreTools::A2R(data.dRestPtMW - data.dRestPtML);
|
|
|
|
|
|
dEndAngle = CoreTools::A2R(data.dRestPtMW);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = new AcDbArc(ptC, Z, data.dRestPtW, dStaAngle, dEndAngle);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pBaseCurve);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
CurveAr.append(pArc);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = new AcDbArc(ptC, Z, data.dRestPtL, dStaAngle, dEndAngle);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pBaseCurve);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
CurveAr.append(pArc);
|
|
|
|
|
|
|
|
|
|
|
|
DrawUpStairs2d(dc, CurveAr, data.bRBeam, data.bLBeam, data);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dc.SetColor(nCrBk);
|
|
|
|
|
|
dc.SetLayer(idCurLay);
|
|
|
|
|
|
dc.SetLineType(idCurLty);
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::Draw3d(AcGiDraw &dc) const
|
|
|
|
|
|
{
|
|
|
|
|
|
AcDbObjectId idCurLay = dc.GetLayerId();
|
|
|
|
|
|
AcDbObjectId idCurLty = dc.GetLineTypeId();
|
|
|
|
|
|
AcDbEntity* pEntReal = GetAttach();
|
|
|
|
|
|
if (pEntReal == NULL)
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
AecDbArcSegStair* pStair = AecDbArcSegStair::cast(pEntReal);
|
|
|
|
|
|
if (pStair == NULL)
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
Adesk::UInt16 nCrBk = pEntReal->colorIndex();
|
|
|
|
|
|
dc.SetLayer(pEntReal->layerId());
|
|
|
|
|
|
|
|
|
|
|
|
int nColor = nCrBk;
|
|
|
|
|
|
if (GetSpecialtyData()->GetAt(_T("COLOR"), nColor))
|
|
|
|
|
|
{
|
|
|
|
|
|
dc.SetColor(nColor);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SFPXStair data;
|
|
|
|
|
|
memset(&data, 0, sizeof(SFPXStair));
|
|
|
|
|
|
pStair->GetSFPXStair(data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//.....
|
2026-10-04 00:04:20 +08:00
|
|
|
|
AcDbCurve* pBaseCurve = pStair->GetBaseCurve();//路径
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (!pBaseCurve) return Acad::eOk;
|
|
|
|
|
|
AcDbLine* pLn = AcDbLine::cast(pBaseCurve);
|
|
|
|
|
|
if (!pLn) return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d ptC;
|
|
|
|
|
|
ptC = pLn->startPoint();
|
|
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis);
|
|
|
|
|
|
|
|
|
|
|
|
ptC += Z * data.dBomEl;
|
|
|
|
|
|
|
|
|
|
|
|
AcDbVoidPtrArray CurveAr;
|
|
|
|
|
|
CurveAr.removeAll();
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
double dStaAngle(.0); // 起始角度
|
|
|
|
|
|
double dEndAngle(.0); // 终止角度
|
2026-09-28 15:28:50 +08:00
|
|
|
|
|
|
|
|
|
|
AcDbArc* pArc(NULL);
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
dStaAngle = CoreTools::A2R(data.dRestPtMW);
|
|
|
|
|
|
dEndAngle = CoreTools::A2R(data.dRestPtMW + data.dRestPtML);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = new AcDbArc(ptC, Z, data.dRestPtW, dStaAngle, dEndAngle);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pBaseCurve);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
CurveAr.append(pArc);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = new AcDbArc(ptC, Z, data.dRestPtL, dStaAngle, dEndAngle);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pBaseCurve);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
CurveAr.append(pArc);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
dStaAngle = CoreTools::A2R(data.dRestPtMW - data.dRestPtML);
|
|
|
|
|
|
dEndAngle = CoreTools::A2R(data.dRestPtMW);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = new AcDbArc(ptC, Z, data.dRestPtW, dStaAngle, dEndAngle);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pBaseCurve);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
CurveAr.append(pArc);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = new AcDbArc(ptC, Z, data.dRestPtL, dStaAngle, dEndAngle);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pBaseCurve);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
CurveAr.append(pArc);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
data.dSteepW = 270;
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 坡道用途
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bOutSideHRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 三角落地结构
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.nGShape)
|
|
|
|
|
|
{
|
|
|
|
|
|
DrawSide3d(dc, CurveAr, 120, 200, 200, data.nSteepS + 1, data);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DrawSide3d(dc, CurveAr, 120, 270, data.dSteepH, data.nSteepS + 1, data);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DrawSide3d(dc, CurveAr, 120, 270, data.dSteepH, data.nSteepS, data);
|
|
|
|
|
|
}
|
|
|
|
|
|
DrawStairsAndSlope3d(dc, CurveAr, data);
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::DrawUpStairs2d(AcGiDraw& dc
|
|
|
|
|
|
, const AcDbVoidPtrArray& CurveAr
|
|
|
|
|
|
, const BOOL& bLBeam
|
|
|
|
|
|
, const BOOL& bRBeam
|
|
|
|
|
|
, const SFPXStair& data) const
|
|
|
|
|
|
{
|
|
|
|
|
|
if(CurveAr.length() < 1) return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
int nOldClr = dc.GetColor();
|
|
|
|
|
|
dc.SetColor(6);
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d pt, ptC;
|
|
|
|
|
|
AcGeVector3d vec, Z(AcGeVector3d::kZAxis);
|
|
|
|
|
|
double dBulge(.0);
|
|
|
|
|
|
|
|
|
|
|
|
double dSide = 120;
|
|
|
|
|
|
|
|
|
|
|
|
AcDbArc* pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc) return Acad::eOk;
|
|
|
|
|
|
dBulge = getBulge(pArc);
|
|
|
|
|
|
AcDbPolyline* pPoly = makePoly(CurveAr, dBulge, FALSE);
|
|
|
|
|
|
if (!pPoly)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
dc.DrawEntity(pPoly);
|
|
|
|
|
|
dc.Add2dBuffer(pPoly);
|
|
|
|
|
|
|
|
|
|
|
|
AcDbVoidPtrArray arArc;
|
|
|
|
|
|
arArc.removeAll();
|
|
|
|
|
|
arArc.append(pArc);
|
|
|
|
|
|
AcDbArc* pArcOff = (AcDbArc*)makeOffsetArcByDir(pArc, dSide);
|
|
|
|
|
|
if (!pArcOff)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
arArc.append(pArcOff);
|
|
|
|
|
|
if (bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pPoly = makePoly(arArc, dBulge, FALSE);
|
|
|
|
|
|
if (!pPoly)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pArcOff);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
dc.DrawEntity(pPoly);
|
|
|
|
|
|
dc.Add2dBuffer(pPoly);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
arArc.removeAll();
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcOff);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
arArc.append(pArc);
|
|
|
|
|
|
pArcOff = (AcDbArc*)makeOffsetArcByDir(pArc, -dSide);
|
|
|
|
|
|
if (!pArcOff)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
arArc.append(pArcOff);
|
|
|
|
|
|
if (bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pPoly = makePoly(arArc, dBulge, FALSE);
|
|
|
|
|
|
if (!pPoly)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pArcOff);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
dc.DrawEntity(pPoly);
|
|
|
|
|
|
dc.Add2dBuffer(pPoly);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double dLen = getArcLen(pArc);
|
|
|
|
|
|
double dAveLen(.0);
|
|
|
|
|
|
|
|
|
|
|
|
int i(0);
|
|
|
|
|
|
int nCount = data.nSteepS;
|
|
|
|
|
|
double dSteepL = data.dRestPtL - data.dRestPtW;
|
|
|
|
|
|
|
|
|
|
|
|
arArc.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3dArray arPt3d;
|
|
|
|
|
|
arPt3d.removeAll();
|
|
|
|
|
|
AcGeVector3dArray acVec3d;
|
|
|
|
|
|
acVec3d.removeAll();
|
|
|
|
|
|
AcDbVoidPtrArray arArcSpilt;
|
|
|
|
|
|
arArcSpilt.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideHRail)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (data.bDimUpstair)
|
|
|
|
|
|
{
|
|
|
|
|
|
dAveLen = dLen / nCount;
|
|
|
|
|
|
for (i = 1; i <= nCount; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
arPt3d.append(pt);
|
|
|
|
|
|
vec = (pt - ptC).normalize();
|
|
|
|
|
|
acVec3d.append(vec);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pArc->getSplitCurves(arPt3d, arArc);
|
|
|
|
|
|
for (i = 0; i < arArc.length(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)arArc.at(i);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcOff);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
dBulge = getBulge(pArc);;
|
|
|
|
|
|
pArcOff = (AcDbArc*)makeOffsetArcByDir(pArc, -dSteepL);
|
|
|
|
|
|
if (!pArcOff)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
arArcSpilt.removeAll();
|
|
|
|
|
|
arArcSpilt.append(pArc);
|
|
|
|
|
|
arArcSpilt.append(pArcOff);
|
|
|
|
|
|
pPoly = makePoly(arArcSpilt, dBulge, FALSE);
|
|
|
|
|
|
if (!pPoly)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pArcOff);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
dc.DrawEntity(pPoly);
|
|
|
|
|
|
dc.Add2dBuffer(pPoly);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
dAveLen = dLen / (nCount - 1);
|
|
|
|
|
|
for (i = 1; i < nCount; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
arPt3d.append(pt);
|
|
|
|
|
|
vec = (pt - ptC).normalize();
|
|
|
|
|
|
acVec3d.append(vec);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pArc->getSplitCurves(arPt3d, arArc);
|
|
|
|
|
|
for (i = 0; i < arArc.length(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)arArc.at(i);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcOff);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
dBulge = getBulge(pArc);
|
|
|
|
|
|
pArcOff = (AcDbArc*)makeOffsetArcByDir(pArc, -dSteepL);
|
|
|
|
|
|
if (!pArcOff)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
arArcSpilt.removeAll();
|
|
|
|
|
|
arArcSpilt.append(pArc);
|
|
|
|
|
|
arArcSpilt.append(pArcOff);
|
|
|
|
|
|
pPoly = makePoly(arArcSpilt, dBulge, FALSE);
|
|
|
|
|
|
if (!pPoly)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pArcOff);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
dc.DrawEntity(pPoly);
|
|
|
|
|
|
dc.Add2dBuffer(pPoly);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dc.SetColor(nOldClr);
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::DrawUpStairs3d(AcGiDraw& dc
|
|
|
|
|
|
, const AcDbVoidPtrArray& CurveAr
|
|
|
|
|
|
, const SFPXStair& data) const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CurveAr.length() < 1) return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
int nOldClr = dc.GetColor();
|
|
|
|
|
|
dc.SetColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
int i(0);
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
//一共多少步
|
2026-09-28 15:28:50 +08:00
|
|
|
|
int nCount(data.nSteepS);
|
|
|
|
|
|
double dSide(120);
|
|
|
|
|
|
|
|
|
|
|
|
AcDbVoidPtrArray arArcSpilt;
|
|
|
|
|
|
arArcSpilt.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis);
|
|
|
|
|
|
double dBulge(.0), dH(.0);
|
|
|
|
|
|
AcDbRegion* pReg(NULL);
|
|
|
|
|
|
AcDbArc* pArc(NULL);
|
|
|
|
|
|
|
|
|
|
|
|
AcDbVoidPtrArray arArcL, arArcR;
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
|
|
|
|
|
|
arArcL.removeAll();
|
|
|
|
|
|
arArcR.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getAveCurves(pArc, &arArcL, data);
|
|
|
|
|
|
if (arArcL.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, -dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getAveCurves(pArc, &arArcR, data);
|
|
|
|
|
|
if (arArcR.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < arArcL.length(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
arArcSpilt.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
arArcSpilt.append(arArcL.at(i));
|
|
|
|
|
|
arArcSpilt.append(arArcR.at(i));
|
|
|
|
|
|
|
|
|
|
|
|
dBulge = getBulge((AcDbArc*)arArcR.at(i));
|
|
|
|
|
|
|
|
|
|
|
|
pReg = makeStairsReg(arArcSpilt, dBulge);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
dH = dH + data.dSteepH;
|
|
|
|
|
|
drawSolid(dc, pReg, data.dSteepH, dH, Z, Z);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
|
|
|
|
|
|
arArcL.removeAll();
|
|
|
|
|
|
arArcR.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, -dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getAveCurves(pArc, &arArcL, data);
|
|
|
|
|
|
if (arArcL.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getAveCurves(pArc, &arArcR, data);
|
|
|
|
|
|
if (arArcR.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (i = arArcL.length() - 1; i >= 0; --i)
|
|
|
|
|
|
{
|
|
|
|
|
|
arArcSpilt.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
arArcSpilt.append(arArcL.at(i));
|
|
|
|
|
|
arArcSpilt.append(arArcR.at(i));
|
|
|
|
|
|
|
|
|
|
|
|
dBulge = getBulge((AcDbArc*)arArcR.at(i));
|
|
|
|
|
|
|
|
|
|
|
|
pReg = makeStairsReg(arArcSpilt, dBulge);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
dH = dH + data.dSteepH;
|
|
|
|
|
|
drawSolid(dc, pReg, data.dSteepH, dH, Z, Z);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dc.SetColor(nOldClr);
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::DrawRail3d(AcGiDraw& dc
|
|
|
|
|
|
, const AcDbArc* pArc
|
|
|
|
|
|
, const SFPXStair& data) const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pArc) return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
int nOldClr = dc.GetColor();
|
|
|
|
|
|
dc.SetColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis), vec;
|
|
|
|
|
|
int i(0);
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 一共多少步
|
2026-09-28 15:28:50 +08:00
|
|
|
|
int nCount = data.nSteepS;
|
|
|
|
|
|
|
|
|
|
|
|
double dLen = getArcLen(pArc);
|
|
|
|
|
|
double dAveLen = dLen / ((nCount - 1) * 2);
|
|
|
|
|
|
double dH(.0);
|
|
|
|
|
|
AcGePoint3d pt, pt1, pt2;
|
|
|
|
|
|
AcDbRegion* pReg(NULL);
|
|
|
|
|
|
AcDbLine* pLine;
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
for (i = 1; i < (nCount - 1) * 2; i = i + 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
|
|
|
|
|
|
dH += data.dSteepH;
|
|
|
|
|
|
pt += Z * dH;
|
|
|
|
|
|
|
|
|
|
|
|
pReg = makeCircleRegion(pt, Z, data.dGarSize[0] * .5);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pLine);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
drawSolid(dc, pReg, -data.dBarH, .0, Z, Z);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
for (i = (nCount - 1) * 2 - 1; i > 0; i = i - 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
|
|
|
|
|
|
dH += data.dSteepH;
|
|
|
|
|
|
pt += Z * dH;
|
|
|
|
|
|
|
|
|
|
|
|
pReg = makeCircleRegion(pt, Z, data.dGarSize[0] * .5);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pLine);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
drawSolid(dc, pReg, -data.dBarH, .0, Z, Z);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dc.SetColor(nOldClr);
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::DrawHandRail3d(AcGiDraw& dc
|
|
|
|
|
|
, const AcDbArc* pArc
|
|
|
|
|
|
, const SFPXStair& data) const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pArc) return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
int nOldClr = dc.GetColor();
|
|
|
|
|
|
dc.SetColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis), vt;
|
|
|
|
|
|
int i(0);
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 一共多少步
|
2026-09-28 15:28:50 +08:00
|
|
|
|
int nCount = data.nSteepS;
|
|
|
|
|
|
|
|
|
|
|
|
double dLen = getArcLen(pArc);
|
|
|
|
|
|
double dAveLen = dLen / ((nCount - 1) * 2);
|
|
|
|
|
|
double dH(.0);
|
|
|
|
|
|
AcGePoint3d pt, pt1, pt2, ptC;
|
|
|
|
|
|
AcDbLine* pLine(NULL);
|
|
|
|
|
|
AcGePoint3dArray arPts;
|
|
|
|
|
|
arPts.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
for (i = 0; i < ((nCount - 1) * 2); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
|
|
|
|
|
|
dH += data.dSteepH * .5;
|
|
|
|
|
|
pt += Z * dH;
|
|
|
|
|
|
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
for (i = ((nCount - 1) * 2); i >= 0; --i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
|
|
|
|
|
|
dH += data.dSteepH * .5;
|
|
|
|
|
|
pt += Z * dH;
|
|
|
|
|
|
//dH += data.dSteepH * .5;
|
|
|
|
|
|
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (arPts.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pLine);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDbSpline* pSpline = new AcDbSpline(arPts);
|
|
|
|
|
|
if (!pSpline)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pLine);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDbSweepOptions op;
|
|
|
|
|
|
op.setAlign(AcDbSweepOptions::kNoAlignment);
|
|
|
|
|
|
op.setMiterOption(AcDbSweepOptions::kDefaultMiter);
|
|
|
|
|
|
vt = (arPts[1] - arPts[0]).normalize();
|
|
|
|
|
|
AcDbRegion* pReg = makeCircleRegion(arPts[0], vt, data.dGarSize[0] * .5);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pLine);
|
|
|
|
|
|
DELETE_PTR(pSpline);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDb3dSolid* pSolid = new AcDb3dSolid;
|
|
|
|
|
|
Acad::ErrorStatus es = pSolid->createSweptSolid(pReg, pSpline, op);
|
|
|
|
|
|
if (es != eOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pLine);
|
|
|
|
|
|
DELETE_PTR(pSpline);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcGeMatrix3d mat;
|
|
|
|
|
|
mat.setTranslation(Z * data.dBarH);
|
|
|
|
|
|
pSolid->transformBy(mat);
|
|
|
|
|
|
|
|
|
|
|
|
dc.DrawEntity(pSolid);
|
|
|
|
|
|
dc.Add3dBuffer(pSolid);
|
|
|
|
|
|
|
|
|
|
|
|
dc.SetColor(nOldClr);
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::DrawSide3d(AcGiDraw& dc
|
|
|
|
|
|
, const AcDbVoidPtrArray& CurveAr
|
|
|
|
|
|
, const double& dRegW
|
|
|
|
|
|
, const double& dRegH
|
|
|
|
|
|
, const double& dMoveH
|
|
|
|
|
|
, const int& nCount
|
|
|
|
|
|
, const SFPXStair& data) const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CurveAr.length() < 1) return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
int nOldClr = dc.GetColor();
|
|
|
|
|
|
dc.SetColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis), vec;
|
|
|
|
|
|
int i(0);
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d pt, ptC;
|
|
|
|
|
|
AcDbArc* pArc(NULL);
|
|
|
|
|
|
double dLen(.0), dAveLen(.0), dH(.0);
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3dArray arPts;
|
|
|
|
|
|
arPts.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
AcArray<AcDbEntity*> crossSectionCurves, guideCurves;
|
|
|
|
|
|
crossSectionCurves.removeAll();
|
|
|
|
|
|
guideCurves.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus es;
|
|
|
|
|
|
AcDbLoftOptions op;
|
|
|
|
|
|
AcDb3dSolid* pLSolid = new AcDb3dSolid;
|
|
|
|
|
|
AcDb3dSolid* pRSolid = new AcDb3dSolid;
|
|
|
|
|
|
|
|
|
|
|
|
AcDbSpline* pSpline(NULL);
|
|
|
|
|
|
AcDbRegion* pReg(NULL);
|
|
|
|
|
|
|
|
|
|
|
|
AcArray<AcDbRegion*> arRegs;
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
|
|
|
|
|
|
// Left
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
ptC = pArc->center();
|
|
|
|
|
|
dLen = getArcLen(pArc);
|
|
|
|
|
|
dAveLen = dLen / (nCount - 1);
|
|
|
|
|
|
|
|
|
|
|
|
for (i; i < nCount; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
vec = (pt - ptC).normalize();
|
|
|
|
|
|
pt += Z * (dMoveH + data.dSteepH * i);
|
|
|
|
|
|
|
|
|
|
|
|
pReg = makeRectRegion(pt, FALSE, dRegW, dRegH, -vec, Z);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
crossSectionCurves.append(pReg);
|
|
|
|
|
|
|
|
|
|
|
|
pt = getRegCenter(pReg);
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (arPts.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
pSpline = new AcDbSpline(arPts);
|
|
|
|
|
|
if (!pSpline)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDbX3dSolid xsolid;
|
|
|
|
|
|
arRegs.removeAll();
|
|
|
|
|
|
arRegs.setLogicalLength(crossSectionCurves.length());
|
|
|
|
|
|
::memcpy(arRegs.asArrayPtr()
|
|
|
|
|
|
, crossSectionCurves.asArrayPtr()
|
|
|
|
|
|
, sizeof(AcDbRegion*) * crossSectionCurves.length());
|
|
|
|
|
|
|
|
|
|
|
|
if (xsolid.CreateLoft(arRegs, pSpline))
|
|
|
|
|
|
{
|
|
|
|
|
|
add3DCache<AecDbArcSegStair>(&xsolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
es = pLSolid->createLoftedSolid(crossSectionCurves, guideCurves, pSpline, op);
|
|
|
|
|
|
if (es != eOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
DELETE_PTR(pSpline);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
dc.DrawEntity(pLSolid);
|
|
|
|
|
|
dc.Add3dBuffer(pLSolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Right
|
|
|
|
|
|
arPts.removeAll();
|
|
|
|
|
|
crossSectionCurves.removeAll();
|
|
|
|
|
|
guideCurves.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
ptC = pArc->center();
|
|
|
|
|
|
dLen = getArcLen(pArc);
|
|
|
|
|
|
dAveLen = dLen / (nCount - 1);
|
|
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nCount; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
vec = (pt - ptC).normalize();
|
|
|
|
|
|
pt += Z * (dMoveH + data.dSteepH * i);
|
|
|
|
|
|
|
|
|
|
|
|
pReg = makeRectRegion(pt, FALSE, dRegW, dRegH, vec, Z);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
crossSectionCurves.append(pReg);
|
|
|
|
|
|
|
|
|
|
|
|
pt = getRegCenter(pReg);
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (arPts.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
pSpline = new AcDbSpline(arPts);
|
|
|
|
|
|
if (!pSpline)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
arRegs.removeAll();
|
|
|
|
|
|
arRegs.setLogicalLength(crossSectionCurves.length());
|
|
|
|
|
|
::memcpy(arRegs.asArrayPtr()
|
|
|
|
|
|
, crossSectionCurves.asArrayPtr()
|
|
|
|
|
|
, sizeof(AcDbRegion*)* crossSectionCurves.length());
|
|
|
|
|
|
|
|
|
|
|
|
if (xsolid.CreateLoft(arRegs, pSpline))
|
|
|
|
|
|
{
|
|
|
|
|
|
add3DCache<AecDbArcSegStair>(&xsolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
es = pRSolid->createLoftedSolid(crossSectionCurves, guideCurves, pSpline, op);
|
|
|
|
|
|
if (es != eOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
DELETE_PTR(pSpline);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
dc.DrawEntity(pRSolid);
|
|
|
|
|
|
dc.Add3dBuffer(pRSolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// Right
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
ptC = pArc->center();
|
|
|
|
|
|
dLen = getArcLen(pArc);
|
|
|
|
|
|
dAveLen = dLen / (nCount - 1);
|
|
|
|
|
|
|
|
|
|
|
|
int j(0);
|
|
|
|
|
|
|
|
|
|
|
|
for (i = nCount - 1, j = 0; i >= 0, j < nCount; --i, ++j)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
vec = (pt - ptC).normalize();
|
|
|
|
|
|
pt += Z * (dMoveH + data.dSteepH * j);
|
|
|
|
|
|
|
|
|
|
|
|
pReg = makeRectRegion(pt, FALSE, dRegW, dRegH, -vec, Z);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
crossSectionCurves.append(pReg);
|
|
|
|
|
|
|
|
|
|
|
|
pt = getRegCenter(pReg);
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (arPts.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
pSpline = new AcDbSpline(arPts);
|
|
|
|
|
|
if (!pSpline)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDbX3dSolid xsolid;
|
|
|
|
|
|
arRegs.removeAll();
|
|
|
|
|
|
arRegs.setLogicalLength(crossSectionCurves.length());
|
|
|
|
|
|
::memcpy(arRegs.asArrayPtr()
|
|
|
|
|
|
, crossSectionCurves.asArrayPtr()
|
|
|
|
|
|
, sizeof(AcDbRegion*) * crossSectionCurves.length());
|
|
|
|
|
|
|
|
|
|
|
|
if (xsolid.CreateLoft(arRegs, pSpline))
|
|
|
|
|
|
{
|
|
|
|
|
|
add3DCache<AecDbArcSegStair>(&xsolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
es = pRSolid->createLoftedSolid(crossSectionCurves, guideCurves, pSpline, op);
|
|
|
|
|
|
if (es != eOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
DELETE_PTR(pSpline);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
dc.DrawEntity(pRSolid);
|
|
|
|
|
|
dc.Add3dBuffer(pRSolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Left
|
|
|
|
|
|
arPts.removeAll();
|
|
|
|
|
|
crossSectionCurves.removeAll();
|
|
|
|
|
|
guideCurves.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
ptC = pArc->center();
|
|
|
|
|
|
dLen = getArcLen(pArc);
|
|
|
|
|
|
dAveLen = dLen / (nCount - 1);
|
|
|
|
|
|
|
|
|
|
|
|
dH = 0;
|
|
|
|
|
|
for (i = nCount - 1, j = 0; i >= 0, j < nCount; --i, ++j)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt);
|
|
|
|
|
|
vec = (pt - ptC).normalize();
|
|
|
|
|
|
pt += Z * (dMoveH + data.dSteepH * j);
|
|
|
|
|
|
|
|
|
|
|
|
pReg = makeRectRegion(pt, FALSE, dRegW, dRegH, vec, Z);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
crossSectionCurves.append(pReg);
|
|
|
|
|
|
|
|
|
|
|
|
pt = getRegCenter(pReg);
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (arPts.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
pSpline = new AcDbSpline(arPts);
|
|
|
|
|
|
if (!pSpline)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
arRegs.removeAll();
|
|
|
|
|
|
arRegs.setLogicalLength(crossSectionCurves.length());
|
|
|
|
|
|
::memcpy(arRegs.asArrayPtr()
|
|
|
|
|
|
, crossSectionCurves.asArrayPtr()
|
|
|
|
|
|
, sizeof(AcDbRegion*)* crossSectionCurves.length());
|
|
|
|
|
|
|
|
|
|
|
|
if (xsolid.CreateLoft(arRegs, pSpline))
|
|
|
|
|
|
{
|
|
|
|
|
|
add3DCache<AecDbArcSegStair>(&xsolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
es = pLSolid->createLoftedSolid(crossSectionCurves, guideCurves, pSpline, op);
|
|
|
|
|
|
if (es != eOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
DELETE_PTR(pSpline);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
dc.DrawEntity(pLSolid);
|
|
|
|
|
|
dc.Add3dBuffer(pLSolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dc.SetColor(nOldClr);
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::DrawTriangleLand3d(const AcDbArc* pArc
|
|
|
|
|
|
, AcArray<AcDbRegion*>& crossSectionCruves
|
|
|
|
|
|
, const SFPXStair& data) const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pArc) return Acad::eOk;
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 一共多少步
|
2026-09-28 15:28:50 +08:00
|
|
|
|
int nCount = data.nSteepS;
|
|
|
|
|
|
double dLen = getArcLen(pArc);
|
|
|
|
|
|
double dAveLen = dLen / nCount;
|
|
|
|
|
|
double dH(.0);
|
|
|
|
|
|
int i(0);
|
|
|
|
|
|
|
|
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis);
|
|
|
|
|
|
AcGePoint3d pt1, pt2;
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d ptGe[5];
|
|
|
|
|
|
|
|
|
|
|
|
AcDbRegion* pReg(NULL);
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
for (i; i < nCount; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt1);
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * (i + 1), pt2);
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[0] = pt1;
|
|
|
|
|
|
ptGe[1] = pt2;
|
|
|
|
|
|
|
|
|
|
|
|
pt1 += Z * data.dSteepH * i;
|
|
|
|
|
|
pt2 += Z * data.dSteepH * (i + 1);
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[2] = pt2;
|
|
|
|
|
|
ptGe[3] = pt1;
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[4] = ptGe[0];
|
|
|
|
|
|
|
|
|
|
|
|
pReg = AecDbEarthWorm::CreatePolygonRegionOnly(ptGe, 5);
|
|
|
|
|
|
if (!pReg) return Acad::eOk;
|
|
|
|
|
|
crossSectionCruves.append(pReg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
for (i = nCount; i > 0; --i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt1);
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * (i - 1), pt2);
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[0] = pt1;
|
|
|
|
|
|
ptGe[1] = pt2;
|
|
|
|
|
|
|
|
|
|
|
|
pt1 += Z * dH;
|
|
|
|
|
|
dH += data.dSteepH;
|
|
|
|
|
|
pt2 += Z * dH;
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[2] = pt2;
|
|
|
|
|
|
ptGe[3] = pt1;
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[4] = ptGe[0];
|
|
|
|
|
|
|
|
|
|
|
|
pReg = AecDbEarthWorm::CreatePolygonRegionOnly(ptGe, 5);
|
|
|
|
|
|
if (!pReg) return Acad::eOk;
|
|
|
|
|
|
crossSectionCruves.append(pReg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::DrawNonSilp3d(const AcDbArc* pArc
|
|
|
|
|
|
, AcArray<AcDbRegion*>& crossSectionCruves
|
|
|
|
|
|
, const SFPXStair& data) const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!pArc) return Acad::eOk;
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 一共多少步
|
2026-09-28 15:28:50 +08:00
|
|
|
|
int nCount = data.nSteepS;
|
|
|
|
|
|
double dLen = getArcLen(pArc);
|
|
|
|
|
|
double dAveLen = dLen / nCount;
|
|
|
|
|
|
double dH(.0);
|
|
|
|
|
|
int i(0);
|
|
|
|
|
|
|
|
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis);
|
|
|
|
|
|
AcGePoint3d pt1, pt2;
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d ptGe[4];
|
|
|
|
|
|
|
|
|
|
|
|
AcDbRegion* pReg(NULL);
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
for (i; i < nCount - 1; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt1);
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * (i + 1), pt2);
|
|
|
|
|
|
|
|
|
|
|
|
pt1 += Z * data.dSteepH * i;
|
|
|
|
|
|
pt2 += Z * data.dSteepH * (i + 1);
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[0] = pt1;
|
|
|
|
|
|
ptGe[1] = pt2;
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[2] = ptGe[1] + Z * data.dSteepH * .1;
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[3] = ptGe[0];
|
|
|
|
|
|
|
|
|
|
|
|
pReg = AecDbEarthWorm::CreatePolygonRegionOnly(ptGe, 4);
|
|
|
|
|
|
if (!pReg) return Acad::eOk;
|
|
|
|
|
|
crossSectionCruves.append(pReg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
for (i = nCount; i > 1; --i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * i, pt1);
|
|
|
|
|
|
pArc->getPointAtDist(dAveLen * (i - 1), pt2);
|
|
|
|
|
|
|
|
|
|
|
|
pt1 += Z * dH;
|
|
|
|
|
|
dH += data.dSteepH;
|
|
|
|
|
|
pt2 += Z * dH;
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[0] = pt1;
|
|
|
|
|
|
ptGe[1] = pt2;
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[2] = ptGe[1] + Z * data.dSteepH * .1;
|
|
|
|
|
|
|
|
|
|
|
|
ptGe[3] = ptGe[0];
|
|
|
|
|
|
|
|
|
|
|
|
pReg = AecDbEarthWorm::CreatePolygonRegionOnly(ptGe, 4);
|
|
|
|
|
|
if (!pReg) return Acad::eOk;
|
|
|
|
|
|
crossSectionCruves.append(pReg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::DrawSlope3d(AcGiDraw& dc
|
|
|
|
|
|
, const AcDbVoidPtrArray& CurveAr
|
|
|
|
|
|
, const SFPXStair& data) const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CurveAr.length() < 1) return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
int nOldClr = dc.GetColor();
|
|
|
|
|
|
dc.SetColor(3);
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 一共多少步
|
2026-09-28 15:28:50 +08:00
|
|
|
|
int nCount = data.nSteepS;
|
|
|
|
|
|
double dLenIn(.0), dAveLenIn(.0), dLenOut(.0), dAveLenOut(.0), dH(.0);
|
|
|
|
|
|
double dSide = 120;
|
|
|
|
|
|
double dSteepL = data.dRestPtL - data.dRestPtW;
|
|
|
|
|
|
|
|
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis), vec;
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3dArray arPts;
|
|
|
|
|
|
arPts.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
AcDbRegion* pReg(NULL);
|
|
|
|
|
|
AcArray<AcDbEntity*> crossSectionCurves, guideCurves;
|
|
|
|
|
|
crossSectionCurves.removeAll();
|
|
|
|
|
|
guideCurves.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
AcDbArc* pArcIn = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArcIn)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
AcDbArc* pArcOut = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArcOut)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcIn);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d ptIn, ptOut, ptC;
|
|
|
|
|
|
ptC = pArcIn->center();
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
|
|
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArcIn = (AcDbArc*)makeOffsetArcByDir(pArcIn, dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArcIn)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcOut);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArcOut = (AcDbArc*)makeOffsetArcByDir(pArcOut, -dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArcOut)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcIn);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dLenIn = getArcLen(pArcIn);
|
|
|
|
|
|
dAveLenIn = dLenIn / nCount;
|
|
|
|
|
|
|
|
|
|
|
|
dLenOut = getArcLen(pArcOut);
|
|
|
|
|
|
dAveLenOut = dLenOut / nCount;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i(0); i <= nCount; ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArcIn->getPointAtDist(dAveLenIn * i, ptIn);
|
|
|
|
|
|
pArcOut->getPointAtDist(dAveLenOut * i, ptOut);
|
|
|
|
|
|
|
|
|
|
|
|
ptIn += Z * data.dSteepH * i;
|
|
|
|
|
|
ptOut += Z * data.dSteepH * i;
|
|
|
|
|
|
|
|
|
|
|
|
dSteepL = ptIn.distanceTo(ptOut);
|
|
|
|
|
|
|
|
|
|
|
|
vec = (ptIn - ptOut).normalize();
|
|
|
|
|
|
pReg = makeRectRegionByPts(ptIn, ptOut, dSteepL, dSide, vec, Z);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcIn);
|
|
|
|
|
|
DELETE_PTR(pArcOut);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
crossSectionCurves.append(pReg);
|
|
|
|
|
|
|
|
|
|
|
|
ptC = getRegCenter(pReg);
|
|
|
|
|
|
arPts.append(ptC);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
|
|
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArcOut = (AcDbArc*)makeOffsetArcByDir(pArcOut, -dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArcOut)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcIn);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArcIn = (AcDbArc*)makeOffsetArcByDir(pArcIn, dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArcIn)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcOut);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dLenIn = getArcLen(pArcIn);
|
|
|
|
|
|
dAveLenIn = dLenIn / nCount;
|
|
|
|
|
|
|
|
|
|
|
|
dLenOut = getArcLen(pArcOut);
|
|
|
|
|
|
dAveLenOut = dLenOut / nCount;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i(nCount); i >= 0; --i)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArcIn->getPointAtDist(dAveLenIn * i, ptIn);
|
|
|
|
|
|
pArcOut->getPointAtDist(dAveLenOut * i, ptOut);
|
|
|
|
|
|
|
|
|
|
|
|
ptIn += Z * dH;
|
|
|
|
|
|
ptOut += Z * dH;
|
|
|
|
|
|
dH += data.dSteepH;
|
|
|
|
|
|
|
|
|
|
|
|
dSteepL = ptIn.distanceTo(ptOut);
|
|
|
|
|
|
|
|
|
|
|
|
vec = (ptIn - ptOut).normalize();
|
|
|
|
|
|
pReg = makeRectRegionByPts(ptIn, ptOut, dSteepL, dSide, vec, Z);
|
|
|
|
|
|
if (!pReg)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcIn);
|
|
|
|
|
|
DELETE_PTR(pArcOut);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
crossSectionCurves.append(pReg);
|
|
|
|
|
|
|
|
|
|
|
|
ptC = getRegCenter(pReg);
|
|
|
|
|
|
arPts.append(ptC);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (arPts.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcIn);
|
|
|
|
|
|
DELETE_PTR(pArcOut);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDbSpline* pSpline = new AcDbSpline(arPts);
|
|
|
|
|
|
if (!pSpline)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcIn);
|
|
|
|
|
|
DELETE_PTR(pArcOut);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDb3dSolid* pSolid = new AcDb3dSolid;
|
|
|
|
|
|
AcDbLoftOptions op;
|
|
|
|
|
|
|
|
|
|
|
|
AcArray<AcDbRegion*> arRegs;
|
|
|
|
|
|
arRegs.removeAll();
|
|
|
|
|
|
arRegs.setLogicalLength(crossSectionCurves.length());
|
|
|
|
|
|
::memcpy(arRegs.asArrayPtr()
|
|
|
|
|
|
, crossSectionCurves.asArrayPtr()
|
|
|
|
|
|
, sizeof(AcDbRegion*)* crossSectionCurves.length());
|
|
|
|
|
|
AcDbX3dSolid xsolid;
|
|
|
|
|
|
if (xsolid.CreateLoft(arRegs, pSpline))
|
|
|
|
|
|
{
|
|
|
|
|
|
add3DCache<AecDbArcSegStair>(&xsolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus es = pSolid->createLoftedSolid(crossSectionCurves, guideCurves, pSpline, op);
|
|
|
|
|
|
if (es != eOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArcIn);
|
|
|
|
|
|
DELETE_PTR(pArcOut);
|
|
|
|
|
|
DELETE_PTR(pReg);
|
|
|
|
|
|
DELETE_PTR(pSpline);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dc.DrawEntity(pSolid);
|
|
|
|
|
|
dc.Add3dBuffer(pSolid);
|
|
|
|
|
|
|
|
|
|
|
|
dc.SetColor(nOldClr);
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus AecDbArcSegStairDraw::DrawStairsAndSlope3d(AcGiDraw& dc
|
|
|
|
|
|
, const AcDbVoidPtrArray& CurveAr
|
|
|
|
|
|
, const SFPXStair& data) const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (CurveAr.length() < 1) return Acad::eOk;
|
|
|
|
|
|
|
|
|
|
|
|
int nOldClr = dc.GetColor();
|
|
|
|
|
|
dc.SetColor(3);
|
|
|
|
|
|
|
|
|
|
|
|
int nCount = data.nSteepS;
|
|
|
|
|
|
double dSide(120);
|
|
|
|
|
|
double dSteepL = data.dRestPtL - data.dRestPtW;
|
|
|
|
|
|
|
|
|
|
|
|
AcDbArc* pArc(NULL);
|
|
|
|
|
|
AcArray<AcDbRegion*> SectionCruves1;
|
|
|
|
|
|
AcArray<AcDbRegion*> SectionCruves2;
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3dArray arPts;
|
|
|
|
|
|
arPts.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
AcArray<AcDbEntity*> crossSectionCurves, guideCurves;
|
|
|
|
|
|
crossSectionCurves.removeAll();
|
|
|
|
|
|
guideCurves.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
AcGePoint3d pt;
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 坡道用途
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bOutSideHRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 防滑条
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bDimUpstair)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SectionCruves1.removeAll();
|
|
|
|
|
|
DrawNonSilp3d(pArc, SectionCruves1, data);
|
|
|
|
|
|
if (SectionCruves1.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, -dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, -dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SectionCruves2.removeAll();
|
|
|
|
|
|
DrawNonSilp3d(pArc, SectionCruves2, data);
|
|
|
|
|
|
if (SectionCruves2.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int i(0); i < SectionCruves1.length(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
crossSectionCurves.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
crossSectionCurves.append(SectionCruves1.at(i));
|
|
|
|
|
|
pt = getRegCenter(SectionCruves1.at(i));
|
|
|
|
|
|
arPts.removeAll();
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
crossSectionCurves.append(SectionCruves2.at(i));
|
|
|
|
|
|
pt = getRegCenter(SectionCruves2.at(i));
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
|
|
|
|
|
|
AcDbSpline* pSpline = new AcDbSpline(arPts);
|
|
|
|
|
|
if (!pSpline)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDb3dSolid* pSolid = new AcDb3dSolid;
|
|
|
|
|
|
AcDbLoftOptions op;
|
|
|
|
|
|
|
|
|
|
|
|
AcArray<AcDbRegion*> arRegs;
|
|
|
|
|
|
arRegs.removeAll();
|
|
|
|
|
|
arRegs.setLogicalLength(crossSectionCurves.length());
|
|
|
|
|
|
::memcpy(arRegs.asArrayPtr()
|
|
|
|
|
|
, crossSectionCurves.asArrayPtr()
|
|
|
|
|
|
, sizeof(AcDbRegion*) * crossSectionCurves.length());
|
|
|
|
|
|
AcDbX3dSolid xsolid;
|
|
|
|
|
|
if (xsolid.CreateLoft(arRegs, pSpline))
|
|
|
|
|
|
{
|
|
|
|
|
|
add3DCache<AecDbArcSegStair>(&xsolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus es = pSolid->createLoftedSolid(crossSectionCurves, guideCurves, pSpline, op);
|
|
|
|
|
|
if (es != eOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pSpline);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dc.DrawEntity(pSolid);
|
|
|
|
|
|
dc.Add3dBuffer(pSolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 三角落地结构
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.nGShape)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SectionCruves1.removeAll();
|
|
|
|
|
|
DrawTriangleLand3d(pArc, SectionCruves1, data);
|
|
|
|
|
|
if (SectionCruves1.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bOutSideRail)
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 逆时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bRBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, -dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
// 顺时针
|
2026-09-28 15:28:50 +08:00
|
|
|
|
if (data.bLBeam)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, -dSide);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!pArc)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SectionCruves2.removeAll();
|
|
|
|
|
|
DrawTriangleLand3d(pArc, SectionCruves2, data);
|
|
|
|
|
|
if (SectionCruves2.length() < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int i(0); i < SectionCruves1.length(); ++i)
|
|
|
|
|
|
{
|
|
|
|
|
|
crossSectionCurves.removeAll();
|
|
|
|
|
|
|
|
|
|
|
|
crossSectionCurves.append(SectionCruves1.at(i));
|
|
|
|
|
|
pt = getRegCenter(SectionCruves1.at(i));
|
|
|
|
|
|
arPts.removeAll();
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
crossSectionCurves.append(SectionCruves2.at(i));
|
|
|
|
|
|
pt = getRegCenter(SectionCruves2.at(i));
|
|
|
|
|
|
arPts.append(pt);
|
|
|
|
|
|
|
|
|
|
|
|
AcDbSpline* pSpline = new AcDbSpline(arPts);
|
|
|
|
|
|
if (!pSpline)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
AcDb3dSolid* pSolid = new AcDb3dSolid;
|
|
|
|
|
|
AcDbLoftOptions op;
|
|
|
|
|
|
|
|
|
|
|
|
AcArray<AcDbRegion*> arRegs;
|
|
|
|
|
|
arRegs.removeAll();
|
|
|
|
|
|
arRegs.setLogicalLength(crossSectionCurves.length());
|
|
|
|
|
|
::memcpy(arRegs.asArrayPtr()
|
|
|
|
|
|
, crossSectionCurves.asArrayPtr()
|
|
|
|
|
|
, sizeof(AcDbRegion*)* crossSectionCurves.length());
|
|
|
|
|
|
AcDbX3dSolid xsolid;
|
|
|
|
|
|
if (xsolid.CreateLoft(arRegs, pSpline))
|
|
|
|
|
|
{
|
|
|
|
|
|
add3DCache<AecDbArcSegStair>(&xsolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Acad::ErrorStatus es = pSolid->createLoftedSolid(crossSectionCurves, guideCurves, pSpline, op);
|
|
|
|
|
|
if (es != eOk)
|
|
|
|
|
|
{
|
|
|
|
|
|
DELETE_PTR(pArc);
|
|
|
|
|
|
DELETE_PTR(pSpline);
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dc.DrawEntity(pSolid);
|
|
|
|
|
|
dc.Add3dBuffer(pSolid);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DrawSlope3d(dc, CurveAr, data);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
DrawUpStairs3d(dc, CurveAr, data);
|
|
|
|
|
|
|
|
|
|
|
|
if (DOWN_ZERO(data.dBarSide))
|
|
|
|
|
|
{
|
2026-10-04 00:04:20 +08:00
|
|
|
|
AfxMessageBox(_T("扶手距边不能小于0!"));
|
2026-09-28 15:28:50 +08:00
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (data.bInsideRail)
|
|
|
|
|
|
{
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(0);
|
|
|
|
|
|
if (!pArc) return Acad::eOk;
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, data.dBarSide + data.dGarSize[0] * .5);
|
|
|
|
|
|
if (!pArc) return Acad::eOk;
|
|
|
|
|
|
DrawRail3d(dc, pArc, data);
|
|
|
|
|
|
DrawHandRail3d(dc, pArc, data);
|
|
|
|
|
|
|
|
|
|
|
|
pArc = (AcDbArc*)CurveAr.at(1);
|
|
|
|
|
|
if (!pArc) return Acad::eOk;
|
|
|
|
|
|
pArc = (AcDbArc*)makeOffsetArcByDir(pArc, -(data.dBarSide + data.dGarSize[0] * .5));
|
|
|
|
|
|
if (!pArc) return Acad::eOk;
|
|
|
|
|
|
DrawRail3d(dc, pArc, data);
|
|
|
|
|
|
DrawHandRail3d(dc, pArc, data);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
dc.SetColor(nOldClr);
|
|
|
|
|
|
|
|
|
|
|
|
return Acad::eOk;
|
|
|
|
|
|
}
|