1248 lines
27 KiB
C++
1248 lines
27 KiB
C++
#include "stdafx.h"
|
|
#include "AecDbGuardBar.h"
|
|
#include "KTSetting.h"
|
|
#include "KTCADUtilityEx.h"
|
|
#include "dbgrip.h"
|
|
#include "AecGripCback.h"
|
|
#include "AcGiViewDraw.h"
|
|
|
|
extern void DLLIMPEXP OrthoProjected3DSolid(AcDb3dSolid* pSolidClone,const AcGePlane& plan,AcGeMatrix3d& xformPlanToWorld,AcDbVoidPtrArray& arEntPtrs);
|
|
extern AcGePoint3d MidPoint(const AcGePoint3d& pt1, const AcGePoint3d& pt2);
|
|
extern BOOL DLLIMPEXP GetDimGripOff();
|
|
extern void SortPoints(std::vector<AcGePoint3d>& arPts,AcGeVector3d& vtDir);
|
|
extern Acad::ErrorStatus AddToModelSpace(AcDbEntity* pEnt,AcDbDatabase* pDb = NULL,bool bClose = true);
|
|
|
|
static const Adesk::UInt16 kColorByLayer = 256;
|
|
|
|
Adesk::UInt32 AecDbGuardBar::kCurrentVersionNumber = 1;
|
|
|
|
ACRX_DXF_DEFINE_MEMBERS (AecDbGuardBar, AecDbEwPipeBase,
|
|
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
|
AcDbProxyEntity::kNoOperation | AcDbProxyEntity::kDisableProxyWarning,
|
|
AEC_GUARDBAR,
|
|
"AecDbGuardBar"
|
|
"|Product Desc: shanghua earthworm app obj"
|
|
"|Company: shanghua inc"
|
|
"|WEB Address: www.shanghuasoft.com")
|
|
|
|
|
|
AecDbGuardBar::AecDbGuardBar(void)
|
|
{
|
|
m_mapSpecXData.SetAt(KEY_NAME,_T("护栏"));
|
|
}
|
|
|
|
AecDbGuardBar::~AecDbGuardBar(void)
|
|
{
|
|
}
|
|
|
|
void AecDbGuardBar::SetGuardBarData(const GuardBar& bar)
|
|
{
|
|
AssertWriteEnabled();
|
|
//set section; 底层设置section,用于绘制管子
|
|
//路径单独设置
|
|
//bar数据key方式保存
|
|
if (bar.bIsRectLever)
|
|
{
|
|
SetSection(bar.dD,bar.dD,bar.dt);
|
|
}
|
|
else
|
|
{
|
|
SetSection(bar.dD,bar.dt);
|
|
}
|
|
|
|
/*
|
|
typedef struct GuardBar
|
|
{
|
|
double dD;
|
|
double dt;
|
|
double dBomEl;
|
|
int nRow;
|
|
double dH;
|
|
TCHAR m_sMaterial[256];
|
|
|
|
}GUARDBAR;
|
|
*/
|
|
|
|
m_mapSpecXData.SetAt(PIPE_D,bar.dD);
|
|
m_mapSpecXData.SetAt(PIPE_THICK,bar.dt);
|
|
m_mapSpecXData.SetAt(PIPE_EL,bar.dBomEl);
|
|
m_mapSpecXData.SetAt(KEY_HEIGHT1,bar.dH1);
|
|
m_mapSpecXData.SetAt(KEY_HEIGHT,bar.dH);
|
|
m_mapSpecXData.SetAt(KEY_SP,bar.dP);
|
|
|
|
m_mapSpecXData.SetAt(KEY_NOBOMLEVER,bar.bNoBomLever);
|
|
m_mapSpecXData.SetAt(KEY_ISRECTLEVER,bar.bIsRectLever);
|
|
m_mapSpecXData.SetAt(KEY_VERDRAW,bar.bVerDraw);
|
|
|
|
m_mapSpecXData.SetAt(KEY_MATERIAL,bar.m_sMaterial);
|
|
m_mapSpecXData.SetAt(KEY_MATERIAL,bar.m_sNo);
|
|
}
|
|
|
|
bool AecDbGuardBar::GetGuardBarData(GuardBar& bar) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
m_mapSpecXData.GetAt(PIPE_D,bar.dD);
|
|
m_mapSpecXData.GetAt(PIPE_THICK,bar.dt);
|
|
m_mapSpecXData.GetAt(PIPE_EL,bar.dBomEl);
|
|
m_mapSpecXData.GetAt(KEY_HEIGHT1,bar.dH1);
|
|
m_mapSpecXData.GetAt(KEY_HEIGHT,bar.dH);
|
|
m_mapSpecXData.GetAt(KEY_SP,bar.dP);
|
|
|
|
m_mapSpecXData.GetAt(KEY_NOBOMLEVER,bar.bNoBomLever);
|
|
m_mapSpecXData.GetAt(KEY_ISRECTLEVER,bar.bIsRectLever);
|
|
m_mapSpecXData.GetAt(KEY_VERDRAW,bar.bVerDraw);
|
|
|
|
CString sTemp;
|
|
m_mapSpecXData.GetAt(KEY_MATERIAL,sTemp);
|
|
_tcscpy(bar.m_sMaterial,(LPCTSTR)sTemp);
|
|
|
|
m_mapSpecXData.GetAt(KEY_MATERIAL,sTemp);
|
|
_tcscpy(bar.m_sNo,(LPCTSTR)sTemp);
|
|
|
|
return true;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::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 > AecDbGuardBar::kCurrentVersionNumber )
|
|
return (Acad::eMakeMeProxy);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::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 (AecDbGuardBar::kCurrentVersionNumber)) != Acad::eOk )
|
|
return (es) ;
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::dxfInFields(AcDbDxfFiler* pFiler)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::dxfOutFields(AcDbDxfFiler* pFiler) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::subGetGripPoints(AcDbGripDataPtrArray& grips,
|
|
const double curViewUnitSize,
|
|
const int gripSize,
|
|
const AcGeVector3d& curViewDir,
|
|
const int bitflags) const
|
|
{
|
|
AecDbEwPipeBase::subGetGripPoints(grips,curViewUnitSize,gripSize,curViewDir,bitflags);
|
|
|
|
//调用基类加入单击修改
|
|
SubAddHitEditGrip(grips);
|
|
|
|
//动态标注
|
|
//直线,半径 标注风格
|
|
if (!grips.isEmpty())
|
|
{
|
|
SubAddDimPoints(grips,curViewDir);
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::subMoveGripPointsAt(const AcDbVoidPtrArray &appData, const AcGeVector3d &offset, const int bitflags)
|
|
{
|
|
if (HitOnGripEdit(appData))
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
Acad::ErrorStatus es = AecDbEwPipeBase::subMoveGripPointsAt(appData, offset, bitflags);
|
|
return es;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::SubAddDimPoints(AcDbGripDataPtrArray& grips,const AcGeVector3d& curViewDir) const
|
|
{
|
|
if (GetDimGripOff())
|
|
return Acad::eOk;
|
|
|
|
AcGeVector3d vtDirX;
|
|
AcGePoint3d ptGe[4],ptMid;
|
|
|
|
GuardBar bar;
|
|
GetGuardBarData(bar);
|
|
|
|
AcDbPolyline* pPl = AcDbPolyline::cast( m_pBaseCurve );
|
|
if (pPl != NULL)
|
|
{
|
|
for (int ii = 0;ii < pPl->numVerts() - 1;ii++)
|
|
{
|
|
pPl->getPointAt(ii,ptGe[0]);
|
|
pPl->getPointAt(ii+1,ptGe[1]);
|
|
|
|
pPl->getFirstDeriv(ptGe[0],vtDirX);
|
|
vtDirX.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
vtDirX.normalize();
|
|
ptMid = MidPoint(ptGe[0],ptGe[1]);
|
|
ptMid += vtDirX * 10.0 * 100.0;//标注文字位置
|
|
|
|
AddDimPoints(grips,curViewDir,ptGe[0],ptGe[1],ptMid,0);
|
|
}
|
|
|
|
//段长
|
|
pPl->getPointAt(0,ptGe[0]);
|
|
pPl->getFirstDeriv(ptGe[0],vtDirX);
|
|
vtDirX.normalize();
|
|
ptGe[1] = ptGe[0] + bar.dP * vtDirX;
|
|
ptGe[0].z += bar.dH;
|
|
ptGe[1].z += bar.dH;
|
|
vtDirX.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
vtDirX.normalize();
|
|
ptMid = MidPoint(ptGe[0],ptGe[1]);
|
|
ptMid += vtDirX * 10.0 * 100.0;//标注文字位置
|
|
AddDimPoints(grips,curViewDir,ptGe[0],ptGe[1],ptMid,0);
|
|
|
|
//标注高度
|
|
pPl->getPointAt(0,ptGe[0]);
|
|
ptGe[0].z = bar.dBomEl;
|
|
ptGe[1] = ptGe[0];
|
|
ptGe[1].z += bar.dH;
|
|
|
|
pPl->getFirstDeriv(ptGe[0],vtDirX);
|
|
vtDirX.negate();
|
|
vtDirX.normalize();
|
|
vtDirX *= 10.0;
|
|
|
|
ptGe[0] += vtDirX;
|
|
ptGe[1] += vtDirX;
|
|
|
|
ptMid = MidPoint(ptGe[0],ptGe[1]);
|
|
ptMid += vtDirX * 100.0;//标注文字位置
|
|
AddDimPoints(grips,curViewDir,ptGe[0],ptGe[1],ptMid,0);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
void AecDbGuardBar::subList() const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AecDbEwPipeBase::subList();
|
|
|
|
//
|
|
#ifndef ZWCAD
|
|
if (m_pBaseCurve != NULL)
|
|
m_pBaseCurve->list();
|
|
#endif
|
|
|
|
GuardBar bar;
|
|
GetGuardBarData(bar);
|
|
|
|
/*
|
|
typedef struct GuardBar
|
|
{
|
|
double dD;//管材直径
|
|
double dt;//管材厚度
|
|
double dBomEl;//底标高
|
|
double dH1;//底部格高
|
|
double dH;//扶手顶到底部高度
|
|
double dP;//格间距
|
|
TCHAR m_sMaterial[256];
|
|
//...
|
|
}GUARDBAR;
|
|
*/
|
|
acutPrintf(_T("\n护栏"));
|
|
acutPrintf(_T("\n护栏管材直径:%.f"),bar.dD);
|
|
acutPrintf(_T("\n护栏底标高:%.f"),bar.dBomEl);
|
|
acutPrintf(_T("\n护栏高度H1:%.f"),bar.dH1);
|
|
acutPrintf(_T("\n护栏高度H:%.f"),bar.dH);
|
|
acutPrintf(_T("\n护栏栅格长:%.f"),bar.dP);
|
|
acutPrintf(_T("\n护栏材料:%s"),bar.m_sMaterial);
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::subTransformBy(const AcGeMatrix3d& xform)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
AecDbEwPipeBase::subTransformBy(xform);
|
|
|
|
GuardBar bar;
|
|
GetGuardBarData(bar);
|
|
|
|
double dBomEl = 0;
|
|
m_mapSpecXData.GetAt(PIPE_EL,dBomEl);
|
|
|
|
//标高
|
|
AcGePoint3d pt1, pt2;
|
|
AcDbLine *pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
AcGeVector3d vtNorm = pLn->normal();
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))
|
|
{
|
|
pt1 = pLn->startPoint();
|
|
pt1.z = dBomEl;
|
|
|
|
pt2 = pLn->endPoint();
|
|
pt2.z = dBomEl;
|
|
|
|
pLn->setStartPoint(pt1);
|
|
pLn->setEndPoint(pt2);
|
|
}
|
|
}
|
|
|
|
AcDbPolyline *pPl = AcDbPolyline::cast(m_pBaseCurve);
|
|
if (pPl != NULL)
|
|
{
|
|
AcGeVector3d vtNorm = pPl->normal();
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))
|
|
{
|
|
pPl->setElevation(dBomEl);
|
|
}
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
bool AecDbGuardBar::GetBimInfoTip(CString& sInfoTip) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
GuardBar bar;
|
|
memset(&bar,0,sizeof(GuardBar));
|
|
GetGuardBarData(bar);
|
|
|
|
CString sField,sFmt;
|
|
sField = _T("护栏:\n");
|
|
sInfoTip += sField;
|
|
|
|
MAKEFIELD(_T("管材直径"),_T("%d"),(int)(bar.dD+0.5),sInfoTip);
|
|
MAKEFIELD(_T("底标高"),_T("%.f"),bar.dBomEl,sInfoTip);
|
|
|
|
MAKEFIELD(_T("护栏高度高度H1"),_T("%.f"),bar.dH1,sInfoTip);
|
|
MAKEFIELD(_T("护栏高度H"),_T("%.f"),bar.dH,sInfoTip);
|
|
|
|
MAKEFIELD(_T("护栏栅格长"),_T("%.f"),bar.dP,sInfoTip);
|
|
MAKEFIELD(_T("护栏材料"),_T("%s"),bar.m_sMaterial,sInfoTip);
|
|
MAKEFIELD(_T("编号"),_T("%s"),bar.m_sNo,sInfoTip);
|
|
|
|
return true;
|
|
}
|
|
|
|
AcDbCurve* GetPlOrthoProjectedCurve(AcDbPolyline* pPl)
|
|
{
|
|
AcGeVector3d vtNorm = pPl->normal();
|
|
AcGeLine3d ln3d(AcGePoint3d::kOrigin,vtNorm);
|
|
if (AcGePlane::kXYPlane.isParallelTo(ln3d))
|
|
{
|
|
AcDbCurve* pProj = NULL;
|
|
|
|
AcDbVoidPtrArray arPtrs;
|
|
pPl->explode(arPtrs);
|
|
|
|
AcGePoint3d ptS,ptE;
|
|
AcGeVector3d vtLine(0,0,0),vtT;
|
|
std::vector<AcGePoint3d> arPts;
|
|
|
|
for (int i = 0;i < arPtrs.length();i++)
|
|
{
|
|
AcDbCurve* pCr = (AcDbCurve*)arPtrs.at(i);
|
|
if (pCr != NULL)
|
|
{
|
|
//acutPrintf(_T("\nclass = %s"),pCr->isA()->name());
|
|
pCr->getStartPoint(ptS);
|
|
pCr->getEndPoint(ptE);
|
|
ptS.z = 0.0;ptE.z = 0.0;//到XY面
|
|
|
|
AcDbLine* pLn = AcDbLine::cast(pCr);
|
|
if (pLn != NULL)
|
|
{
|
|
vtT = pLn->endPoint() - pLn->startPoint();
|
|
|
|
AcGeLine3d ln3d2(AcGePoint3d::kOrigin,vtT);
|
|
if (AcGePlane::kXYPlane.isParallelTo(ln3d2))
|
|
{
|
|
vtLine = vtT;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
pCr->getOrthoProjectedCurve(AcGePlane::kXYPlane,pProj);
|
|
if (pProj != NULL)
|
|
{
|
|
pProj->getStartPoint(ptS);
|
|
pProj->getEndPoint(ptE);
|
|
ptS.z = 0.0;ptE.z = 0.0;//到XY面
|
|
|
|
vtT = ptE - ptS;
|
|
AcGeLine3d ln3d2(AcGePoint3d::kOrigin,vtT);
|
|
if (AcGePlane::kXYPlane.isParallelTo(ln3d2))
|
|
{
|
|
vtLine = vtT;
|
|
}
|
|
delete pProj;
|
|
}
|
|
}
|
|
|
|
if (ptS.distanceTo(ptE) > 1.e-2)
|
|
{
|
|
arPts.push_back(ptS);
|
|
arPts.push_back(ptE);
|
|
}
|
|
delete pCr;
|
|
}
|
|
}
|
|
|
|
if (!vtLine.isZeroLength() && arPts.size() > 0)
|
|
{
|
|
SortPoints(arPts,vtLine);
|
|
|
|
AcDbLine* pLn = new AcDbLine(arPts.at(0),arPts.at(arPts.size() - 1));
|
|
return pLn;
|
|
}
|
|
else
|
|
{
|
|
if (arPts.size() >= 2)
|
|
{
|
|
AcDbLine* pLn = new AcDbLine(arPts.at(0),arPts.at(arPts.size() - 1));
|
|
return pLn;
|
|
}
|
|
}
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::VerDraw2d(AcGiDraw &dc,const GuardBar& bar) const
|
|
{
|
|
AcGePoint3d ptS,ptE;
|
|
AcDbExtents ext;
|
|
m_pBaseCurve->getGeomExtents(ext);
|
|
|
|
AcDbCurve* pBaseCurve = NULL;
|
|
|
|
AcGePoint3d ptTmp;
|
|
m_pBaseCurve->getStartPoint(ptTmp);
|
|
|
|
AcDbCurve* pLnBase = (AcDbCurve*)m_pBaseCurve->isA()->create();
|
|
AecDbCurveBase::CopyObject(*m_pBaseCurve,*pLnBase);
|
|
|
|
ptS = ext.minPoint();
|
|
ptE = ext.maxPoint();ptE.z = ptS.z;
|
|
|
|
pBaseCurve = pLnBase;
|
|
if (pBaseCurve != NULL)
|
|
{
|
|
AcDbCurve* pBaseCln0 = NULL;
|
|
AcDbCurve* pBaseCln1 = NULL;
|
|
AcDbCurve* pBaseCln2 = NULL;
|
|
|
|
pBaseCln0 = (AcDbCurve*)pBaseCurve->isA()->create();
|
|
AecDbCurveBase::CopyObject(*pBaseCurve,*pBaseCln0);
|
|
|
|
pBaseCln1 = (AcDbCurve*)pBaseCurve->isA()->create();
|
|
AecDbCurveBase::CopyObject(*pBaseCurve,*pBaseCln1);
|
|
|
|
pBaseCln2 = (AcDbCurve*)pBaseCurve->isA()->create();
|
|
AecDbCurveBase::CopyObject(*pBaseCurve,*pBaseCln2);
|
|
|
|
AcDbPolyline* pPl = AcDbPolyline::cast(pBaseCurve);
|
|
if (pPl != NULL)
|
|
{
|
|
AcGeVector3d vtNorm = pPl->normal();
|
|
AcGeLine3d ln3d(AcGePoint3d::kOrigin,vtNorm);
|
|
if (AcGePlane::kXYPlane.isParallelTo(ln3d))
|
|
{
|
|
delete pBaseCln0;pBaseCln0 = NULL;
|
|
delete pBaseCln1;pBaseCln1 = NULL;
|
|
delete pBaseCln2;pBaseCln2 = NULL;
|
|
|
|
pBaseCln0 = GetPlOrthoProjectedCurve(pPl);
|
|
if (pBaseCln0 != NULL)
|
|
{
|
|
pBaseCln1 = (AcDbCurve*)pBaseCln0->isA()->create();
|
|
AecDbCurveBase::CopyObject(*pBaseCln0,*pBaseCln1);
|
|
|
|
pBaseCln2 = (AcDbCurve*)pBaseCln0->isA()->create();
|
|
AecDbCurveBase::CopyObject(*pBaseCln0,*pBaseCln2);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (pBaseCln0 == NULL || pBaseCln1 == NULL || pBaseCln2 == NULL)
|
|
return Acad::eOk;
|
|
|
|
AcGeVector3d vtM;
|
|
vtM.set(0,0,0);
|
|
AcGeMatrix3d xform;
|
|
xform.setToTranslation(vtM);
|
|
|
|
pBaseCln0->transformBy(xform);
|
|
pBaseCln1->transformBy(xform);
|
|
pBaseCln2->transformBy(xform);
|
|
|
|
vtM.set(0,bar.dH1,0);
|
|
xform.setToTranslation(vtM);
|
|
pBaseCln1->transformBy(xform);
|
|
|
|
vtM.set(0,bar.dH,0);
|
|
xform.setToTranslation(vtM);
|
|
pBaseCln2->transformBy(xform);
|
|
|
|
double dSta = 0.0,dEnd = 0.0;
|
|
pBaseCln0->getStartParam(dSta);
|
|
pBaseCln0->getEndParam(dEnd);
|
|
|
|
double dL = 0.0;
|
|
pBaseCln0->getDistAtParam(dEnd,dL);
|
|
|
|
int nCol = (int)(dL / bar.dP + 0.5);
|
|
double dSpa = (dEnd - dSta) / nCol;
|
|
|
|
AcDbLine* pLn = NULL;
|
|
AcGePoint3d ptPos,ptTop;
|
|
for (int i = 0;i <= nCol;i++)
|
|
{
|
|
pBaseCln0->getPointAtDist(0.0 + i * bar.dP,ptPos);
|
|
if (i == nCol)
|
|
{
|
|
pBaseCln0->getEndPoint(ptPos);
|
|
}
|
|
|
|
ptTop = ptPos;
|
|
ptTop.y += bar.dH;
|
|
pLn = new AcDbLine;
|
|
pLn->setStartPoint(ptPos);
|
|
pLn->setEndPoint(ptTop);
|
|
|
|
pLn->setColorIndex(kColorByLayer);
|
|
dc.DrawEntity(pLn);
|
|
Add2DBuffer(pLn);
|
|
}
|
|
|
|
pBaseCln0->setColorIndex(kColorByLayer);
|
|
dc.DrawEntity(pBaseCln0);
|
|
Add2DBuffer(pBaseCln0);
|
|
|
|
pBaseCln1->setColorIndex(kColorByLayer);
|
|
dc.DrawEntity(pBaseCln1);
|
|
Add2DBuffer(pBaseCln1);
|
|
|
|
pBaseCln2->setColorIndex(kColorByLayer);
|
|
dc.DrawEntity(pBaseCln2);
|
|
Add2DBuffer(pBaseCln2);
|
|
|
|
delete pBaseCurve;
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::HorDraw2d(AcGiDraw &dc,const GuardBar& bar) const
|
|
{
|
|
AcDbCurve* pProj = NULL;
|
|
AcDbVoidPtrArray arSegPtrs,arCurPtrs,arResult;
|
|
AcDbObjectId idLnSt = KTSetting::InitLineStyle(_T("FENCELINE1"));
|
|
Acad::ErrorStatus es;
|
|
|
|
AcDbPolyline* pPl = AcDbPolyline::cast(m_pBaseCurve);
|
|
if (pPl != NULL)
|
|
{
|
|
AcDbCurve* pPlCln = (AcDbCurve*)pPl->clone();
|
|
if (pPlCln != NULL)
|
|
{
|
|
pPlCln->setLayer(layerId());
|
|
pPlCln->setLinetype(idLnSt);
|
|
es = pPlCln->setLinetypeScale(20.0);
|
|
|
|
dc.DrawEntity(pPlCln);
|
|
Add2DBuffer(pPlCln);
|
|
|
|
return Acad::eOk;
|
|
}
|
|
}
|
|
|
|
m_pBaseCurve->explode(arSegPtrs);
|
|
AcDbCurve* pCurT = NULL;
|
|
for (int ii = 0;ii < arSegPtrs.length();ii++)
|
|
{
|
|
pCurT = (AcDbCurve*)arSegPtrs.at(ii);
|
|
if (pCurT != NULL)
|
|
{
|
|
AcDbArc* pArc = AcDbArc::cast(pCurT);
|
|
if (pArc != NULL)
|
|
{
|
|
arCurPtrs.append(pCurT);
|
|
continue;
|
|
}
|
|
AcDbLine* pLn = AcDbLine::cast(pCurT);
|
|
if (pLn != NULL)
|
|
{
|
|
arCurPtrs.append(pCurT);
|
|
continue;
|
|
}
|
|
|
|
pCurT->getOrthoProjectedCurve(AcGePlane::kXYPlane,pProj);
|
|
if (pProj != NULL)
|
|
{
|
|
arCurPtrs.append(pProj);
|
|
}
|
|
delete pCurT;
|
|
}
|
|
}
|
|
|
|
//-------()-------()-------()--------
|
|
//FENCELINE1
|
|
|
|
AcDbCurve* pCurve = KTCADUtilityEx::ConvertBoundCurve(arCurPtrs,arResult);
|
|
if (pCurve != NULL)
|
|
{
|
|
AcDbPolyline* pPl = AcDbPolyline::cast(pCurve);
|
|
if (pPl != NULL)
|
|
{
|
|
pPl->setNormal(AcGeVector3d::kZAxis);
|
|
}
|
|
pCurve->setLayer(layerId());
|
|
pCurve->setLinetype(idLnSt);
|
|
es = pCurve->setLinetypeScale(20.0);
|
|
|
|
dc.DrawEntity(pCurve);
|
|
Add2DBuffer(pCurve);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::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);
|
|
}
|
|
|
|
//二维缓存,未知出错!
|
|
if (Has2DBuffer())
|
|
{
|
|
AcDbEntity* pEnt = NULL;
|
|
const AcDbVoidPtrArray &ar2D = Get2DBuffer();
|
|
for (int i = 0;i < ar2D.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)ar2D.at(i);
|
|
dc.DrawEntity(*pEnt);
|
|
}
|
|
dc.SetColor(nCrBk);
|
|
dc.SetLayer(idCurLay);
|
|
dc.SetLineType(idCurLty);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
if (m_pBaseCurve != NULL)//路径
|
|
{
|
|
int nStyle = 0,nCol = 0;
|
|
m_mapSpecXData.GetAt(KEY_2DSTYLE,nStyle);
|
|
|
|
double dSta = 0.0,dEnd = 0.0,dL1 = 0.0;
|
|
double dL2 = 0.0,dP = 0.0,dH = 0.0,dH1 = 0.0;
|
|
|
|
BOOL bVerDraw = 0;
|
|
m_mapSpecXData.GetAt(KEY_SP,dP);
|
|
m_mapSpecXData.GetAt(KEY_HEIGHT,dH);
|
|
m_mapSpecXData.GetAt(KEY_HEIGHT1,dH1);
|
|
m_mapSpecXData.GetAt(KEY_VERDRAW,bVerDraw);
|
|
|
|
AcDbObjectId idLnSt;
|
|
AcDbVoidPtrArray arCurPtrs,arResult;
|
|
|
|
AcGeVector3d vtDrawPlanNorm = AcGeVector3d::kZAxis;
|
|
AcGePlane planXY;
|
|
dc.GetDraw2DPlan(planXY);
|
|
vtDrawPlanNorm = planXY.normal();
|
|
|
|
//取法向量
|
|
AcGeVector3d vtDir;
|
|
AcDbPolyline* pPlBase = AcDbPolyline::cast(m_pBaseCurve);
|
|
if (pPlBase != NULL)
|
|
{
|
|
vtDir = pPlBase->normal();
|
|
}
|
|
|
|
AcDbLine* pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
vtDir = pLn->normal();
|
|
}
|
|
vtDir.normalize();
|
|
|
|
AcGePoint3d ptS,ptE;
|
|
AcGeLine3d ln3d(AcGePoint3d::kOrigin,10.0 * vtDir);
|
|
|
|
GuardBar bar;
|
|
GetGuardBarData(bar);
|
|
|
|
switch(nStyle)
|
|
{
|
|
case 0:
|
|
{
|
|
//曲线法向量平行XY面,绘制栅格
|
|
if ( ln3d.isParallelTo(planXY) )//二维 或 立面护栏
|
|
{
|
|
//栅格
|
|
//------------------------------------
|
|
//| | | | | | | | | | | | |
|
|
//------------------------------------
|
|
|
|
if ( bVerDraw )//二维,栅格表达
|
|
{
|
|
VerDraw2d(dc,bar);
|
|
}
|
|
else //立面起伏护栏
|
|
{
|
|
HorDraw2d(dc,bar);
|
|
}
|
|
}
|
|
else //放样线在 XY 平行平面内
|
|
{
|
|
if (ln3d.isPerpendicularTo(planXY)) //单线
|
|
{
|
|
if ( bVerDraw )
|
|
{
|
|
VerDraw2d(dc,bar);
|
|
}
|
|
else
|
|
{
|
|
HorDraw2d(dc,bar);
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
|
|
dc.SetColor(nCrBk);
|
|
dc.SetLayer(idCurLay);
|
|
dc.SetLineType(idCurLty);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
//解决poly带来的3D消失为题
|
|
|
|
AcDbEntity* AecDbGuardBar::DrawPipe(AcGiDraw &dc,AcDbCurve* pBaseCln1,AcDbRegion* pRegnCln,const AcGePoint3d& ptOrigin,int nColor) const
|
|
{
|
|
AcDbPolyline* pPl = AcDbPolyline::cast(pBaseCln1);
|
|
if (pPl != NULL)
|
|
{
|
|
AcDbVoidPtrArray arCurPtrs;
|
|
pPl->explode(arCurPtrs);
|
|
|
|
AcDbEntity* p3dEnt = NULL;
|
|
AcDbCurve* pCurT = NULL;
|
|
for (int i = 0;i < arCurPtrs.length();i++)
|
|
{
|
|
pCurT = (AcDbCurve*)arCurPtrs.at(i);
|
|
|
|
AcDbRegion* pRegnClnCln = (AcDbRegion*)pRegnCln->clone();
|
|
p3dEnt = dc.DrawPipe(pCurT,pRegnClnCln,ptOrigin);
|
|
|
|
if (p3dEnt != NULL)
|
|
{
|
|
p3dEnt->setColorIndex(nColor);
|
|
Add3DBuffer(p3dEnt);
|
|
}
|
|
delete pCurT;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return dc.DrawPipe(pBaseCln1,pRegnCln,ptOrigin);
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbGuardBar::Draw3d(AcGiDraw &dc) const
|
|
{
|
|
//护栏的样子参照 PDMS 的样子
|
|
assertReadEnabled();
|
|
|
|
AcCmTransparency tr = transparency();
|
|
AcCmTransparency oldTr = dc.SetTransparency(tr);
|
|
|
|
BOOL bVerDraw = FALSE;
|
|
m_mapSpecXData.GetAt(KEY_VERDRAW,bVerDraw);
|
|
if (bVerDraw)
|
|
{
|
|
//仅仅是立面二维符号表达,不创建三维
|
|
return Acad::eOk;
|
|
}
|
|
|
|
////管线系统屏蔽掉
|
|
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;
|
|
}
|
|
|
|
GuardBar bar;
|
|
GetGuardBarData(bar);
|
|
|
|
AcDbCurve* pBaseCln0 = (AcDbCurve*)m_pBaseCurve->clone();
|
|
AcDbCurve* pBaseCln1 = (AcDbCurve*)m_pBaseCurve->clone();
|
|
AcDbCurve* pBaseCln2 = (AcDbCurve*)m_pBaseCurve->clone();
|
|
|
|
//有标高的线
|
|
AcDbLine* pLnBase = AcDbLine::cast(pBaseCln0);
|
|
if (pLnBase != NULL)
|
|
{
|
|
AcGeVector3d vtNorm = pLnBase->normal();
|
|
|
|
AcGePoint3d ptSta,ptEnd;
|
|
pLnBase->getStartPoint(ptSta);
|
|
pLnBase->getEndPoint(ptEnd);
|
|
|
|
//底
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))
|
|
{
|
|
ptSta.z = bar.dBomEl;
|
|
ptEnd.z = bar.dBomEl;
|
|
|
|
pLnBase->setStartPoint(ptSta);
|
|
pLnBase->setEndPoint(ptEnd);
|
|
}
|
|
|
|
//中
|
|
ptSta.z += bar.dH1;
|
|
ptEnd.z += bar.dH1;
|
|
|
|
pLnBase = AcDbLine::cast(pBaseCln1);
|
|
pLnBase->setStartPoint(ptSta);
|
|
pLnBase->setEndPoint(ptEnd);
|
|
|
|
//顶
|
|
ptSta.z += (bar.dH - bar.dH1);
|
|
ptEnd.z += (bar.dH - bar.dH1);
|
|
|
|
pLnBase = AcDbLine::cast(pBaseCln2);
|
|
pLnBase->setStartPoint(ptSta);
|
|
pLnBase->setEndPoint(ptEnd);
|
|
}
|
|
|
|
AcDbPolyline* pPlBase = AcDbPolyline::cast(pBaseCln0);
|
|
if (pPlBase != NULL)
|
|
{
|
|
AcGeVector3d vtNorm = pPlBase->normal();
|
|
|
|
//底
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))
|
|
{
|
|
pPlBase->setElevation(bar.dBomEl);
|
|
|
|
AcDbPolyline* pPlBase1 = AcDbPolyline::cast(pBaseCln1);
|
|
pPlBase1->setElevation(bar.dBomEl + bar.dH1);
|
|
|
|
AcDbPolyline* pPlBase2 = AcDbPolyline::cast(pBaseCln2);
|
|
pPlBase2->setElevation(bar.dBomEl + bar.dH);
|
|
}
|
|
}
|
|
|
|
//底部管子段
|
|
if (m_pRegion != NULL)
|
|
{
|
|
AcDbEntity* p3dEnt = NULL;
|
|
AcDbRegion* pRegnCln = NULL;
|
|
|
|
//底
|
|
if ( !bar.bNoBomLever )
|
|
{
|
|
pRegnCln = (AcDbRegion*)m_pRegion->clone();
|
|
if (pRegnCln != NULL)
|
|
{
|
|
p3dEnt = dc.DrawPipe(pBaseCln0,pRegnCln,AcGePoint3d::kOrigin);
|
|
if (p3dEnt != NULL)
|
|
{
|
|
p3dEnt->setColorIndex(nColor);
|
|
Add3DBuffer(p3dEnt);
|
|
}
|
|
delete pRegnCln;
|
|
pRegnCln = NULL;
|
|
}
|
|
}
|
|
|
|
//中
|
|
pRegnCln = (AcDbRegion*)m_pRegion->clone();
|
|
if (pRegnCln != NULL)
|
|
{
|
|
p3dEnt = dc.DrawPipe(pBaseCln1,pRegnCln,AcGePoint3d::kOrigin);
|
|
if (p3dEnt != NULL)
|
|
{
|
|
p3dEnt->setColorIndex(nColor);
|
|
Add3DBuffer(p3dEnt);
|
|
}
|
|
delete pRegnCln;
|
|
pRegnCln = NULL;
|
|
}
|
|
|
|
//顶
|
|
pRegnCln = (AcDbRegion*)m_pRegion->clone();
|
|
if (pRegnCln != NULL)
|
|
{
|
|
p3dEnt = dc.DrawPipe(pBaseCln2,pRegnCln,AcGePoint3d::kOrigin);
|
|
if (p3dEnt != NULL)
|
|
{
|
|
p3dEnt->setColorIndex(nColor);
|
|
Add3DBuffer(p3dEnt);
|
|
}
|
|
delete pRegnCln;
|
|
pRegnCln = NULL;
|
|
}
|
|
|
|
double dSta = 0.0,dEnd = 0.0;
|
|
pBaseCln0->getStartParam(dSta);
|
|
pBaseCln0->getEndParam(dEnd);
|
|
|
|
double dL = 0.0;
|
|
pBaseCln0->getDistAtParam(dEnd,dL);
|
|
|
|
int nCol = (int)(dL / bar.dP + 0.5);
|
|
double dSpa = (dEnd - dSta) / nCol;
|
|
|
|
AcDbLine ln;
|
|
AcGePoint3d ptPos,ptTop;
|
|
for (int i = 0;i <= nCol;i++)
|
|
{
|
|
pBaseCln0->getPointAtDist(0.0 + i * bar.dP,ptPos);
|
|
if (i == nCol)
|
|
{
|
|
pBaseCln0->getEndPoint(ptPos);
|
|
}
|
|
|
|
ptTop = ptPos;
|
|
ptTop.z += bar.dH;
|
|
|
|
ln.setStartPoint(ptPos);
|
|
ln.setEndPoint(ptTop);
|
|
|
|
pRegnCln = (AcDbRegion*)m_pRegion->clone();
|
|
|
|
if (pRegnCln != NULL)
|
|
{
|
|
p3dEnt = dc.DrawPipe(&ln,pRegnCln,AcGePoint3d::kOrigin);
|
|
if (p3dEnt != NULL)
|
|
{
|
|
p3dEnt->setColorIndex(nColor);
|
|
Add3DBuffer(p3dEnt);
|
|
}
|
|
delete pRegnCln;
|
|
pRegnCln = NULL;
|
|
}
|
|
|
|
//然后绘制球 影响速度,暂时注掉2025711
|
|
//底
|
|
/*if (!bar.bNoBomLever)
|
|
{
|
|
p3dEnt = dc.DrawSphere(ptPos,bar.dD);//2 * r
|
|
if (p3dEnt != NULL)
|
|
{
|
|
p3dEnt->setColorIndex(nColor);
|
|
Add3DBuffer(p3dEnt);
|
|
}
|
|
}
|
|
|
|
//中
|
|
ptPos.z += bar.dH1;
|
|
p3dEnt = dc.DrawSphere(ptPos,bar.dD);//2 * r
|
|
if (p3dEnt != NULL)
|
|
{
|
|
p3dEnt->setColorIndex(nColor);
|
|
Add3DBuffer(p3dEnt);
|
|
}
|
|
|
|
//顶
|
|
p3dEnt = dc.DrawSphere(ptTop,bar.dD);//2 * r
|
|
if (p3dEnt != NULL)
|
|
{
|
|
p3dEnt->setColorIndex(nColor);
|
|
Add3DBuffer(p3dEnt);
|
|
}*/
|
|
}
|
|
|
|
delete pBaseCln0;
|
|
delete pBaseCln1;
|
|
delete pBaseCln2;
|
|
}
|
|
return Acad::eOk;
|
|
dc.SetTransparency(tr);
|
|
}
|
|
|
|
AcGePoint3d GetCurveMidPoint(AcDbCurve* pCurve)
|
|
{
|
|
double dSta = 0.0,dEnd = 0.0;
|
|
pCurve->getStartParam(dSta);
|
|
pCurve->getEndParam(dEnd);
|
|
|
|
AcGePoint3d pt;
|
|
pCurve->getPointAtParam((dSta+dEnd) / 2.0,pt);
|
|
|
|
return pt;
|
|
}
|
|
|
|
bool AecDbGuardBar::GetSectionDraw(AcGePlane& plan,const AcGeVector3d& vtTo,AcDbVoidPtrArray& arRegionPtrs) const
|
|
{
|
|
BOOL bVerDraw = FALSE;
|
|
m_mapSpecXData.GetAt(KEY_VERDRAW,bVerDraw);
|
|
|
|
if (bVerDraw)
|
|
{
|
|
acutPrintf(_T("\n二维栅格护栏不可剖切!"));
|
|
return false;
|
|
}
|
|
|
|
AcGeMatrix3d xform;
|
|
xform.setToPlaneToWorld(plan);
|
|
xform.invert();
|
|
|
|
AcGeVector3d vtNorm(0,0,1);
|
|
AcDbVoidPtrArray arSubPtrs;
|
|
AecDbGuardBar* pFit = (AecDbGuardBar *)clone();
|
|
if (pFit != NULL)
|
|
{
|
|
GuardBar bar;
|
|
GetGuardBarData(bar);
|
|
|
|
//护栏必须是视图elevation 变量=0绘制
|
|
AcDbPolyline* pPl = AcDbPolyline::cast(pFit->m_pBaseCurve);
|
|
if (pPl != NULL)
|
|
{
|
|
vtNorm = pPl->normal();
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))
|
|
{
|
|
pPl->setElevation(bar.dBomEl);
|
|
}
|
|
|
|
//裁剪
|
|
AcDbXline xLn;
|
|
AcGePoint3d ptOrg;
|
|
AcGeVector3d vtX,vtY;
|
|
plan.getCoordSystem(ptOrg,vtX,vtY);
|
|
ptOrg.z = 0.0;
|
|
|
|
AcGePoint3d pt1 = ptOrg;
|
|
pt1.z = 0.0;
|
|
pt1 += 1000.0 * vtX;
|
|
pt1.z = 0.0;
|
|
|
|
AcGeVector3d vt = pt1 - ptOrg;
|
|
if (vt.isParallelTo(vtNorm))
|
|
{
|
|
pt1 = ptOrg;
|
|
pt1 += 1000.0 * vtY;
|
|
pt1.z = 0.0;
|
|
}
|
|
vt = pt1 - ptOrg;
|
|
|
|
xLn.setBasePoint(ptOrg);
|
|
xLn.setUnitDir(vt);
|
|
|
|
AcGePoint3dArray arPts;
|
|
pPl->intersectWith(&xLn,AcDb::kOnBothOperands,arPts);
|
|
|
|
AcDbVoidPtrArray arCurPtrs;
|
|
pPl->getSplitCurves(arPts,arCurPtrs);
|
|
|
|
if (!arCurPtrs.isEmpty())
|
|
{
|
|
AcGeVector3d vtNm = vtTo;
|
|
AcDbCurve* pCurv = NULL;
|
|
|
|
AcDbRay ray;
|
|
for (int i = 0;i < arCurPtrs.length();i++)
|
|
{
|
|
pCurv = (AcDbCurve*)arCurPtrs.at(i);
|
|
|
|
pt1 = GetCurveMidPoint(pCurv);
|
|
pt1 = pt1.orthoProject(plan);
|
|
|
|
ray.setBasePoint(pt1);
|
|
ray.setUnitDir(vtNm);
|
|
|
|
arPts.removeAll();
|
|
pCurv->intersectWith(&ray,AcDb::kOnBothOperands,arPts);
|
|
|
|
if (!arPts.isEmpty())
|
|
{
|
|
AecDbGuardBar* pFitNew = (AecDbGuardBar *)clone();
|
|
if (pFitNew != NULL)
|
|
{
|
|
pFitNew->SetBaseCurve(pCurv);
|
|
|
|
pFitNew->transformBy(xform);
|
|
|
|
pFitNew->GetSpecialtyData()->SetAt(KEY_VERDRAW,TRUE);
|
|
|
|
AcGiViewDraw dc(NULL, NULL);
|
|
pFitNew->Draw2d(dc);
|
|
|
|
arSubPtrs.removeAll();
|
|
pFitNew->GetDraw2dables(0,arSubPtrs);
|
|
|
|
//标注DNXXX
|
|
|
|
//去掉圆
|
|
AcDbEntity* pSubEnt = NULL;
|
|
for(int ii = 0;ii < arSubPtrs.length();ii++)
|
|
{
|
|
pSubEnt = (AcDbEntity*)arSubPtrs.at(ii);
|
|
if (AcDbCircle::cast(pSubEnt ) == NULL)
|
|
{
|
|
arRegionPtrs.append(pSubEnt);
|
|
}
|
|
}
|
|
delete pFitNew;
|
|
|
|
//TEST
|
|
//pCurv->setColorIndex(1);
|
|
//AddToModelSpace(pCurv);
|
|
//pCurv = NULL;
|
|
}
|
|
}
|
|
|
|
if (pCurv != NULL) delete pCurv;
|
|
}
|
|
|
|
delete pFit;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
pFit->transformBy(xform);
|
|
|
|
AcGeVector3d vtNorm = plan.normal();
|
|
if (vtNorm.isParallelTo(AcGeVector3d::kZAxis))
|
|
pFit->GetSpecialtyData()->SetAt(KEY_VERDRAW,FALSE);
|
|
else
|
|
pFit->GetSpecialtyData()->SetAt(KEY_VERDRAW, TRUE);
|
|
|
|
AcGiViewDraw dc(NULL, NULL);
|
|
|
|
dc.SetDraw2DPlan(plan);
|
|
pFit->Draw2d(dc);
|
|
|
|
pFit->GetDraw2dables(0,arSubPtrs);
|
|
|
|
//去掉圆
|
|
AcDbEntity* pSubEnt = NULL;
|
|
for(int i = 0;i < arSubPtrs.length();i++)
|
|
{
|
|
pSubEnt = (AcDbEntity*)arSubPtrs.at(i);
|
|
if (AcDbCircle::cast(pSubEnt ) == NULL)
|
|
{
|
|
arRegionPtrs.append(pSubEnt);
|
|
}
|
|
}
|
|
delete pFit;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
SHJson::WValue &AecDbGuardBar::ToJson(bool bExprotGeo) const
|
|
{
|
|
assertReadEnabled();
|
|
using namespace SHJson;
|
|
WValue &v = AecDbEwPipeBase::ToJson(bExprotGeo);
|
|
|
|
GuardBar bar;
|
|
::memset(&bar, 0, sizeof(GuardBar));
|
|
GetGuardBarData(bar);
|
|
|
|
/*
|
|
double dD;//管材直径
|
|
double dt;//管材厚度
|
|
double dBomEl;//底标高
|
|
double dH1;//底部格高
|
|
double dH;//扶手顶到底部高度
|
|
double dP;//格间距
|
|
BOOL bNoBomLever;//没有底部杆件
|
|
BOOL bIsRectLever;//方杆件
|
|
|
|
TCHAR m_sMaterial[256];
|
|
TCHAR m_sFactory[256];//厂家
|
|
TCHAR m_sNo[256];
|
|
*/
|
|
addMember(v, _T("__dD__"), bar.dD);
|
|
addMember(v, _T("__dt__"), bar.dt);
|
|
addMember(v, _T("__dBomEl__"), bar.dBomEl);
|
|
addMember(v, _T("__dH1__"), bar.dH1);
|
|
addMember(v, _T("__dH__"), bar.dH);
|
|
addMember(v, _T("__dP__"), bar.dP);
|
|
|
|
addMember(v, _T("__bNoBomLever__"), bar.bNoBomLever == FALSE ? false : true);
|
|
addMember(v, _T("__bIsRectLever__"), bar.bIsRectLever == FALSE ? false : true);
|
|
|
|
addMember(v, _T("__sMaterial__"), bar.m_sMaterial);
|
|
addMember(v, _T("__sFactory__"), bar.m_sFactory);
|
|
addMember(v, _T("__sNo__"), bar.m_sNo);
|
|
|
|
return v;
|
|
}
|
|
|
|
bool AecDbGuardBar::ByJson(const SHJson::WValue &v)
|
|
{
|
|
AssertWriteEnabled();
|
|
return AecDbEwPipeBase::ByJson(v);
|
|
}
|