1206 lines
30 KiB
C++
1206 lines
30 KiB
C++
#include "stdafx.h"
|
|
#include "AecDbBeam.h"
|
|
|
|
#include "dbgrip.h"
|
|
#include "AecGripCback.h"
|
|
#include "AecDbColumn.h"
|
|
#include "simpleproperty.h"
|
|
#include "coretools.h"
|
|
#include "AcGiExplodeDraw.h"
|
|
#include "gidrawutility.h"
|
|
|
|
extern double PixelToWcs(int nPixel);
|
|
extern BOOL Is2DView();
|
|
extern AcGeVector3d GetUcsZvt();
|
|
extern void PushGripMessage(GripMessage&);
|
|
|
|
extern AcDbArc* FormatArc(const AcGePoint3d& ptGe1,const AcGePoint3d& ptGe2,const AcGePoint3d& ptGe3);
|
|
extern void transfromRegion(AcDbRegion *pRegion, const AcGePoint3d &ptOnRegion, const AcGeVector3d &vtNormal, const AcGePoint3d &ptOnPlan);
|
|
extern AcGePoint3d GetArcMidPoint(AcDbArc* pArc);
|
|
//extern convex_hull2d(arPt2ds,arPt2dPoly);
|
|
extern AcGePoint3d MidPoint(const AcGePoint3d& pt1, const AcGePoint3d& pt2);
|
|
extern BOOL DLLIMPEXP GetDimGripOff();
|
|
|
|
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;
|
|
|
|
Adesk::UInt32 AecDbBeam::kCurrentVersionNumber = 1;
|
|
|
|
ACRX_DXF_DEFINE_MEMBERS (AecDbBeam, AecDbBDPipeBase,
|
|
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
|
|
AcDbProxyEntity::kNoOperation | AcDbProxyEntity::kDisableProxyWarning,
|
|
AEC_DBBEAM,
|
|
"AecDbBeam"
|
|
"|Product Desc: shanghua earthworm app obj"
|
|
"|Company: shanghua inc"
|
|
"|WEB Address: www.shanghuasoft.com")
|
|
|
|
AecDbBeam::AecDbBeam(void)
|
|
{
|
|
m_mapSpecXData.SetAt(KEY_2DSTYLE,2);
|
|
m_mapSpecXData.SetAt(KEY_CENNODRAW,1);
|
|
m_mapSpecXData.SetAt(KEY_NAME,_T("梁"));
|
|
|
|
}
|
|
|
|
AecDbBeam::~AecDbBeam(void)
|
|
{
|
|
}
|
|
|
|
void AecDbBeam::SetBeamData(double dw,double dh)
|
|
{
|
|
AssertWriteEnabled();
|
|
SetSection(dw,dh,0.0);
|
|
}
|
|
|
|
void AecDbBeam::GetBeamData(ColumnParam& data) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pBaseCurve != NULL)
|
|
{
|
|
AcGePoint3d ptSta,ptEnd;
|
|
m_pBaseCurve->getStartPoint(ptSta);
|
|
m_pBaseCurve->getEndPoint(ptEnd);
|
|
|
|
data.m_dBomEl = ptSta.z;
|
|
data.m_dEndEl = ptEnd.z;
|
|
data.m_dH = ptSta.distanceTo(ptEnd);
|
|
|
|
AcDbRegion* pReg = GetSection();
|
|
if (pReg != NULL)
|
|
{
|
|
AcDbExtents ext;
|
|
pReg->getGeomExtents(ext);
|
|
|
|
data.m_dSizes[0] = ext.maxPoint().x - ext.minPoint().x;
|
|
data.m_dSizes[1] = ext.maxPoint().y - ext.minPoint().y;
|
|
|
|
//调整到顶标高
|
|
double dH = ext.maxPoint().y - ext.minPoint().y;
|
|
data.m_dBomEl += 0.5 * dH;
|
|
data.m_dEndEl += 0.5 * dH;
|
|
delete pReg;
|
|
}
|
|
|
|
m_mapSpecXData.GetAt(KEY_SHAPE,data.m_nShape);
|
|
|
|
CString sTmp;
|
|
m_mapSpecXData.GetAt(KEY_MATERIAL,sTmp);
|
|
_tcscpy(data.m_sMaterial,(LPCTSTR)sTmp);
|
|
|
|
m_mapSpecXData.GetAt(KEY_BLOCKNAME,sTmp);
|
|
_tcscpy(data.m_sBlockName,(LPCTSTR)sTmp);
|
|
|
|
m_mapSpecXData.GetAt(KEY_NO,data.m_szNo);
|
|
|
|
memset(data.m_dSizes,0,sizeof(double) * 4);
|
|
m_mapSpecXData.GetAt(KEY_SIZE1,data.m_dSizes[0]);
|
|
m_mapSpecXData.GetAt(KEY_SIZE2,data.m_dSizes[1]);
|
|
m_mapSpecXData.GetAt(KEY_SIZE3,data.m_dSizes[2]);
|
|
m_mapSpecXData.GetAt(KEY_SIZE4,data.m_dSizes[3]);
|
|
|
|
m_mapSpecXData.GetAt(KEY_XS,data.m_dXScale);
|
|
m_mapSpecXData.GetAt(KEY_YS,data.m_dYScale);
|
|
m_mapSpecXData.GetAt(KEY_XE,data.m_dXExtend);
|
|
m_mapSpecXData.GetAt(KEY_YE,data.m_dYExtend);
|
|
|
|
m_mapSpecXData.GetAt(KEY_SECTION_HATCH, sTmp);
|
|
_tcscpy(data.m_sHatch,(LPCTSTR)sTmp);
|
|
|
|
m_mapSpecXData.GetAt(AecDbColumn::KEY_COL_MODEL, sTmp);
|
|
_tcscpy(data.m_sModel,(LPCTSTR)sTmp);
|
|
}
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::Draw3d(AcGiDraw &dc) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (Has3DBuffer())
|
|
{
|
|
Draw3DBuffers(dc);
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus es;
|
|
AcDbRegion *pRegCln(NULL), *pReg(NULL);
|
|
AcDbCurve *pCrvCln(NULL);
|
|
do
|
|
{
|
|
AcGePoint3d ptCen;
|
|
AcGePoint3d ptOff(0, 0, 0);
|
|
m_mapSpecXData.GetAt(KEY_SECCEN, ptCen);
|
|
m_mapSpecXData.GetAt(KEY_XE, ptOff.x);
|
|
m_mapSpecXData.GetAt(KEY_YE, ptOff.y);
|
|
|
|
pRegCln = ((AcDbRegion *)m_pRegion->clone());
|
|
if (!pRegCln)
|
|
{
|
|
es = Acad::eInvalidInput;
|
|
break;
|
|
}
|
|
|
|
pCrvCln = ((AcDbCurve*)m_pBaseCurve->clone());
|
|
if (!pCrvCln)
|
|
{
|
|
es = Acad::eInvalidInput;
|
|
break;
|
|
}
|
|
|
|
AcDbExtents ext;
|
|
|
|
// 此时,截面尚处于水平
|
|
pRegCln->getGeomExtents(ext);
|
|
double dHalfH = (ext.maxPoint().y - ext.minPoint().y) * .5;
|
|
|
|
AcGeMatrix3d mat;
|
|
|
|
// 根据偏移量、旋转量来调整一下截面
|
|
// 不用调整了,好像在外面已经调整好了
|
|
//mat.setToTranslation(ptOff.asVector().negate());
|
|
//pRegCln->transformBy(mat);
|
|
//double dAngle = 0.0;
|
|
//if (m_mapSpecXData.GetAt(KEY_ROTATION, dAngle))
|
|
//{
|
|
// mat.setToRotation(dAngle, AcGeVector3d::kZAxis);
|
|
// pRegCln->transformBy(mat);
|
|
//}
|
|
|
|
ColumnParam data;
|
|
::memset(&data, 0, sizeof(ColumnParam));
|
|
GetBeamData(data);
|
|
|
|
// 还原 baseCurve 的标高,既是梁上表面的标高
|
|
AcGePoint3d ptStart, ptEnd;
|
|
pCrvCln->getStartPoint(ptStart);
|
|
mat.setToTranslation(AcGeVector3d::kZAxis * (data.m_dBomEl - ptStart.z));
|
|
pCrvCln->transformBy(mat);
|
|
pCrvCln->getStartPoint(ptStart);
|
|
pCrvCln->getEndPoint(ptEnd);
|
|
|
|
AcGeVector3d vecDir(ptEnd - ptStart);
|
|
AcGeVector3d vtAxis = AcGeVector3d::kZAxis.crossProduct(vecDir);
|
|
AcGeVector3d vtMove(vecDir);
|
|
vtMove.rotateBy(PI * .5, vtAxis).normalize();
|
|
|
|
// 先翻转截面到路径起点上
|
|
GiDrawUtility::transfromRegion(pRegCln, ptCen, -vecDir, ptStart);
|
|
|
|
// 再微调一下截面,保证拉伸体的最高点最低点复合要求
|
|
// 沿着vtMove移动半个截面高度
|
|
mat.setToTranslation(vtMove * dHalfH);
|
|
pRegCln->transformBy(mat);
|
|
|
|
double dLen(.0);
|
|
es = pCrvCln->getEndPoint(ptEnd);
|
|
if (es != Acad::eOk) break;
|
|
es = pCrvCln->getDistAtPoint(ptEnd, dLen);
|
|
if (es != Acad::eOk) break;
|
|
|
|
AcDb3dSolid *pSolid = new AcDb3dSolid();
|
|
es = pSolid->extrude(pRegCln, -dLen);
|
|
if (es != Acad::eOk)
|
|
{
|
|
DELETE_PTR(pSolid);
|
|
break;
|
|
}
|
|
|
|
dc.DrawEntity(*pSolid);
|
|
Add3DBuffer(pSolid);
|
|
|
|
DELETE_PTR(pRegCln);
|
|
DELETE_PTR(pCrvCln);
|
|
|
|
es = Acad::eOk;
|
|
|
|
} while (false);
|
|
|
|
if (es != Acad::eOk)
|
|
{
|
|
DELETE_PTR(pRegCln);
|
|
DELETE_PTR(pCrvCln);
|
|
}
|
|
return es;
|
|
}
|
|
|
|
int AecDbBeam::GetCreatPipe3dSolid(AcDbVoidPtrArray &ar3DSolidPtrs) const
|
|
{
|
|
return GetDraw3dables(ar3DSolidPtrs, false);
|
|
if (Get3DBuffer().length() > 0)
|
|
{
|
|
return GetDraw3dables(ar3DSolidPtrs, false);
|
|
}
|
|
|
|
AcGePoint3d ptCen;
|
|
AcGePoint3d ptOff(0,0,0);
|
|
m_mapSpecXData.GetAt(KEY_SECCEN, ptCen);
|
|
m_mapSpecXData.GetAt(KEY_XE, ptOff.x);
|
|
m_mapSpecXData.GetAt(KEY_YE, ptOff.y);
|
|
|
|
AcGeVector3d vtOff = ptOff.asVector();
|
|
vtOff.negate();
|
|
|
|
AcGeMatrix3d xOff;
|
|
xOff.setToTranslation(vtOff);
|
|
|
|
//region水平投影放置为准
|
|
double dW = 0.0, dUW = 0.0, dDW = 0.0;
|
|
AcDbExtents ext;
|
|
m_pRegion->getGeomExtents(ext);
|
|
|
|
dW = ext.maxPoint().x - ext.minPoint().x;
|
|
|
|
//dUW 原点到最小点的距离 正
|
|
//dDW 原点到最大点的距离 负
|
|
//正负按照AcDbCurve::getOffsetCurves(dOff 要求
|
|
|
|
dUW = -ext.minPoint().x;
|
|
dDW = -ext.maxPoint().x;
|
|
|
|
int nShape = 0;
|
|
m_mapSpecXData.GetAt(KEY_SHAPE, nShape);
|
|
if (dUW > dDW && nShape == 4)//槽钢 梁 左对齐表达画法
|
|
{
|
|
dDW = ext.minPoint().x;
|
|
dUW = ext.maxPoint().x;
|
|
dDW += 0.5 * dW;
|
|
dUW += 0.5 * dW;
|
|
}
|
|
|
|
AcDbVoidPtrArray arCenCur;
|
|
|
|
double dCen = (dUW + dDW) / 2.0;
|
|
m_pBaseCurve->getOffsetCurves(dCen, arCenCur);
|
|
|
|
AcDbCurve *pPath = m_pBaseCurve;
|
|
if (arCenCur.length() == 1 )
|
|
{
|
|
pPath = (AcDbCurve *)arCenCur.first();
|
|
}
|
|
|
|
AcDbRegion *pRegnCln = (AcDbRegion *)m_pRegion->clone();
|
|
pRegnCln->transformBy(xOff);
|
|
|
|
double dAngle = 0.0;
|
|
if (m_mapSpecXData.GetAt(KEY_ROTATION, dAngle))
|
|
{
|
|
if (pRegnCln != NULL)
|
|
{
|
|
AcGeMatrix3d xformR;
|
|
xformR.setToRotation(dAngle, AcGeVector3d::kZAxis);
|
|
pRegnCln->transformBy(xformR);
|
|
}
|
|
}
|
|
|
|
// 由于path不是水平,为了保证拉伸体的最高点最低点复合要求,微调一下path
|
|
|
|
AcGiExplodeDraw dc(ar3DSolidPtrs);
|
|
dc.DrawPipe(pPath, pRegnCln, ptCen);
|
|
|
|
if (pPath != m_pBaseCurve)
|
|
{
|
|
delete pPath;
|
|
//pPath->setColorIndex(6);
|
|
//CoreTools::AddToModelSpace(pPath);
|
|
}
|
|
|
|
//如果是旋转的REGION,则删除临时
|
|
if (pRegnCln != m_pRegion)
|
|
{
|
|
delete pRegnCln;
|
|
}
|
|
return ar3DSolidPtrs.length();
|
|
}
|
|
|
|
void AecDbBeam::subList() const
|
|
{
|
|
assertReadEnabled();
|
|
AecDbBDPipeBase::subList();
|
|
acutPrintf(_T("\n梁:"));
|
|
acutPrintf(_T("\n体积:%g 立方"),GetVolume() / 1.e9);
|
|
}
|
|
|
|
bool AecDbBeam::GetBimInfoTip(CString& sInfoTip) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
ColumnParam data;
|
|
memset(&data,0,sizeof(ColumnParam));
|
|
|
|
GetBeamData(data);
|
|
CString sField,sFmt;
|
|
|
|
//矩形;圆形;正六边形;工字钢柱;槽钢柱;
|
|
switch(data.m_nShape)
|
|
{
|
|
case 0://矩形
|
|
{
|
|
sField = _T("矩形梁:\n");
|
|
sInfoTip += sField;
|
|
|
|
MAKEFIELD(_T("长度"),_T("%.1f 毫米"),GetLength(),sInfoTip);
|
|
|
|
MAKEFIELD(_T("横向"),_T("%.1f 毫米"),data.m_dSizes[0],sInfoTip);
|
|
MAKEFIELD(_T("纵向"),_T("%.1f 毫米"),data.m_dSizes[1],sInfoTip);
|
|
|
|
MAKEFIELD(_T("底标高"),_T("%.1f 毫米"),data.m_dBomEl,sInfoTip);
|
|
|
|
MAKEFIELD(_T("旋转角度"),_T("%.1f 度"),data.m_dRotAngle,sInfoTip);
|
|
|
|
MAKEFIELD(_T("体积"),_T("%.1f 立方米"),GetVolume() / 1.e9,sInfoTip);
|
|
MAKEFIELD(_T("面积"),_T("%.1f 平方米"),GetArea() / 1.e6,sInfoTip);
|
|
|
|
MAKEFIELD(_T("材质"),_T("%s"),data.m_sMaterial,sInfoTip);
|
|
|
|
MAKEFIELD(_T("编号"),_T("%s"),data.m_szNo,sInfoTip);
|
|
|
|
break;
|
|
}
|
|
case 1://圆形
|
|
{
|
|
sField = _T("圆形梁:\n");
|
|
sInfoTip += sField;
|
|
|
|
MAKEFIELD(_T("长度"),_T("%.1f 毫米"),GetLength(),sInfoTip);
|
|
|
|
MAKEFIELD(_T("直径"),_T("%.1f 毫米"),data.m_dSizes[0],sInfoTip);
|
|
|
|
MAKEFIELD(_T("底标高"),_T("%.1f 毫米"),data.m_dBomEl,sInfoTip);
|
|
|
|
MAKEFIELD(_T("体积"),_T("%.1f 立方米"),GetVolume() / 1.e9,sInfoTip);
|
|
MAKEFIELD(_T("面积"),_T("%.1f 平方米"),GetArea() / 1.e6,sInfoTip);
|
|
|
|
MAKEFIELD(_T("材质"),_T("%s"),data.m_sMaterial,sInfoTip);
|
|
|
|
MAKEFIELD(_T("编号"),_T("%s"),data.m_szNo,sInfoTip);
|
|
|
|
break;
|
|
}
|
|
case 2:
|
|
{
|
|
sField = _T("正六边形梁:\n");
|
|
sInfoTip += sField;
|
|
|
|
MAKEFIELD(_T("长度"),_T("%.1f 毫米"),GetLength(),sInfoTip);
|
|
|
|
MAKEFIELD(_T("边长"),_T("%.1f 毫米"),data.m_dSizes[0],sInfoTip);
|
|
|
|
MAKEFIELD(_T("底标高"),_T("%.1f 毫米"),data.m_dBomEl,sInfoTip);
|
|
|
|
MAKEFIELD(_T("体积"),_T("%.1f 立方米"),GetVolume() / 1.e9,sInfoTip);
|
|
MAKEFIELD(_T("面积"),_T("%.1f 平方米"),GetArea() / 1.e6,sInfoTip);
|
|
|
|
MAKEFIELD(_T("材质"),_T("%s"),data.m_sMaterial,sInfoTip);
|
|
|
|
MAKEFIELD(_T("编号"),_T("%s"),data.m_szNo,sInfoTip);
|
|
|
|
break;
|
|
}
|
|
case 3:
|
|
{
|
|
sField = _T("工字钢梁:\n");
|
|
sInfoTip += sField;
|
|
|
|
MAKEFIELD(_T("长度"),_T("%.1f 毫米"),GetLength(),sInfoTip);
|
|
|
|
MAKEFIELD(_T("A"),_T("%.1f 毫米"),data.m_dSizes[0],sInfoTip);
|
|
MAKEFIELD(_T("B"),_T("%.1f 毫米"),data.m_dSizes[1],sInfoTip);
|
|
MAKEFIELD(_T("C"),_T("%.1f 毫米"),data.m_dSizes[2],sInfoTip);
|
|
MAKEFIELD(_T("D"),_T("%.1f 毫米"),data.m_dSizes[3],sInfoTip);
|
|
|
|
MAKEFIELD(_T("底标高"),_T("%.1f 毫米"),data.m_dBomEl,sInfoTip);
|
|
|
|
MAKEFIELD(_T("体积"),_T("%.1f 立方米"),GetVolume() / 1.e9,sInfoTip);
|
|
MAKEFIELD(_T("面积"),_T("%.1f 平方米"),GetArea() / 1.e6,sInfoTip);
|
|
|
|
MAKEFIELD(_T("材质"),_T("%s"),data.m_sMaterial,sInfoTip);
|
|
|
|
MAKEFIELD(_T("编号"),_T("%s"),data.m_szNo,sInfoTip);
|
|
|
|
break;
|
|
}
|
|
case 4:
|
|
{
|
|
sField = _T("槽钢梁:\n");
|
|
sInfoTip += sField;
|
|
|
|
MAKEFIELD(_T("长度"),_T("%.1f 毫米"),GetLength(),sInfoTip);
|
|
|
|
MAKEFIELD(_T("A"),_T("%.1f 毫米"),data.m_dSizes[0],sInfoTip);
|
|
MAKEFIELD(_T("B"),_T("%.1f 毫米"),data.m_dSizes[1],sInfoTip);
|
|
MAKEFIELD(_T("C"),_T("%.1f 毫米"),data.m_dSizes[2],sInfoTip);
|
|
MAKEFIELD(_T("D"),_T("%.1f 毫米"),data.m_dSizes[3],sInfoTip);
|
|
|
|
MAKEFIELD(_T("底标高"),_T("%.1f 毫米"),data.m_dBomEl,sInfoTip);
|
|
|
|
MAKEFIELD(_T("体积"),_T("%.1f 立方米"),GetVolume() / 1.e9,sInfoTip);
|
|
MAKEFIELD(_T("面积"),_T("%.1f 平方米"),GetArea() / 1.e6,sInfoTip);
|
|
|
|
MAKEFIELD(_T("材质"),_T("%s"),data.m_sMaterial,sInfoTip);
|
|
|
|
MAKEFIELD(_T("编号"),_T("%s"),data.m_szNo,sInfoTip);
|
|
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::dwgInFields (AcDbDwgFiler* pFiler)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
//----- Read parent class information first.
|
|
Acad::ErrorStatus es = AecDbBDPipeBase::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 > AecDbBeam::kCurrentVersionNumber )
|
|
return (Acad::eMakeMeProxy);
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::dwgOutFields(AcDbDwgFiler* pFiler) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//----- Save parent class information first.
|
|
Acad::ErrorStatus es = AecDbBDPipeBase::dwgOutFields (pFiler) ;
|
|
if ( es != Acad::eOk )
|
|
return (es) ;
|
|
|
|
//----- Object version number needs to be saved first
|
|
if ( (es =pFiler->writeUInt32 (AecDbBeam::kCurrentVersionNumber)) != Acad::eOk )
|
|
return (es) ;
|
|
|
|
return pFiler->filerStatus();
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::dxfInFields (AcDbDxfFiler* pFiler)
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::dxfOutFields(AcDbDxfFiler* pFiler) const
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::subGetGripPoints(AcDbGripDataPtrArray& grips,
|
|
const double curViewUnitSize,
|
|
const int gripSize,
|
|
const AcGeVector3d& curViewDir,
|
|
const int bitflags) const
|
|
{
|
|
assertReadEnabled();
|
|
//4个夹点
|
|
//起点 中点 终点 改标高点
|
|
|
|
AcGePoint3dArray gripPoints;
|
|
ImpGetGripPoints(gripPoints,bitflags);
|
|
|
|
int nColor = kWhite;
|
|
AcDbGripData* pGripData = NULL;
|
|
if ( bitflags >= 1394)//节点
|
|
{
|
|
memset(&m_pGripAppData[0],0,sizeof(AecGripData));
|
|
m_pGripAppData[0].nIndex = 0;
|
|
m_pGripAppData[0].ePos = eFlag;
|
|
m_pGripAppData[0].nColor = nColor;
|
|
m_pGripAppData[0].ptGrip = gripPoints.at(0);
|
|
m_pGripAppData[0].pOwner = (AcDbEntity*)this;
|
|
|
|
pGripData = new AcDbGripData;
|
|
pGripData->setGripPoint(gripPoints.at(0));
|
|
pGripData->setAppData((void*)&m_pGripAppData[0]);
|
|
pGripData->setWorldDraw(AecGripCback::WorldDrawfunc);
|
|
pGripData->setToolTipFunc(AecGripCback::GripToolTipFunc);
|
|
_tcscpy(m_pGripAppData[0].szTip,_T("点击定位造族<梁>记录"));
|
|
_tcscpy(m_pGripAppData[0].szID,m_sGUID);
|
|
grips.append(pGripData);
|
|
return Acad::eOk;
|
|
}
|
|
else
|
|
{
|
|
EPosition ePos;
|
|
CString sTip;
|
|
for (int i = 0;i < gripPoints.length();i++)
|
|
{
|
|
ePos = ExplainGripIndex(i,sTip);
|
|
memset(&m_pGripAppData[i],0,sizeof(AecGripData));
|
|
m_pGripAppData[i].nIndex = i;
|
|
m_pGripAppData[i].ePos = ePos;
|
|
m_pGripAppData[i].nColor = kBlue;
|
|
m_pGripAppData[i].ptGrip = gripPoints.at(i);
|
|
_tcscpy(m_pGripAppData[i].szTip,sTip);
|
|
_tcscpy(m_pGripAppData[i].szID,m_sGUID);
|
|
m_pGripAppData[i].pOwner = (AcDbEntity*)this;
|
|
|
|
pGripData = new AcDbGripData;
|
|
pGripData->setGripPoint(gripPoints.at(i));
|
|
pGripData->setAppData((void*)&m_pGripAppData[i]);
|
|
pGripData->setWorldDraw(AecGripCback::WorldDrawfunc);
|
|
pGripData->setToolTipFunc(AecGripCback::GripToolTipFunc);
|
|
grips.append(pGripData);
|
|
}
|
|
}
|
|
|
|
//调用基类加入单击修改
|
|
SubAddHitEditGrip(grips);
|
|
|
|
//动态标注
|
|
//直线,半径 标注风格
|
|
if (!grips.isEmpty())
|
|
{
|
|
SubAddDimPoints(grips,curViewDir);
|
|
}
|
|
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::subGetStretchPoints(AcGePoint3dArray& stretchPoints) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
if (m_pBaseCurve != NULL)
|
|
{
|
|
extern BOOL IsFrontView();
|
|
if (IsFrontView())
|
|
{
|
|
AcGePoint3d ptM;
|
|
double dS = 0.0,dE = 0.0;
|
|
|
|
ColumnParam data;
|
|
GetBeamData(data);
|
|
|
|
m_pBaseCurve->getStartParam(dS);
|
|
m_pBaseCurve->getEndParam(dE);
|
|
m_pBaseCurve->getPointAtParam((dS + dE) / 2.0,ptM);
|
|
|
|
stretchPoints.append(ptM);
|
|
|
|
ptM.z += data.m_dSizes[1];
|
|
stretchPoints.append(ptM);
|
|
}
|
|
else
|
|
{
|
|
return AecDbEwPipeBase::subGetStretchPoints(stretchPoints);
|
|
}
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::subMoveStretchPointsAt(const AcDbIntArray& indices,const AcGeVector3d& offset)
|
|
{
|
|
extern BOOL IsFrontView();
|
|
if (IsFrontView())
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
if (!indices.isEmpty())
|
|
{
|
|
AcGeVector3d vtZ;
|
|
vtZ = offset.orthoProject(AcGeVector3d::kYAxis);
|
|
|
|
AcGeMatrix3d xMove;
|
|
xMove.setToTranslation(vtZ);
|
|
|
|
m_pBaseCurve->transformBy(xMove);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
return AecDbEwPipeBase::subMoveStretchPointsAt(indices,offset);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::SubAddDimPoints(AcDbGripDataPtrArray& grips,const AcGeVector3d& curViewDir) const
|
|
{
|
|
if (GetDimGripOff())
|
|
return Acad::eOk;
|
|
|
|
//柱子素线统一为直线段
|
|
AcDbRegion* pRegion = GetSection();
|
|
if (pRegion != NULL)
|
|
{
|
|
AcDbLine* pLn = AcDbLine::cast(m_pBaseCurve);
|
|
if (pLn != NULL)
|
|
{
|
|
AcGePoint3d ptSta = pLn->startPoint();
|
|
AcGePoint3d ptEnd = pLn->endPoint();
|
|
AcGePoint3d ptMid,ptPos = ptSta;
|
|
AcGeVector3d vtZ = ptEnd - ptSta;
|
|
transfromRegion(pRegion,AcGePoint3d::kOrigin,vtZ,ptSta);
|
|
|
|
AcGeVector3d vtV = vtZ;
|
|
vtV.rotateBy(PI / 2.0,AcGeVector3d::kZAxis);
|
|
|
|
ptMid = MidPoint(ptSta,ptEnd);
|
|
vtZ = ptMid - ptPos;
|
|
vtZ.normalize();
|
|
|
|
vtV.normalize();
|
|
vtV *= 10.0 * 100;
|
|
ptMid += vtV;
|
|
|
|
AddDimPoints(grips,curViewDir,ptSta,ptEnd,ptMid,0);
|
|
|
|
AcDbVoidPtrArray arPtrs;
|
|
pRegion->explode(arPtrs);
|
|
|
|
AcDbEntity* pEnt = NULL;
|
|
for (int i = 0;i < arPtrs.length();i++)
|
|
{
|
|
pEnt = (AcDbEntity*)arPtrs.at(i);
|
|
if (pEnt != NULL)
|
|
{
|
|
AcDbLine* pLnT = AcDbLine::cast(pEnt);
|
|
if (pLnT != NULL)
|
|
{
|
|
vtV.normalize();
|
|
ptSta = pLnT->startPoint() + vtV * 1;
|
|
ptEnd = pLnT->endPoint() + vtV * 1;
|
|
ptMid = MidPoint(ptSta,ptEnd);
|
|
vtZ = ptMid - ptPos;
|
|
vtZ.normalize();
|
|
vtZ *= 10.0 * 100;
|
|
ptMid += vtZ;
|
|
AddDimPoints(grips,curViewDir,ptSta,ptEnd,ptMid,0);
|
|
}
|
|
|
|
AcDbArc* pArc = AcDbArc::cast(pEnt);
|
|
if (pArc != NULL)
|
|
{
|
|
pArc->getStartPoint(ptSta);
|
|
|
|
AcGeVector3d vtL;
|
|
pArc->getFirstDeriv(ptSta,vtL);
|
|
vtL.normalize();
|
|
vtL.negate();
|
|
|
|
//半径标注
|
|
ptEnd = pArc->center();
|
|
AcGePoint3d ptAMid = GetArcMidPoint(pArc);
|
|
ptMid = MidPoint(ptAMid,ptEnd);
|
|
AddDimPoints(grips,curViewDir,ptAMid,ptEnd,ptMid,1,pArc->radius());
|
|
|
|
//角度
|
|
pArc->getStartPoint(ptSta);
|
|
pArc->getEndPoint(ptEnd);
|
|
ptMid = pArc->center();
|
|
double dAngle = pArc->endAngle() - pArc->startAngle();
|
|
AddDimPoints(grips,curViewDir,ptSta,ptEnd,ptMid,3);
|
|
}
|
|
|
|
AcDbCircle* pCir = AcDbCircle::cast(pEnt);
|
|
if (pCir != NULL)
|
|
{
|
|
pCir->getStartPoint(ptSta);
|
|
|
|
AcGeVector3d vtL;
|
|
pCir->getFirstDeriv(ptSta,vtL);
|
|
vtL.normalize();
|
|
vtL.negate();
|
|
|
|
//半径标注
|
|
ptEnd = pCir->center();
|
|
ptMid = MidPoint(ptSta,ptEnd);
|
|
AddDimPoints(grips,curViewDir,ptSta,ptEnd,ptMid,1,pCir->radius());
|
|
}
|
|
|
|
delete pEnt;
|
|
}
|
|
}
|
|
}
|
|
delete pRegion;
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::subMoveGripPointsAt(const AcDbVoidPtrArray& gripAppData, const AcGeVector3d& offset, const int bitflags)
|
|
{
|
|
AssertWriteEnabled();
|
|
|
|
AecGripData* pAppData = NULL;
|
|
if ( gripAppData.isEmpty() )
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
if (HitOnGripEdit(gripAppData))
|
|
{
|
|
return Acad::eOk;
|
|
}
|
|
|
|
pAppData = (AecGripData*)gripAppData.first();
|
|
|
|
AcGeVector3d vtOffset = offset;
|
|
|
|
AcGeVector3d vtXYOffset;
|
|
vtXYOffset = vtOffset.orthoProject(AcGeVector3d::kZAxis);
|
|
|
|
AcGeVector3d vtZOffset;
|
|
vtZOffset = vtOffset.orthoProject(AcGeVector3d::kXAxis);
|
|
|
|
double dLen = offset.length();
|
|
|
|
AcDbLine* pLn = AcDbLine::cast(m_pBaseCurve);
|
|
AcDbArc* pArc = AcDbArc::cast(m_pBaseCurve);
|
|
AcDbCurve* pCurve = m_pBaseCurve;
|
|
if (pCurve == NULL)
|
|
return Acad::eOk;
|
|
|
|
AcGePoint3d ptGeT,ptSta,ptEnd,ptMid;
|
|
double dSta = 0.0,dEnd = 0.0,dMid = 0.0;
|
|
AcGeMatrix3d xform;
|
|
|
|
switch(pAppData->nIndex)
|
|
{
|
|
case 0://sta
|
|
{
|
|
if (pLn != NULL)
|
|
{
|
|
ptSta = pLn->startPoint();
|
|
ptSta += vtXYOffset;
|
|
pLn->setStartPoint(ptSta);
|
|
}
|
|
|
|
if (pArc != NULL)
|
|
{
|
|
pArc->getStartPoint(ptSta);
|
|
ptSta += vtXYOffset;
|
|
|
|
pCurve->getStartParam(dSta);
|
|
pCurve->getEndParam(dEnd);
|
|
|
|
dMid = (dSta + dEnd) / 2.0;
|
|
pCurve->getPointAtParam(dMid,ptMid);
|
|
|
|
pArc->getEndPoint(ptEnd);
|
|
|
|
AcDbArc* pArc2 = FormatArc(ptSta,ptMid,ptEnd);
|
|
if (pArc2 != NULL)
|
|
{
|
|
pArc->setRadius(pArc2->radius());
|
|
pArc->setCenter(pArc2->center());
|
|
pArc->setStartAngle(pArc2->startAngle());
|
|
pArc->setEndAngle(pArc2->endAngle());
|
|
delete pArc2;
|
|
}
|
|
}
|
|
|
|
break;
|
|
}
|
|
case 1://mid
|
|
{
|
|
xform.setToTranslation(vtXYOffset);
|
|
m_pBaseCurve->transformBy(xform);
|
|
|
|
break;
|
|
}
|
|
case 2://end
|
|
{
|
|
if (pLn != NULL)
|
|
{
|
|
ptEnd = pLn->endPoint();
|
|
ptEnd += vtXYOffset;
|
|
pLn->setEndPoint(ptEnd);
|
|
}
|
|
|
|
if (pArc != NULL)
|
|
{
|
|
pArc->getStartPoint(ptSta);
|
|
|
|
pCurve->getStartParam(dSta);
|
|
pCurve->getEndParam(dEnd);
|
|
|
|
dMid = (dSta + dEnd) / 2.0;
|
|
pCurve->getPointAtParam(dMid,ptMid);
|
|
|
|
pArc->getEndPoint(ptEnd);
|
|
ptEnd += vtXYOffset;
|
|
|
|
AcDbArc* pArc2 = FormatArc(ptSta,ptMid,ptEnd);
|
|
if (pArc2 != NULL)
|
|
{
|
|
pArc->setRadius(pArc2->radius());
|
|
pArc->setCenter(pArc2->center());
|
|
pArc->setStartAngle(pArc2->startAngle());
|
|
pArc->setEndAngle(pArc2->endAngle());
|
|
delete pArc2;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
case 3://el
|
|
{
|
|
xform.setToTranslation(vtZOffset);
|
|
m_pBaseCurve->transformBy(xform);
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
Acad::ErrorStatus AecDbBeam::ImpGetGripPoints(AcGePoint3dArray& gripPoints,const int bitflags) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
//4个夹点
|
|
//起点 中点 终点 改标高点
|
|
AcDbCurve* pCurve = m_pBaseCurve;
|
|
if (pCurve != NULL)
|
|
{
|
|
AcGePoint3d ptSta,ptEnd,ptMid,ptGeT;
|
|
|
|
pCurve->getStartPoint(ptSta);
|
|
pCurve->getEndPoint(ptEnd);
|
|
|
|
double dSta = 0.0,dEnd = 0.0;
|
|
pCurve->getStartParam(dSta);
|
|
pCurve->getEndParam(dEnd);
|
|
|
|
double dMid = (dSta + dEnd) / 2.0;
|
|
pCurve->getPointAtParam(dMid,ptMid);
|
|
|
|
double dCmd = PixelToWcs(10);
|
|
|
|
//1 起点
|
|
gripPoints.append(ptSta);
|
|
|
|
//2 中点
|
|
gripPoints.append(ptMid);
|
|
|
|
//2 终点
|
|
gripPoints.append(ptEnd);
|
|
|
|
//3 下 改标高
|
|
ptGeT = ptMid - dCmd * AcGeVector3d::kZAxis;
|
|
gripPoints.append(ptGeT);
|
|
}
|
|
return Acad::eOk;
|
|
}
|
|
|
|
EPosition AecDbBeam::ExplainGripIndex(int nIndex,CString& sTip) const
|
|
{
|
|
EPosition ePos = eStart;
|
|
switch(nIndex)
|
|
{
|
|
case 0:
|
|
{
|
|
ePos = eStart;
|
|
sTip = _T("修改起点夹点");
|
|
break;
|
|
}
|
|
case 1:
|
|
{
|
|
ePos = eMid;
|
|
sTip = _T("修改中点夹点");
|
|
break;
|
|
}
|
|
case 2:
|
|
{
|
|
ePos = eEnd;
|
|
sTip = _T("修改终点夹点");
|
|
break;
|
|
}
|
|
case 3:
|
|
{
|
|
ePos = eAdjust0;
|
|
sTip = _T("修改标高夹点");
|
|
break;
|
|
}
|
|
default:
|
|
break;
|
|
}
|
|
return ePos;
|
|
}
|
|
|
|
int AecDbBeam::ComparedTo(AecDbCurveBase* pCurOther) const
|
|
{
|
|
assertReadEnabled();
|
|
|
|
AecDbBeam* pBean2 = AecDbBeam::cast(pCurOther);
|
|
if (pBean2 != NULL)
|
|
{
|
|
ColumnParam data1;
|
|
GetBeamData(data1);
|
|
|
|
ColumnParam data2;
|
|
pBean2->GetBeamData(data2);
|
|
|
|
if (fabs(data1.m_dH - data2.m_dH) > 1.e-1)
|
|
return 1;
|
|
|
|
if (fabs(data1.m_dBomEl - data2.m_dBomEl) > 1.e-1)
|
|
return 1;
|
|
|
|
if (fabs(data1.m_dSizes[0] - data2.m_dSizes[0]) > 1.e-1)
|
|
return 1;
|
|
|
|
if (fabs(data1.m_dSizes[1] - data2.m_dSizes[1]) > 1.e-1)
|
|
return 1;
|
|
|
|
if (data1.m_nShape != data2.m_nShape)
|
|
return 1;
|
|
|
|
AcGePoint3d ptSta,ptEnd;
|
|
getStartPoint(ptSta);
|
|
getEndPoint(ptEnd);
|
|
|
|
AcGePoint3d ptSta2,ptEnd2;
|
|
pBean2->getStartPoint(ptSta2);
|
|
pBean2->getEndPoint(ptEnd2);
|
|
|
|
if (ptSta.distanceTo(ptSta2) > 2.0)//误差2毫米
|
|
return 1;
|
|
|
|
if (ptEnd.distanceTo(ptEnd2) > 2.0)//误差2毫米
|
|
return 1;
|
|
|
|
//如果体积不同 体积较大不考虑比较
|
|
//double dVol1 = GetVolume();
|
|
//double dVol2 = pBean2->GetVolume();
|
|
|
|
//if ( fabs(dVol1 - dVol2) > 1.0)
|
|
// return 1;
|
|
|
|
return 0;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
SHJson::WValue& AecDbBeam::ToJson(bool bExprotGeo) const
|
|
{
|
|
assertReadEnabled();
|
|
return AecDbBDPipeBase::ToJson(bExprotGeo);
|
|
}
|
|
|
|
bool AecDbBeam::ByJson(const SHJson::WValue &v)
|
|
{
|
|
AssertWriteEnabled();
|
|
return AecDbBDPipeBase::ByJson(v);
|
|
}
|
|
|
|
#include "hlrcutoption.h"
|
|
void AecDbBeam::ProcessHlrResult(const AcArray<AcDbEntity *> &ar
|
|
, const std::map<AcDbEntity *, AcArray<AcDbEntity *>> &preAr
|
|
, AcArray<AcDbEntity *> &output) const
|
|
{
|
|
double dW(.0);
|
|
BOOL bBold = HlrCutOption::getEnvCutLW(this, dW);
|
|
|
|
HlrCutOption::ProcessHlrResult(this
|
|
, bBold
|
|
, dW
|
|
, FALSE
|
|
, ar
|
|
, preAr
|
|
, output);
|
|
}
|
|
|
|
void AecDbBeam::PreprocessForHlr(const AcGePoint3d &ptPlnO
|
|
, const AcGeVector3d &vtPlnN
|
|
, AcArray<AcDbEntity*> &ar) const
|
|
{
|
|
// 如果实体和剖面相交,标记
|
|
HlrCutOption::setIntersectWithSection(this, AcGePlane(ptPlnO, vtPlnN));
|
|
}
|
|
|
|
bool AecDbBeam::GetProperties(SimpleProperty::PropertySetByIndex & properties) const
|
|
{
|
|
// 假设基类调用,如果不需要可以注释掉
|
|
AecDbBDPipeBase::GetProperties(properties);
|
|
CoreTools::setLayerPorperty(properties);
|
|
CoreTools::setSubSystemPorperty(properties);
|
|
|
|
ColumnParam data;
|
|
::memset(&data, 0, sizeof(ColumnParam));
|
|
|
|
// 注意:对话框中SetFromCol调用的是 GetBeamData,这里保持一致
|
|
GetBeamData(data);
|
|
|
|
CString sShape(_T("无"));
|
|
|
|
switch (data.m_nShape)
|
|
{
|
|
case 0: // 矩形
|
|
SimpleProperty::makeAndInsert(properties, _T("形状"), _T("矩形"), false);
|
|
SimpleProperty::makeAndInsert(properties, _T("横向尺寸"), data.m_dXScale, true);
|
|
SimpleProperty::makeAndInsert(properties, _T("纵向尺寸"), data.m_dYScale, true);
|
|
break;
|
|
case 1: // 圆形
|
|
SimpleProperty::makeAndInsert(properties, _T("形状"), _T("圆形"), false);
|
|
SimpleProperty::makeAndInsert(properties, _T("直径"), data.m_dXScale, true);
|
|
break;
|
|
case 2: // 正六边形
|
|
SimpleProperty::makeAndInsert(properties, _T("形状"), _T("正六边形"), false);
|
|
SimpleProperty::makeAndInsert(properties, _T("边长"), data.m_dXScale, true);
|
|
break;
|
|
case 3: // 工字钢
|
|
SimpleProperty::makeAndInsert(properties, _T("形状"), _T("工字钢梁"), false);
|
|
SimpleProperty::makeAndInsert(properties, _T("型号"), data.m_sModel, false);
|
|
SimpleProperty::makeAndInsert(properties, _T("A"), data.m_dSizes[0], true);
|
|
SimpleProperty::makeAndInsert(properties, _T("B"), data.m_dSizes[1], true);
|
|
SimpleProperty::makeAndInsert(properties, _T("C"), data.m_dSizes[2], true);
|
|
SimpleProperty::makeAndInsert(properties, _T("D"), data.m_dSizes[3], true);
|
|
break;
|
|
case 4: // 槽钢
|
|
SimpleProperty::makeAndInsert(properties, _T("形状"), _T("槽钢梁"), false);
|
|
SimpleProperty::makeAndInsert(properties, _T("型号"), data.m_sModel, false);
|
|
SimpleProperty::makeAndInsert(properties, _T("A"), data.m_dSizes[0], true);
|
|
SimpleProperty::makeAndInsert(properties, _T("B"), data.m_dSizes[1], true);
|
|
SimpleProperty::makeAndInsert(properties, _T("C"), data.m_dSizes[2], true);
|
|
SimpleProperty::makeAndInsert(properties, _T("D"), data.m_dSizes[3], true);
|
|
break;
|
|
case 5: // 梯形 (新增逻辑)
|
|
SimpleProperty::makeAndInsert(properties, _T("形状"), _T("梯形"), false);
|
|
// 对应 CreateTrapezoidBlock 中的逻辑:dH=m_sA(Sizes[0]), dTW=dXScale, dtw=dYScale
|
|
SimpleProperty::makeAndInsert(properties, _T("高度"), data.m_dSizes[0], true);
|
|
SimpleProperty::makeAndInsert(properties, _T("顶宽"), data.m_dXScale, true);
|
|
SimpleProperty::makeAndInsert(properties, _T("底宽"), data.m_dYScale, true);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
// 通用属性
|
|
// 对话框中 IDC_EDIT1 对应 m_dTopEl (GetColumnParam中赋值给 m_dBomEl)
|
|
SimpleProperty::makeAndInsert(properties, _T("起点顶标高"), data.m_dBomEl, true);
|
|
SimpleProperty::makeAndInsert(properties, _T("终点顶标高"), data.m_dEndEl, true);
|
|
SimpleProperty::makeAndInsert(properties, _T("材质"), data.m_sMaterial, true);
|
|
|
|
// 偏心设置 (梁对话框没有转角输入,且代码中强设为0,故不输出转角)
|
|
SimpleProperty::makeAndInsert(properties, _T("横轴偏心"), data.m_dXExtend, true);
|
|
//SimpleProperty::makeAndInsert(properties, _T("纵轴偏心"), data.m_dYExtend, true);
|
|
|
|
return true;
|
|
}
|
|
|
|
extern "C" AcDbRegion *GetColumnRegion(const ColumnParam &ColParam);
|
|
bool AecDbBeam::SetProperties(SimpleProperty::PropertySetByName & properties)
|
|
{
|
|
using namespace SimpleProperty;
|
|
if (properties.m_set.empty()) return false;
|
|
AecDbBDPipeBase::SetProperties(properties);
|
|
|
|
AecDbObjXDataMap *pData = &m_mapSpecXData;
|
|
properties.findAndSet<double>(_T("横向尺寸"), pData, KEY_XS);
|
|
properties.findAndSet<double>(_T("纵向尺寸"), pData, KEY_YS);
|
|
properties.findAndSet<double>(_T("直径"), pData, KEY_XS);
|
|
properties.findAndSet<double>(_T("边长"), pData, KEY_XS);
|
|
|
|
double dVal;
|
|
if (properties.findAndSet(_T("直径"), dVal))
|
|
{
|
|
pData->SetAt(KEY_XS, dVal);
|
|
pData->SetAt(KEY_YS, dVal);
|
|
}
|
|
if (properties.findAndSet(_T("边长"), dVal))
|
|
{
|
|
pData->SetAt(KEY_XS, dVal);
|
|
pData->SetAt(KEY_YS, dVal);
|
|
}
|
|
|
|
properties.findAndSet<double>(_T("A"), pData, KEY_SIZE1);
|
|
properties.findAndSet<double>(_T("B"), pData, KEY_SIZE2);
|
|
properties.findAndSet<double>(_T("C"), pData, KEY_SIZE3);
|
|
properties.findAndSet<double>(_T("D"), pData, KEY_SIZE4);
|
|
properties.findAndSet<double>(_T("高度"), pData, KEY_SIZE1);
|
|
properties.findAndSet<double>(_T("顶宽"), pData, KEY_XS);
|
|
properties.findAndSet<double>(_T("底宽"), pData, KEY_YS);
|
|
|
|
if (properties.findAndSet(_T("起点顶标高"), dVal))
|
|
SetTopEl(dVal);
|
|
if (properties.findAndSet(_T("终点顶标高"), dVal))
|
|
SetEndEl(dVal);
|
|
|
|
properties.findAndSet<CString>(_T("材质"), pData, KEY_MATERIAL);
|
|
properties.findAndSet<double>(_T("横轴偏心"), pData, KEY_XE);
|
|
//properties.findAndSet<double>(_T("纵轴偏心"), pData, KEY_YE);
|
|
|
|
|
|
ColumnParam ColParam;
|
|
GetBeamData(ColParam);
|
|
|
|
AcDbRegion *pRegAll = GetColumnRegion(ColParam);
|
|
if (pRegAll != NULL)
|
|
{
|
|
SetSection(pRegAll, AcGePoint3d::kOrigin);
|
|
DELETE_PTR(pRegAll);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
void AecDbBeam::SetElev(const double & d, const bool & bTopEl)
|
|
{
|
|
AssertWriteEnabled();
|
|
//AcDbRegion *pRegAll = (AcDbRegion*)m_pRegion->clone();
|
|
|
|
AcDbCurve *pCur = GetBaseCurve();
|
|
if (pCur != NULL)
|
|
{
|
|
AcDbLine *pLn = AcDbLine::cast(pCur);
|
|
if (pLn != NULL)
|
|
{
|
|
AcGePoint3d ptSta = pLn->startPoint();
|
|
AcGePoint3d ptEnd = pLn->endPoint();
|
|
|
|
if (bTopEl)
|
|
ptSta.z = d;
|
|
else
|
|
ptEnd.z = d;
|
|
|
|
//if (pRegAll != NULL)
|
|
//{
|
|
// AcDbExtents ext;
|
|
// pRegAll->getGeomExtents(ext);
|
|
// double dH = ext.maxPoint().y - ext.minPoint().y;
|
|
|
|
// if (bTopEl)
|
|
// ptSta.z -= 0.5 * dH;
|
|
// else
|
|
// ptEnd.z -= 0.5 * dH;
|
|
|
|
//}
|
|
|
|
pLn->setStartPoint(ptSta);
|
|
pLn->setEndPoint(ptEnd);
|
|
SetBaseCurve(ptSta, ptEnd);
|
|
}
|
|
DELETE_PTR(pCur);
|
|
}
|
|
|
|
//DELETE_PTR(pRegAll);
|
|
}
|
|
|
|
void AecDbBeam::SetEndEl(const double & d)
|
|
{
|
|
SetElev(d, false);
|
|
}
|
|
|
|
void AecDbBeam::SetTopEl(const double & d)
|
|
{
|
|
SetElev(d, true);
|
|
} |