1245 lines
29 KiB
C++
1245 lines
29 KiB
C++
#include "stdafx.h"
|
|
#include "AecDbClimbStair.h"
|
|
#include "KTCADUtilityEx.h"
|
|
#include "AcDbX3dSolid.h"
|
|
#include "AcGiViewDraw.h"
|
|
#include "ImpMD5.h"
|
|
|
|
static void FreeBuffer(int n,AcDbVoidPtrArray& arEntPtrs)
|
|
{
|
|
AcDbEntity* pEnt = NULL;
|
|
while(arEntPtrs.length() > n )
|
|
{
|
|
pEnt = (AcDbEntity*)arEntPtrs.last();
|
|
if (pEnt != NULL)
|
|
{
|
|
pEnt->erase();
|
|
pEnt->close();
|
|
arEntPtrs.removeLast();
|
|
DELETE_PTR(pEnt);
|
|
}
|
|
}
|
|
}
|
|
|
|
extern AcGePoint3d MidPoint(const AcGePoint3d& pt1, const AcGePoint3d& pt2);
|
|
extern BOOL DLLIMPEXP GetDimGripOff();
|
|
extern void DLLIMPEXP OrthoProjected3DSolid(AcDb3dSolid* pSolidClone,const AcGePlane& plan,AcGeMatrix3d& xformPlanToWorld,AcDbVoidPtrArray& arEntPtrs);
|
|
extern Acad::ErrorStatus AddToModelSpace(AcDbEntity* pEnt, AcDbDatabase* pDb = NULL, bool bClose = true);
|
|
|
|
Adesk::UInt32 AecDbClimbStair::kCurrentVersionNumber = 1;
|
|
ACRX_DXF_DEFINE_MEMBERS (AecDbClimbStair, AecDbEwPipeBase,
|
|
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
|
AcDbProxyEntity::kNoOperation | AcDbProxyEntity::kDisableProxyWarning,
|
|
AEC_CLMSTAIR,
|
|
"AecDbLineStair"
|
|
"|Product Desc: shanghua earthworm app obj"
|
|
"|Company: shanghua inc"
|
|
"|WEB Address: www.shanghuasoft.com")
|
|
|
|
AecDbClimbStair::AecDbClimbStair(void)
|
|
{
|
|
m_mapSpecXData.SetAt(KEY_NAME,_T("圆护爬梯"));
|
|
}
|
|
|
|
AecDbClimbStair::~AecDbClimbStair(void)
|
|
{
|
|
deleteContainerOfStd(m_solids);
|
|
deleteContainerOfStd(m_pipes);
|
|
}
|
|
|
|
void AecDbClimbStair::SetClimbStairData(const ClimbStair& data)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
//set section; 底层设置section,用于绘制管子
|
|
//路径单独设置
|
|
//bar数据key方式保存
|
|
SetSection(data.dd,data.dt);
|
|
|
|
m_mapSpecXData.SetAt(KEY_TYPE,data.nType);
|
|
m_mapSpecXData.SetAt(PIPE_D,data.dD);
|
|
m_mapSpecXData.SetAt(KEY_SP,data.dSegSp);
|
|
m_mapSpecXData.SetAt(KEY_STEEPH,data.dSteepH);
|
|
m_mapSpecXData.SetAt(KEY_HEIGHT,data.dH);
|
|
m_mapSpecXData.SetAt(KEY_Width,data.dW);
|
|
m_mapSpecXData.SetAt(KEY_BOMEL,data.dBomEl);
|
|
m_mapSpecXData.SetAt(KEY_HEIGHT1,data.dH1);
|
|
m_mapSpecXData.SetAt(KEY_HEIGHT2,data.dH2);
|
|
|
|
m_mapSpecXData.SetAt(KEY_DD,data.dd);
|
|
m_mapSpecXData.SetAt(KEY_THICK,data.dt);
|
|
m_mapSpecXData.SetAt(KEY_THICKB,data.dbt);
|
|
m_mapSpecXData.SetAt(KEY_THICKBW,data.dbw);
|
|
m_mapSpecXData.SetAt(KEY_SPWALL,data.dSpWall);
|
|
|
|
m_mapSpecXData.SetAt(KEY_MATERIAL,data.m_sMaterial);
|
|
m_mapSpecXData.SetAt(KEY_FACTORY,data.m_sFactory);
|
|
m_mapSpecXData.SetAt(KEY_FACTORY,data.m_sNo);
|
|
}
|
|
|
|
void AecDbClimbStair::GetClimbStairData(ClimbStair& data) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
m_mapSpecXData.GetAt(KEY_TYPE,data.nType);
|
|
m_mapSpecXData.GetAt(PIPE_D,data.dD);
|
|
m_mapSpecXData.GetAt(KEY_SP,data.dSegSp);
|
|
m_mapSpecXData.GetAt(KEY_STEEPH,data.dSteepH);
|
|
m_mapSpecXData.GetAt(KEY_HEIGHT,data.dH);
|
|
m_mapSpecXData.GetAt(KEY_Width,data.dW);
|
|
m_mapSpecXData.GetAt(KEY_BOMEL,data.dBomEl);
|
|
m_mapSpecXData.GetAt(KEY_HEIGHT1,data.dH1);
|
|
m_mapSpecXData.GetAt(KEY_HEIGHT2,data.dH2);
|
|
|
|
m_mapSpecXData.GetAt(KEY_DD,data.dd);
|
|
m_mapSpecXData.GetAt(KEY_THICK,data.dt);
|
|
m_mapSpecXData.GetAt(KEY_THICKB,data.dbt);
|
|
m_mapSpecXData.GetAt(KEY_THICKBW,data.dbw);
|
|
|
|
data.dSpWall = 180.0;
|
|
m_mapSpecXData.GetAt(KEY_SPWALL,data.dSpWall);
|
|
|
|
CString sTemp;
|
|
m_mapSpecXData.GetAt(KEY_MATERIAL,sTemp);
|
|
_tcscpy(data.m_sMaterial,(LPCTSTR)sTemp);
|
|
|
|
m_mapSpecXData.GetAt(KEY_FACTORY,sTemp);
|
|
_tcscpy(data.m_sFactory,sTemp);
|
|
|
|
m_mapSpecXData.GetAt(KEY_NO,sTemp);
|
|
_tcscpy(data.m_sNo,sTemp);
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::dwgInFields(AcDbDwgFiler* pFiler)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
//----- Read parent class information first.
|
|
Acad::ErrorStatus es = AecDbEwPipeBase::dwgInFields (pFiler) ;
|
|
if ( es != Acad::eOk )
|
|
return (es) ;
|
|
|
|
//----- Object version number needs to be read first
|
|
Adesk::UInt32 version =0 ;
|
|
if ( (es = pFiler->readUInt32 (&version)) != Acad::eOk )
|
|
return (es) ;
|
|
|
|
if ( version > AecDbClimbStair::kCurrentVersionNumber )
|
|
return (Acad::eMakeMeProxy);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::dwgOutFields(AcDbDwgFiler* pFiler) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//----- Save parent class information first.
|
|
Acad::ErrorStatus es = AecDbEwPipeBase::dwgOutFields (pFiler) ;
|
|
if ( es != Acad::eOk )
|
|
return (es) ;
|
|
|
|
//----- Object version number needs to be saved first
|
|
if ( (es =pFiler->writeUInt32 (AecDbClimbStair::kCurrentVersionNumber)) != Acad::eOk )
|
|
return (es) ;
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::dxfInFields(AcDbDxfFiler* pFiler)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::dxfOutFields(AcDbDxfFiler* pFiler) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void AecDbClimbStair::subList() const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
acutPrintf(_T("\n圆护爬梯"));
|
|
AecDbEwPipeBase::subList();
|
|
}
|
|
|
|
bool AecDbClimbStair::GetBimInfoTip(CString& sInfoTip) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
CString sField,sFmt;
|
|
|
|
sField = _T("圆护爬梯:\n");
|
|
sInfoTip += sField;
|
|
|
|
ClimbStair data;
|
|
memset(&data,0,sizeof(ClimbStair));
|
|
GetClimbStairData(data);
|
|
|
|
MAKEFIELD(_T("爬孔直径"),_T("%d"),(int)(data.dD + 0.5),sInfoTip);
|
|
|
|
MAKEFIELD(_T("总高度"),_T("%d"),(int)(data.dH + 0.5),sInfoTip);
|
|
|
|
MAKEFIELD(_T("直梯宽度"),_T("%d"),(int)(data.dW + 0.5),sInfoTip);
|
|
|
|
MAKEFIELD(_T("进无遮挡高度"),_T("%.1f"),data.dH1,sInfoTip);
|
|
|
|
MAKEFIELD(_T("出无遮挡高度"),_T("%.1f"),data.dH2,sInfoTip);
|
|
|
|
MAKEFIELD(_T("底部标高"),_T("%.1f"),data.dBomEl,sInfoTip);
|
|
|
|
MAKEFIELD(_T("材质"),_T("%s"),data.m_sMaterial,sInfoTip);
|
|
MAKEFIELD(_T("编号"),_T("%s"),data.m_sNo,sInfoTip);
|
|
MAKEFIELD(_T("厂家"),_T("%s"),data.m_sFactory,sInfoTip);
|
|
|
|
return true;
|
|
}
|
|
|
|
AcDbArc* AecDbClimbStair::GetGuardArc(const ClimbStair& data) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AcDbLine* pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
AcGePoint3d ptSta = pLn->startPoint();
|
|
ptSta.z = 0.0;
|
|
|
|
AcGeVector3d vtDir;
|
|
m_mapSpecXData.GetAt(KEY_MAJBR,vtDir);
|
|
vtDir.normalize();
|
|
|
|
AcDbCircle* pCir = new AcDbCircle;
|
|
pCir->setCenter(ptSta);
|
|
pCir->setRadius(0.5 * data.dD);
|
|
|
|
AcGePoint3dArray arPts;
|
|
AcDbVoidPtrArray arCurPtrs;
|
|
|
|
AcGeVector3d vtD = vtDir;
|
|
vtD.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
|
|
AcGePoint3d pt1 = ptSta + vtD * 0.5 * data.dD;
|
|
AcGePoint3d pt2 = ptSta - vtD * 0.5 * data.dD;
|
|
AcGePoint3d pt3,pt4;
|
|
double dh = 0.0;
|
|
|
|
if (data.nType == 1)
|
|
{
|
|
dh = sqrt(0.25 * (data.dD * data.dD - data.dW * data.dW));
|
|
|
|
pt1 = ptSta + vtDir * dh;
|
|
pt1 -= vtD * 0.5 * data.dW;
|
|
|
|
pt2 = pt1;
|
|
pt2 += vtD * data.dW;
|
|
|
|
pt3 = ptSta - vtD * 0.5 * data.dD;
|
|
pt4 = ptSta + vtD * 0.5 * data.dD;
|
|
}
|
|
|
|
arPts.append(pt1);arPts.append(pt2);
|
|
|
|
pCir->getSplitCurves(arPts,arCurPtrs);
|
|
arPts.removeAll();
|
|
|
|
AcDbRay ray;
|
|
ray.setBasePoint(ptSta);
|
|
ray.setUnitDir(vtDir);
|
|
|
|
//去掉相交的圆弧
|
|
AcDbEntity* pEnt = NULL;
|
|
for (int i = 0;i < arCurPtrs.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)arCurPtrs.at(i);
|
|
|
|
pEnt->intersectWith(&ray,AcDb::kOnBothOperands,arPts);
|
|
if (!arPts.isEmpty())
|
|
{
|
|
arCurPtrs.removeAt(i);
|
|
delete pEnt;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!arCurPtrs.isEmpty())
|
|
{
|
|
pEnt = (AcDbEntity*)arCurPtrs.first();
|
|
AcDbArc* pArc = AcDbArc::cast(pEnt);
|
|
return pArc;
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
//AEC 派生
|
|
Acad::ErrorStatus AecDbClimbStair::Draw2d(AcGiDraw &dc) const
|
|
{
|
|
//爬梯都是垂直地面
|
|
assertReadEnabled();
|
|
|
|
AcDbObjectId idCurLay = dc.GetLayerId();
|
|
AcDbObjectId idCurLty = dc.GetLineTypeId();
|
|
Adesk::UInt16 nCrBk = colorIndex();
|
|
|
|
int nColor = nCrBk;
|
|
if (m_mapSpecXData.GetAt(_T("COLOR"), nColor))
|
|
dc.SetColor(nColor);
|
|
else
|
|
dc.SetColor(nCrBk);
|
|
|
|
//二维缓存,未知出错!
|
|
if (Has2DBuffer())
|
|
{
|
|
AcDbEntity* pEnt = NULL;
|
|
const AcDbVoidPtrArray &ar2D = Get2DBuffer();
|
|
for (int i = 0;i < ar2D.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)ar2D.at(i);
|
|
pEnt->setColorIndex(dc.GetColor());
|
|
dc.DrawEntity(*pEnt);
|
|
}
|
|
dc.SetColor(nCrBk);
|
|
dc.SetLayer(idCurLay);
|
|
dc.SetLineType(idCurLty);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
ClimbStair data;
|
|
memset(&data,0,sizeof(ClimbStair));
|
|
|
|
GetClimbStairData(data);
|
|
|
|
switch(data.nType)
|
|
{
|
|
case 0:
|
|
{
|
|
DrawClimbStair2d1(dc,data);
|
|
break;
|
|
}
|
|
case 1:
|
|
{
|
|
DrawClimbStair2d2(dc,data);
|
|
break;
|
|
}
|
|
case 2:
|
|
{
|
|
DrawClimbStair2d1(dc,data);
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
|
|
dc.SetColor(nCrBk);
|
|
dc.SetLayer(idCurLay);
|
|
dc.SetLineType(idCurLty);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::DrawClimbStair2d1(AcGiDraw &dc,ClimbStair& data) const
|
|
{
|
|
if (m_pBaseCurve != NULL)
|
|
{
|
|
AcDbLine* pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
AcGePoint3d ptSta = pLn->startPoint();
|
|
ptSta.z = 0.0;
|
|
|
|
AcGeVector3d vtDir;
|
|
m_mapSpecXData.GetAt(KEY_MAJBR,vtDir);
|
|
vtDir.normalize();
|
|
|
|
AcGeVector3d vtD = vtDir;
|
|
vtD.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
|
|
AcDbArc* pArc = GetGuardArc(data);
|
|
//背侧半圆
|
|
if (pArc != NULL)
|
|
{
|
|
if (data.nType == 0)
|
|
{
|
|
dc.DrawEntity(pArc);
|
|
Add2DBuffer(pArc);
|
|
}
|
|
|
|
AcGePoint3d pt1,pt2;
|
|
|
|
double dh = sqrt(0.25 * (data.dD * data.dD - data.dW * data.dW));
|
|
|
|
pt1 = ptSta + vtDir * dh;
|
|
pt1 -= vtD * 0.5 * data.dW;
|
|
|
|
pt2 = pt1;
|
|
pt2 += vtD * data.dW;
|
|
|
|
AcGePoint3d pt3,pt4;
|
|
pt3 = ptSta - vtD * 0.5 * data.dD;
|
|
pt4 = ptSta + vtD * 0.5 * data.dD;
|
|
|
|
double dSpWall = data.dSpWall;
|
|
if (dSpWall < 1.e-3) dSpWall = 180.0;
|
|
|
|
AcGePoint3d pt5,pt6;
|
|
pt5 = pt1 + vtDir * dSpWall;
|
|
pt6 = pt2 + vtDir * dSpWall;
|
|
|
|
AcDbPolyline* pPl = NULL;
|
|
|
|
if (data.nType == 0)
|
|
{
|
|
pPl = new AcDbPolyline;
|
|
pPl->setColorIndex(dc.GetColor());
|
|
pPl->addVertexAt(0,pt3.convert2d(AcGePlane::kXYPlane) );
|
|
pPl->addVertexAt(1,pt1.convert2d(AcGePlane::kXYPlane) );
|
|
pPl->addVertexAt(2,pt2.convert2d(AcGePlane::kXYPlane) );
|
|
pPl->addVertexAt(3,pt4.convert2d(AcGePlane::kXYPlane) );
|
|
|
|
dc.DrawEntity(pPl);
|
|
Add2DBuffer(pPl);
|
|
}
|
|
else
|
|
{
|
|
pPl = new AcDbPolyline;
|
|
pPl->setColorIndex(dc.GetColor());
|
|
pPl->addVertexAt(0,pt1.convert2d(AcGePlane::kXYPlane) );
|
|
pPl->addVertexAt(1,pt2.convert2d(AcGePlane::kXYPlane) );
|
|
|
|
dc.DrawEntity(pPl);
|
|
Add2DBuffer(pPl);
|
|
}
|
|
|
|
pPl = new AcDbPolyline;
|
|
pPl->setColorIndex(dc.GetColor());
|
|
pPl->addVertexAt(0,pt5.convert2d(AcGePlane::kXYPlane) );
|
|
pPl->addVertexAt(1,pt1.convert2d(AcGePlane::kXYPlane) );
|
|
dc.DrawEntity(pPl);
|
|
Add2DBuffer(pPl);
|
|
|
|
pPl = new AcDbPolyline;
|
|
pPl->setColorIndex(dc.GetColor());
|
|
pPl->addVertexAt(0,pt6.convert2d(AcGePlane::kXYPlane) );
|
|
pPl->addVertexAt(1,pt2.convert2d(AcGePlane::kXYPlane) );
|
|
dc.DrawEntity(pPl);
|
|
Add2DBuffer(pPl);
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::DrawClimbStair2d2(AcGiDraw &dc,ClimbStair& data) const
|
|
{
|
|
|
|
if (m_pBaseCurve != NULL)
|
|
{
|
|
AcDbLine* pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
AcGePoint3d ptSta = pLn->startPoint();
|
|
ptSta.z = 0.0;
|
|
|
|
AcGeVector3d vtDir;
|
|
m_mapSpecXData.GetAt(KEY_MAJBR,vtDir);
|
|
vtDir.normalize();
|
|
|
|
AcGeVector3d vtD = vtDir;
|
|
vtD.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
|
|
AcGePoint3d pt1,pt2;
|
|
double dh = sqrt(0.25 * (data.dD * data.dD - data.dW * data.dW));
|
|
|
|
pt1 = ptSta + vtDir * dh;
|
|
pt1 -= vtD * 0.5 * data.dW;
|
|
|
|
pt2 = pt1;
|
|
pt2 += vtD * data.dW;
|
|
|
|
AcGePoint3d pt3,pt4,pt5,pt6;
|
|
pt3 = ptSta - vtD * 0.5 * data.dD;
|
|
pt4 = ptSta + vtD * 0.5 * data.dD;
|
|
|
|
double dSpWall = 180.0;
|
|
pt5 = pt1 + vtDir * dSpWall;
|
|
pt6 = pt2 + vtDir * dSpWall;
|
|
|
|
AcDbPolyline* pPl = new AcDbPolyline;
|
|
pPl->setColorIndex(dc.GetColor());
|
|
pPl->addVertexAt(0,pt5.convert2d(AcGePlane::kXYPlane) );
|
|
pPl->addVertexAt(1,pt1.convert2d(AcGePlane::kXYPlane) );
|
|
pPl->addVertexAt(2,pt2.convert2d(AcGePlane::kXYPlane) );
|
|
pPl->addVertexAt(3,pt6.convert2d(AcGePlane::kXYPlane) );
|
|
|
|
dc.DrawEntity(pPl);
|
|
Add2DBuffer(pPl);
|
|
|
|
AcDbArc* pArc = GetGuardArc(data);
|
|
if (pArc != NULL)
|
|
{
|
|
dc.DrawEntity(pArc);
|
|
Add2DBuffer(pArc);
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::Draw3d(AcGiDraw &dc) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
////管线系统屏蔽掉
|
|
if ( dc.IsDragging() )
|
|
{
|
|
//return Acad::eOk;
|
|
}
|
|
|
|
if (m_pBaseCurve == NULL)
|
|
return Acad::eInvalidInput;
|
|
|
|
//图层
|
|
AcDbObjectId idLay = dc.GetLayerId();
|
|
dc.SetLayer(layerId());
|
|
|
|
int nCrBk = dc.GetColor();
|
|
|
|
int nColor = nCrBk;
|
|
if ( m_mapSpecXData.GetAt(_T("COLOR"),nColor) )
|
|
{
|
|
dc.SetColor(nColor);
|
|
}
|
|
|
|
if (Has3DBuffer())
|
|
{
|
|
//Clean3DBuffer();
|
|
AcDbEntity* pEnt = NULL;
|
|
const AcDbVoidPtrArray &ar3D = Get3DBuffer();
|
|
for (int i = 0;i < ar3D.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)ar3D.at(i);
|
|
pEnt->setColorIndex(nColor);
|
|
dc.DrawEntity(*pEnt);
|
|
}
|
|
|
|
dc.SetLayer(idLay);
|
|
dc.SetColor(nCrBk);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
ClimbStair data;
|
|
memset(&data,0,sizeof(ClimbStair));
|
|
GetClimbStairData(data);
|
|
|
|
deleteContainerOfStd(m_solids);
|
|
deleteContainerOfStd(m_pipes);
|
|
switch(data.nType)
|
|
{
|
|
case 0:
|
|
{
|
|
DrawClimbStair3d1(dc,data);
|
|
break;
|
|
}
|
|
case 1:
|
|
{
|
|
DrawClimbStair3d2(dc,data);
|
|
break;
|
|
}
|
|
case 2:
|
|
{
|
|
DrawClimbStair3d1(dc,data);
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
|
|
dc.SetLayer(idLay);
|
|
dc.SetColor(nCrBk);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::DrawClimbStair3d1(AcGiDraw &dc,ClimbStair& data) const
|
|
{
|
|
if (m_pBaseCurve != NULL)
|
|
{
|
|
AcDbLine* pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
AcGePoint3d ptSta = pLn->startPoint();
|
|
AcGePoint3d ptEnd = pLn->endPoint();
|
|
|
|
AcGeVector3d vtDir;
|
|
m_mapSpecXData.GetAt(KEY_MAJBR,vtDir);
|
|
vtDir.normalize();
|
|
|
|
double dh = sqrt(0.25 * (data.dD * data.dD - data.dW * data.dW));
|
|
|
|
AcGePoint3d pt1,pt2;
|
|
pt1 = ptSta + vtDir * dh;
|
|
pt2 = ptEnd + vtDir * dh;
|
|
|
|
AcGeVector3d vtD = vtDir;
|
|
vtD.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
|
|
//绘制梯子
|
|
DrawLadderH3d(dc,vtD,pt1,pt2,data);
|
|
|
|
if (data.nType == 0)
|
|
{
|
|
DrawGuardBar3d(dc,vtD,pt1,pt2,ptSta,ptEnd,data);
|
|
}
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::DrawClimbStair3d2(AcGiDraw &dc,ClimbStair& data) const
|
|
{
|
|
if (m_pBaseCurve != NULL)
|
|
{
|
|
AcDbLine* pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
AcGePoint3d ptSta = pLn->startPoint();
|
|
AcGePoint3d ptEnd = pLn->endPoint();
|
|
|
|
AcGeVector3d vtDir;
|
|
m_mapSpecXData.GetAt(KEY_MAJBR,vtDir);
|
|
vtDir.normalize();
|
|
|
|
double dh = sqrt(0.25 * (data.dD * data.dD - data.dW * data.dW));
|
|
|
|
AcGePoint3d pt1,pt2;
|
|
pt1 = ptSta + vtDir * dh;
|
|
pt2 = ptEnd + vtDir * dh;
|
|
|
|
//AA
|
|
AcGeVector3d vtD = vtDir;
|
|
vtD.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
|
|
//绘制梯子
|
|
DrawLadderH3d(dc,vtD,pt1,pt2,data);
|
|
|
|
DrawGuardBar3d(dc,vtD,pt1,pt2,ptSta,ptEnd,data);
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::DrawLadderH3d(AcGiDraw &dc,const AcGeVector3d& vtW,const AcGePoint3d& pt1,const AcGePoint3d& pt2,const ClimbStair& data) const
|
|
{
|
|
AcCmTransparency tr = transparency();
|
|
AcCmTransparency oldTr = dc.SetTransparency(tr);
|
|
//
|
|
AcGePoint3d ptL,ptR,ptLOn,ptROn;
|
|
AcGeVector3d vtDir = vtW;
|
|
vtDir.rotateBy(-PI / 2.0,AcGeVector3d::kZAxis);//同 AA位置
|
|
|
|
ptL = pt1 - vtW * 0.5 * data.dW;
|
|
ptR = pt1 + vtW * 0.5 * data.dW;
|
|
|
|
ptL.z += data.dSteepH;
|
|
ptR.z += data.dSteepH;
|
|
|
|
AcDbEntity* pEnt3d = NULL;
|
|
AcDbLine ln;
|
|
AcDbRegion* pReg = NULL;
|
|
|
|
double dSpFixFr = ptL.z;
|
|
int nPos = -1;
|
|
AcArray<int> arPos;
|
|
|
|
AecDbEwPipeBase pipe;
|
|
|
|
dc.SetColor(colorIndex());
|
|
|
|
//中间
|
|
int nCount = (int)(pt1.distanceTo(pt2) / data.dSteepH + 0.5);
|
|
for (int i = 0; i < nCount - 1; i++)
|
|
{
|
|
ln.setStartPoint(ptL);
|
|
ln.setEndPoint(ptR);
|
|
|
|
pReg = GetSection();
|
|
if (pReg != NULL)
|
|
{
|
|
pEnt3d = dc.DrawPipe(&ln,pReg,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(&ln);
|
|
pipe.SetSection(pReg,AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
|
|
//if (data.nType == 1 0 )//U 每间隔1米增加固定
|
|
{
|
|
nPos = (int)( (ptL.z - dSpFixFr ) / 1000.0 + 0.5);
|
|
|
|
if ( ( nPos > 0 && arPos.find(nPos) == -1 ) || i == ( nCount - 2 ) )
|
|
{
|
|
if (nPos > 0)
|
|
arPos.append(nPos);
|
|
|
|
ptLOn = ptL;
|
|
ptLOn += vtDir * data.dSpWall;
|
|
|
|
ln.setStartPoint(ptL);
|
|
ln.setEndPoint(ptLOn);
|
|
pEnt3d = dc.DrawPipe(&ln,pReg,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(&ln);
|
|
pipe.SetSection(pReg, AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
|
|
ptROn = ptR;
|
|
ptROn += vtDir * data.dSpWall;
|
|
ln.setStartPoint(ptR);
|
|
ln.setEndPoint(ptROn);
|
|
pEnt3d = dc.DrawPipe(&ln,pReg,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(&ln);
|
|
pipe.SetSection(pReg, AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
}
|
|
}
|
|
delete pReg;
|
|
}
|
|
|
|
ptL.z += data.dSteepH;
|
|
ptR.z += data.dSteepH;
|
|
}
|
|
|
|
ptL = pt1 - vtW * 0.5 * data.dW;
|
|
AcGePoint3d ptLT = pt2 - vtW * 0.5 * data.dW;
|
|
|
|
//左侧
|
|
ln.setStartPoint(ptL);
|
|
ln.setEndPoint(ptLT);
|
|
|
|
pReg = GetSection();
|
|
if (pReg != NULL)
|
|
{
|
|
pEnt3d = dc.DrawPipe(&ln,pReg,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(&ln);
|
|
pipe.SetSection(pReg, AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
delete pReg;
|
|
}
|
|
|
|
//右侧
|
|
ptR = pt1 + vtW * 0.5 * data.dW;
|
|
AcGePoint3d ptRT = pt2 + vtW * 0.5 * data.dW;
|
|
ln.setStartPoint(ptR);
|
|
ln.setEndPoint(ptRT);
|
|
|
|
pReg = GetSection();
|
|
if (pReg != NULL)
|
|
{
|
|
pEnt3d = dc.DrawPipe(&ln,pReg,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(&ln);
|
|
pipe.SetSection(pReg, AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
delete pReg;
|
|
}
|
|
dc.SetTransparency(oldTr);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::DrawGuardBar3d(AcGiDraw &dc,const AcGeVector3d& vtW,
|
|
const AcGePoint3d& pt1,const AcGePoint3d& pt2,
|
|
const AcGePoint3d& ptSta,const AcGePoint3d& ptEnd,
|
|
const ClimbStair& data) const
|
|
{
|
|
AcCmTransparency tr = transparency();
|
|
AcCmTransparency oldTr = dc.SetTransparency(tr);
|
|
double dDist = ptSta.distanceTo(ptEnd);
|
|
double dDist2 = dDist - data.dH1 - data.dH2;
|
|
|
|
AecDbEwPipeBase pipe;
|
|
|
|
if ((dDist2 - data.dSegSp) > 1.e-1)
|
|
{
|
|
int nCount = (int)(dDist2 / data.dSegSp + 0.5);
|
|
|
|
AcGePoint3d ptFr1 = ptSta;
|
|
ptFr1.z += data.dH1;
|
|
|
|
AcGePoint3d ptTo1 = ptEnd;
|
|
ptTo1.z -= data.dH2;
|
|
|
|
AcGeVector3d vtD = vtW;
|
|
vtD.rotateBy(-PI/2.0,AcGeVector3d::kZAxis);
|
|
vtD.normalize();
|
|
|
|
double dh = sqrt(0.25 * (data.dD * data.dD - data.dW * data.dW));
|
|
|
|
AcDbEntity* pEnt3d = NULL;
|
|
|
|
AecDbEwPipeBase dbPipe;
|
|
dbPipe.SetSection(data.dbt,data.dbw,0.0);
|
|
AcDbRegion* pReg = dbPipe.GetSection();
|
|
if (pReg != NULL)
|
|
{
|
|
AcDbArc* pArc = GetGuardArc(data);
|
|
if (pArc != NULL)
|
|
{
|
|
AcDbVoidPtrArray arCurPtrs;
|
|
arCurPtrs.append(pArc);
|
|
|
|
AcGePoint3d ptGe[4];
|
|
ptGe[0] = pt1 - vtW * 0.5 * data.dW;
|
|
ptGe[0].z = 0.0;
|
|
|
|
ptGe[1] = ptSta - vtW * 0.5 * data.dD;
|
|
ptGe[1].z = 0.0;
|
|
|
|
AcDbLine* pLn = NULL;
|
|
if (data.nType == 0)
|
|
{
|
|
pLn = new AcDbLine;
|
|
pLn->setStartPoint(ptGe[0]);
|
|
pLn->setEndPoint(ptGe[1]);
|
|
arCurPtrs.append(pLn);
|
|
|
|
ptGe[0] = pt1 + vtW * 0.5 * data.dW;
|
|
ptGe[0].z = 0.0;
|
|
|
|
ptGe[1] = ptSta + vtW * 0.5 * data.dD;
|
|
ptGe[1].z = 0.0;
|
|
|
|
pLn = new AcDbLine;
|
|
pLn->setStartPoint(ptGe[0]);
|
|
pLn->setEndPoint(ptGe[1]);
|
|
arCurPtrs.append(pLn);
|
|
}
|
|
|
|
AcDbRegion* pRegCln = NULL;
|
|
AcDbVoidPtrArray arReslt;
|
|
AcDbCurve* pCurPl = KTCADUtilityEx::ConvertBoundCurve(arCurPtrs,arReslt);
|
|
if (pCurPl != NULL)
|
|
{
|
|
AcDbPolyline* pPl = AcDbPolyline::cast(pCurPl);
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setElevation(data.dBomEl + data.dH1);
|
|
for (int i = 0;i < nCount;i++)
|
|
{
|
|
pRegCln = (AcDbRegion*)pReg->clone();
|
|
if (pRegCln != NULL)
|
|
{
|
|
pEnt3d = dc.DrawPipe(pPl,pRegCln,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(pPl);
|
|
pipe.SetSection(pRegCln, AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
pPl->setElevation(data.dBomEl + data.dH1 + (i+1) * data.dSegSp);
|
|
delete pRegCln;
|
|
}
|
|
}
|
|
|
|
double dEl = data.dBomEl + data.dH1 + (nCount - 1)* data.dSegSp;
|
|
if ( ptTo1.z - dEl > 1.e-1)//剩下的再加一圈
|
|
{
|
|
pRegCln = (AcDbRegion*)pReg->clone();
|
|
if (pRegCln != NULL)
|
|
{
|
|
pPl->setElevation(ptTo1.z);
|
|
pEnt3d = dc.DrawPipe(pPl,pRegCln,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(pPl);
|
|
pipe.SetSection(pRegCln, AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
delete pRegCln;
|
|
}
|
|
}
|
|
delete pPl;
|
|
}
|
|
}
|
|
|
|
FreeBuffer(0,arCurPtrs);
|
|
|
|
//绘制直径方向的左侧
|
|
ptGe[0] = ptSta - vtW * 0.5 * data.dD;
|
|
ptGe[0].z = ptSta.z + data.dH1;
|
|
|
|
ptGe[1] = ptGe[0];
|
|
ptGe[1].z = ptEnd.z - data.dH2;
|
|
|
|
pLn = new AcDbLine;
|
|
pLn->setStartPoint(ptGe[0]);
|
|
pLn->setEndPoint(ptGe[1]);
|
|
|
|
pRegCln = (AcDbRegion*)pReg->clone();
|
|
if (pRegCln != NULL)
|
|
{
|
|
pEnt3d = dc.DrawPipe(pLn,pRegCln,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(pLn);
|
|
pipe.SetSection(pRegCln, AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
delete pRegCln;
|
|
}
|
|
|
|
//绘制直径方向的右侧
|
|
ptGe[0] = ptSta + vtW * 0.5 * data.dD;
|
|
ptGe[0].z = ptSta.z + data.dH1;
|
|
|
|
ptGe[1] = ptGe[0];
|
|
ptGe[1].z = ptEnd.z - data.dH2;
|
|
|
|
pLn = new AcDbLine;
|
|
pLn->setStartPoint(ptGe[0]);
|
|
pLn->setEndPoint(ptGe[1]);
|
|
|
|
pRegCln = (AcDbRegion*)pReg->clone();
|
|
if (pRegCln != NULL)
|
|
{
|
|
pEnt3d = dc.DrawPipe(pLn,pRegCln,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(pLn);
|
|
pipe.SetSection(pRegCln, AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
delete pRegCln;
|
|
}
|
|
|
|
//中
|
|
AcGeVector3d vtDir;
|
|
m_mapSpecXData.GetAt(KEY_MAJBR,vtDir);
|
|
vtDir.normalize();
|
|
vtDir.negate();
|
|
|
|
ptGe[0] = ptSta;
|
|
ptGe[0] += vtDir * 0.5 * data.dD;
|
|
ptGe[0].z = ptSta.z + data.dH1;
|
|
|
|
ptGe[1] = ptGe[0];
|
|
ptGe[1].z = ptEnd.z - data.dH2;
|
|
|
|
pLn = new AcDbLine;
|
|
pLn->setStartPoint(ptGe[0]);
|
|
pLn->setEndPoint(ptGe[1]);
|
|
|
|
pRegCln = (AcDbRegion*)pReg->clone();
|
|
if (pRegCln != NULL)
|
|
{
|
|
pEnt3d = dc.DrawPipe(pLn,pRegCln,AcGePoint3d::kOrigin);
|
|
pipe.SetBaseCurve(pLn);
|
|
pipe.SetSection(pRegCln, AcGePoint3d::kOrigin);
|
|
m_pipes.push_back((AecDbEwPipeBase*)pipe.clone());
|
|
if (pEnt3d != NULL)
|
|
{
|
|
Add3DBuffer(pEnt3d);
|
|
}
|
|
delete pRegCln;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
dc.SetTransparency(oldTr);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
CString AecDbClimbStair::getUniqueName() const
|
|
{
|
|
assertReadEnabled();
|
|
CString str(_T(""));
|
|
ClimbStair data;
|
|
::memset(&data, 0, sizeof(ClimbStair));
|
|
GetClimbStairData(data);
|
|
|
|
::memset(data.m_sNo, 0, 256 * sizeof(TCHAR));
|
|
::memset(data.m_sMaterial, 0, 256 * sizeof(TCHAR));
|
|
::memset(data.m_sFactory, 0, 256 * sizeof(TCHAR));
|
|
::memset(&data.dSpWall, 0, sizeof(double));
|
|
::memset(&data.dBomEl, 0, sizeof(double));
|
|
|
|
return ImpMD5(&data, sizeof(ClimbStair)).toString16W().c_str();
|
|
}
|
|
|
|
SHJson::WValue &AecDbClimbStair::ToJson(bool bExprotGeo) const
|
|
{
|
|
assertReadEnabled();
|
|
using namespace SHJson;
|
|
WValue &v = AecDbEwPipeBase::ToJson(bExprotGeo);
|
|
|
|
if (bExprotGeo)
|
|
{
|
|
AecDbClimbStair *pNew = (AecDbClimbStair*)clone();
|
|
AcDbCurve *pCurve = pNew->GetNativeCurve();
|
|
|
|
// 把爬梯降到0标高,在revit里面,会还原
|
|
AcGeMatrix3d mat;
|
|
if (pCurve)
|
|
{
|
|
AcGePoint3d ptS(AcGePoint3d::kOrigin);
|
|
pCurve->getStartPoint(ptS);
|
|
mat.setToTranslation(-ptS.asVector());
|
|
pCurve->transformBy(mat);
|
|
pNew->GetSpecialtyData(AcDb::kForWrite)->SetAt(KEY_MAJBR, AcGeVector3d::kXAxis);
|
|
|
|
ClimbStair data;
|
|
memset(&data, 0, sizeof(ClimbStair));
|
|
pNew->GetClimbStairData(data);
|
|
data.dBomEl = .0;
|
|
pNew->SetClimbStairData(data);
|
|
}
|
|
|
|
pNew->Clean3DBuffer();
|
|
AcGiViewDraw dc;
|
|
pNew->Draw3d(dc);
|
|
|
|
WValue ar;
|
|
ar.SetArray();
|
|
|
|
for (size_t i(0); i < pNew->m_solids.size(); ++i)
|
|
{
|
|
AcDbX3dSolid *pSolid(pNew->m_solids[i]);
|
|
if (!pSolid) continue;
|
|
WValue &x = pSolid->ToJson();
|
|
pushBack(ar, x);
|
|
}
|
|
if (!pNew->m_solids.empty())
|
|
addMember(v, _T("__solids__"), ar);
|
|
|
|
ar.SetArray();
|
|
for (size_t i(0); i < pNew->m_pipes.size(); ++i)
|
|
{
|
|
AecDbEwPipeBase *pPipe(pNew->m_pipes[i]);
|
|
if (!pPipe) continue;
|
|
WValue &x = pPipe->ToJson();
|
|
pushBack(ar, x);
|
|
}
|
|
if (!pNew->m_pipes.empty())
|
|
addMember(v, _T("__pipes__"), ar);
|
|
DELETE_PTR(pNew);
|
|
}
|
|
|
|
/*
|
|
double dD; //总直径
|
|
double dSegSp; //间距
|
|
double dSteepH; //踏步高
|
|
double dH; //总高
|
|
double dW; //梯宽
|
|
double dBomEl; //底标高
|
|
double dH1; //进无遮挡高度
|
|
double dH2; //出无遮挡高度
|
|
|
|
double dd; //踏管直径
|
|
double dt; //踏管壁厚
|
|
double dbt; //护板壁厚
|
|
double dbw; //护板宽度
|
|
|
|
TCHAR m_sMaterial[256];
|
|
TCHAR m_sFactory[256];//厂家
|
|
TCHAR m_sNo[256];
|
|
*/
|
|
ClimbStair data;
|
|
::memset(&data, 0, sizeof(ClimbStair));
|
|
GetClimbStairData(data);
|
|
|
|
WValue vData;
|
|
addMember(vData, _T("__dD__"), data.dD);
|
|
addMember(vData, _T("__dSegSp__"), data.dSegSp);
|
|
addMember(vData, _T("__dSteepH__"), data.dSteepH);
|
|
addMember(vData, _T("__dH__"), data.dH);
|
|
addMember(vData, _T("__dW__"), data.dW);
|
|
addMember(vData, _T("__dBomEl__"), data.dBomEl);
|
|
addMember(vData, _T("__dH1__"), data.dH1);
|
|
addMember(vData, _T("__dH2__"), data.dH2);
|
|
|
|
addMember(vData, _T("__dd__"), data.dd);
|
|
addMember(vData, _T("__dt__"), data.dt);
|
|
addMember(vData, _T("__dbt__"), data.dbt);
|
|
addMember(vData, _T("__dbw__"), data.dbw);
|
|
|
|
addMember(vData, _T("__sMaterial__"), data.m_sMaterial);
|
|
addMember(vData, _T("__sFactory__"), data.m_sFactory);
|
|
addMember(vData, _T("__sNo__"), data.m_sNo);
|
|
addMember(v, _T("_ClimbStair_data_"), vData);
|
|
|
|
return v;
|
|
}
|
|
|
|
bool AecDbClimbStair::ByJson(const SHJson::WValue &v)
|
|
{
|
|
AssertWriteEnabled();
|
|
return AecDbEwPipeBase::ByJson(v);
|
|
}
|
|
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::subGetGripPoints(AcDbGripDataPtrArray& grips,
|
|
const double curViewUnitSize,
|
|
const int gripSize,
|
|
const AcGeVector3d& curViewDir,
|
|
const int bitflags) const
|
|
{
|
|
AecDbEwPipeBase::subGetGripPoints(grips,curViewUnitSize,gripSize,curViewDir,bitflags);
|
|
|
|
//动态标注
|
|
//直线,半径 标注风格
|
|
if (!grips.isEmpty())
|
|
{
|
|
SubAddDimPoints(grips,curViewDir);
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::subTransformBy(const AcGeMatrix3d& xform)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
AecDbEwPipeBase::subTransformBy(xform);
|
|
|
|
AcGeVector3d vtDir;
|
|
m_mapSpecXData.GetAt(KEY_MAJBR,vtDir);
|
|
vtDir.transformBy(xform);
|
|
m_mapSpecXData.SetAt(KEY_MAJBR,vtDir);
|
|
|
|
double dBomEl = 0;
|
|
m_mapSpecXData.GetAt(KEY_BOMEL,dBomEl);
|
|
|
|
AcGePoint3d pt(0,0,dBomEl);
|
|
pt.transformBy(xform);
|
|
|
|
m_mapSpecXData.SetAt(KEY_BOMEL,pt.z);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbClimbStair::SubAddDimPoints(AcDbGripDataPtrArray& grips,const AcGeVector3d& curViewDir) const
|
|
{
|
|
if (GetDimGripOff())
|
|
return Acad::eOk;
|
|
|
|
AcGePoint3d ptGe[2],ptMid;
|
|
|
|
AcDbLine* pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
ptGe[0] = pLn->startPoint();
|
|
ptGe[1] = pLn->endPoint();
|
|
|
|
AcGeVector3d vtDir;
|
|
m_mapSpecXData.GetAt(KEY_MAJBR,vtDir);
|
|
vtDir.normalize();
|
|
|
|
AcGeVector3d vtD = vtDir;
|
|
vtD.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
|
|
//高度
|
|
ptGe[0] += vtDir * 10.0;
|
|
ptGe[1] += vtDir * 10.0;
|
|
ptMid = MidPoint(ptGe[0],ptGe[1]);
|
|
ptMid += vtDir * 10.0 * 100.0;//标注文字位置
|
|
AddDimPoints(grips,curViewDir,ptGe[0],ptGe[1],ptMid,0);
|
|
|
|
//直径
|
|
ptGe[0] = pLn->endPoint();
|
|
ptGe[1] = ptGe[0];
|
|
|
|
ClimbStair data;
|
|
GetClimbStairData(data);
|
|
|
|
ptGe[0] += vtD * 0.5 * data.dD;
|
|
ptGe[1] -= vtD * 0.5 * data.dD;
|
|
|
|
ptGe[0] -= vtDir * 10.0;
|
|
ptGe[1] -= vtDir * 10.0;
|
|
|
|
ptMid = MidPoint(ptGe[0],ptGe[1]);
|
|
ptMid -= vtDir * 10.0 * 100.0;//标注文字位置
|
|
AddDimPoints(grips,curViewDir,ptGe[0],ptGe[1],ptMid,0);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
int AecDbClimbStair::GetSectionDraw(const AcGePoint3d& ptFr,const AcGePoint3d& ptTo,const AcGeVector3d& vtViewDir,const AcGeVector3d& vtTo, AcDbVoidPtrArray& arRegPtrs) const
|
|
{
|
|
AcGeVector3d vtLn = ptTo - ptFr;
|
|
AcGeVector3d vtNorm = vtLn.crossProduct(vtViewDir);
|
|
|
|
AcGePlane plan;
|
|
plan.set(ptFr,vtNorm);
|
|
|
|
AcGeMatrix3d xform;
|
|
xform.setToPlaneToWorld(plan);
|
|
xform.invert();
|
|
|
|
if (Get3DBuffer().length() == 0)
|
|
{
|
|
AcGiViewDraw dc(NULL,NULL);
|
|
Draw3d(dc);
|
|
}
|
|
|
|
AcDbEntity* pEnt = NULL;
|
|
AcDb3dSolid* pSolid = NULL;
|
|
AcDbVoidPtrArray arRegPtrsT;
|
|
|
|
const AcDbVoidPtrArray &ar3D = Get3DBuffer();
|
|
for (int i = 0;i < ar3D.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)ar3D.at(i);
|
|
|
|
pSolid = AcDb3dSolid::cast(pEnt);
|
|
if (pSolid != NULL)
|
|
{
|
|
//投影法
|
|
OrthoProjected3DSolid(pSolid,plan,xform,arRegPtrsT);
|
|
}
|
|
}
|
|
|
|
for (int i = 0;i < arRegPtrsT.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)arRegPtrsT.at(i);
|
|
pEnt->setLayer(layerId());
|
|
arRegPtrs.append(pEnt);
|
|
}
|
|
|
|
return arRegPtrs.length();
|
|
}
|
|
|
|
#include "HlrCutOption.h"
|
|
void AecDbClimbStair::ProcessHlrResult(const AcArray<AcDbEntity *> &ar
|
|
, const std::map<AcDbEntity *, AcArray<AcDbEntity *>> &preAr
|
|
, AcArray<AcDbEntity *> &output) const
|
|
{
|
|
HlrCutOption::ProcessHlrResult(this
|
|
, FALSE
|
|
, .0
|
|
, HlrCutOption::getHlrBLK_STAIR()
|
|
, ar
|
|
, preAr
|
|
, output);
|
|
}
|