4479 lines
98 KiB
C++
4479 lines
98 KiB
C++
#include "stdafx.h"
|
|
#include "ParamEquImpl.h"
|
|
#include "GiDrawUtility.h"
|
|
#include "CoreTools.h"
|
|
|
|
#define GETXDATA(key) bRel = m_pXDataMap->GetAt(_T(#key), key)
|
|
|
|
#define TESTXDATA(name)\
|
|
if (!bRel) \
|
|
{\
|
|
acutPrintf(\
|
|
_T("\n ")\
|
|
_T(#name)\
|
|
_T(" 获取数据失败!"));\
|
|
return;\
|
|
}
|
|
|
|
#pragma region GeShTools
|
|
namespace
|
|
{
|
|
|
|
AcDb3dSolid* makeSolid(AcDbRegion *pReg, const AcGeVector3d &vt)
|
|
{
|
|
AcDb3dSolid *pSolid(NULL);
|
|
if (pReg)
|
|
{
|
|
AcDbSweepOptions op;
|
|
pSolid = new AcDb3dSolid();
|
|
Acad::ErrorStatus es = pSolid->createExtrudedSolid(pReg, vt, op);
|
|
if (es != Acad::eOk)
|
|
DELETE_PTR(pSolid);
|
|
return pSolid;
|
|
}
|
|
return NULL;
|
|
}
|
|
|
|
AcDbRegion* makeRegion(const int count, va_list ap)
|
|
{
|
|
AcDbVoidPtrArray ar;
|
|
AcGePoint3dArray pts;
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
pts.append(va_arg(ap, AcGePoint3d));
|
|
}
|
|
if (pts.length() < 3) return NULL;
|
|
pts.append(pts[0]);
|
|
|
|
for (int i = 0; i < pts.length() - 1; ++i)
|
|
ar.append(new AcDbLine(pts[i], pts[i + 1]));
|
|
|
|
AcDbRegion *pReg = CoreTools::createRegion(ar);
|
|
deleteArrayVoidPtrs< AcDbEntity>(ar);
|
|
return pReg;
|
|
}
|
|
|
|
AcDbRegion* makeRegion2(const int count, ...)
|
|
{
|
|
va_list vlist;
|
|
va_start(vlist, count);
|
|
AcDbRegion *pReg = makeRegion(count, vlist);
|
|
va_end(vlist);
|
|
return pReg;
|
|
}
|
|
|
|
AcDb3dSolid* makeSolid(const AcGeVector3d &vt, const int count, ...)
|
|
{
|
|
AcDb3dSolid *pSolid(NULL);
|
|
va_list vlist;
|
|
va_start(vlist, count);
|
|
AcDbRegion *pReg(makeRegion(count, vlist));
|
|
va_end(vlist);
|
|
if (pReg)
|
|
{
|
|
pSolid = makeSolid(pReg, vt);
|
|
DELETE_PTR(pReg);
|
|
}
|
|
return pSolid;
|
|
}
|
|
|
|
// 给出中心点及长宽,得到一个矩形,左下角点开始,逆时针方向
|
|
void getRect(const AcGePoint3d &ptCenter
|
|
, const AcGeVector3d &vtX
|
|
, const double &L
|
|
, const double &W
|
|
, AcGePoint3d &pt0
|
|
, AcGePoint3d &pt1
|
|
, AcGePoint3d &pt2
|
|
, AcGePoint3d &pt3
|
|
, const AcGeVector3d &vtZ = AcGeVector3d::kZAxis )
|
|
{
|
|
AcGeVector3d Y(vtX), X(vtX);
|
|
Y.rotateBy(PI * .5, vtZ);
|
|
Y.normalize();
|
|
X.normalize();
|
|
|
|
pt0 = ptCenter - X * (L * .5);
|
|
pt0 -= Y * (W * .5);
|
|
pt1 = pt0 + X * L;
|
|
pt2 = pt1 + Y * W;
|
|
pt3 = pt2 - X * L;
|
|
}
|
|
|
|
AcDb3dSolid* drawExtruded(AcDbRegion *pReg, const AcGeVector3d &vt)
|
|
{
|
|
AcDb3dSolid *pSolid = new AcDb3dSolid();
|
|
AcDbSweepOptions op;
|
|
if (pSolid->createExtrudedSolid(pReg, vt, op) == Acad::eOk)
|
|
return pSolid;
|
|
else
|
|
DELETE_PTR(pSolid);
|
|
return pSolid;
|
|
}
|
|
|
|
AcDb3dSolid* drawCylinder(const AcGeVector3d &vt, const AcGePoint3d &pt, const double & r)
|
|
{
|
|
AcDb3dSolid *pSolid(NULL);
|
|
AcDbCircle *pCir(new AcDbCircle(pt, vt, r));
|
|
AcDbRegion *pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
if (pReg)
|
|
{
|
|
pSolid = drawExtruded(pReg, vt);
|
|
DELETE_PTR(pReg);
|
|
}
|
|
|
|
return pSolid;
|
|
}
|
|
|
|
AcDb3dSolid* drawRevolved(AcDbRegion *pReg, const AcGePoint3d &pt, const AcGeVector3d &vt, const double &sA = 0., const double &eA = 2 * PI)
|
|
{
|
|
AcDb3dSolid *pSolid = new AcDb3dSolid();
|
|
AcDbRevolveOptions op;
|
|
if (pSolid->createRevolvedSolid(pReg, pt, vt, eA - sA, sA, op) == Acad::eOk)
|
|
return pSolid;
|
|
else
|
|
DELETE_PTR(pSolid);
|
|
return pSolid;
|
|
}
|
|
|
|
// 绘制电机 从pt点开始向Dir方向 dR半径 L长度 dh上下盖的高度
|
|
void drawDianJi( const AcGePoint3d &ptO
|
|
, const AcGeVector3d &vtDir
|
|
, const double &dR
|
|
, AcDbVoidPtrArray &ar3d
|
|
, const double &dL = 500
|
|
, const double &dh = 50)
|
|
{
|
|
AcGeVector3d X(AcGeVector3d::kXAxis), Y(AcGeVector3d::kYAxis), Z(AcGeVector3d::kZAxis);
|
|
|
|
AcGePoint3d pt0(AcGePoint3d::kOrigin);
|
|
AcGePoint3d pt1(pt0 - X * dR * .5);
|
|
AcGePoint3d pt2(pt1 + Y * dh);
|
|
AcGePoint3d pt3(pt2 - X * (dR * .5 - dh));
|
|
AcGePoint3d pt4(pt3 + Y * dh);
|
|
pt4 -= X * dh;
|
|
AcGePoint3d pt5(pt4 + Y * (dL - 3 * dh));
|
|
AcGePoint3d pt6(pt5 + Y * dh);
|
|
pt6 += X * dh;
|
|
AcGePoint3d pt7(pt6 + X * (dR - dh));
|
|
|
|
AcDbVoidPtrArray ar;
|
|
ar.append(new AcDbLine(pt0, pt1));
|
|
ar.append(new AcDbLine(pt1, pt2));
|
|
ar.append(new AcDbLine(pt2, pt3));
|
|
ar.append(new AcDbArc(pt4 + X * dh, Z, dh, PI, 1.5 * PI));
|
|
ar.append(new AcDbLine(pt4, pt5));
|
|
ar.append(new AcDbArc(pt5 + X * dh, Z, dh, .5 * PI, PI));
|
|
ar.append(new AcDbLine(pt6, pt7));
|
|
ar.append(new AcDbLine(pt7, pt0));
|
|
|
|
AcDbRegion *pReg = CoreTools::createRegion(ar);
|
|
if (pReg)
|
|
{
|
|
AcDb3dSolid *pSolid = drawRevolved(pReg, AcGePoint3d::kOrigin, Y);
|
|
if (pSolid)
|
|
{
|
|
AcGeVector3d vt = vtDir.crossProduct(Y);
|
|
if (vt == AcGeVector3d::kIdentity)
|
|
vt = X;
|
|
double a = Y.angleTo(vtDir, vt);
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(a, vt);
|
|
pSolid->transformBy(mat);
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(ptO - AcGePoint3d::kOrigin);
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
DELETE_PTR(pReg);
|
|
}
|
|
else
|
|
{
|
|
for (int i = 0; i < ar.length(); i++)
|
|
{
|
|
CoreTools::CloneAndAddToModelSpace((AcDbEntity*)ar[i]);
|
|
}
|
|
}
|
|
|
|
deleteArrayVoidPtrs< AcDbEntity>(ar);
|
|
|
|
}
|
|
|
|
AcDb3dSolid* drawBox(const AcGePoint3d &pt, const AcGeVector3d &vtZ, const AcGeVector3d &vtX, const double &L, const double &W)
|
|
{
|
|
AcGePoint3d pt0, pt1, pt2, pt3;
|
|
getRect(pt, vtX, L, W, pt0, pt1, pt2, pt3, vtZ);
|
|
return makeSolid(vtZ, 4, pt0, pt1, pt2, pt3);
|
|
}
|
|
|
|
// 以 pt 为中心 L长 W宽 上面布栏杆
|
|
void drawLanGan(const AcGePoint3d &pt, const AcGeVector3d &vtX, const double &L, const double &W, AcDbVoidPtrArray &ar3d)
|
|
{
|
|
AcDb3dSolid *pSolid(NULL);
|
|
AcGePoint3d pt0, pt1, pt2, pt3, pt4, pt5;
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis);
|
|
getRect(pt, vtX, L, W, pt0, pt1, pt2, pt3);
|
|
pt4 = CoreTools::MidPt(pt0, pt1);
|
|
pt5 = CoreTools::MidPt(pt2, pt3);
|
|
|
|
double dH(1000), r(10);
|
|
|
|
pSolid = drawCylinder(Z * dH, pt0, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Z * dH, pt1, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Z * dH, pt2, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Z * dH, pt3, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Z * dH, pt4, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Z * dH, pt5, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(vtX * L, pt0 + Z * (dH - r), r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(vtX * L, pt0 + Z * (dH * .5 - r), r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(vtX * L, pt3 + Z * (dH - r), r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(vtX * L, pt3 + Z * (dH * .5 - r), r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 画泵 沿 vtZ画 dH 泵高 dR 半径
|
|
void drawPump(const AcGePoint3d &pt, const AcGeVector3d &vtZ, AcDbVoidPtrArray &ar3d, const double &dH = 500/*, const double &dR = 125*/)
|
|
{
|
|
AcDb3dSolid *pSolid(NULL);
|
|
AcGeVector3d X(AcGeVector3d::kXAxis), Y(AcGeVector3d::kYAxis), Z(AcGeVector3d::kZAxis);
|
|
|
|
double dR = dH * .25;
|
|
double dr(dR * .5);
|
|
AcGePoint3d pt0(AcGePoint3d::kOrigin);
|
|
AcGePoint3d pt1(pt0 - X * dR);
|
|
AcGePoint3d pt2(pt1 + Y * dH / 8);
|
|
AcGePoint3d pt3(pt2 + Y * 2 * dr);
|
|
AcGePoint3d pt4(pt3 + Y * (dH - dR - (2 * dr) - (dH / 8)));
|
|
AcGePoint3d pt5(pt4 + X * dR);
|
|
pt5 += Y * dR;
|
|
|
|
AcDbVoidPtrArray ar;
|
|
ar.append(new AcDbLine(pt0, pt1));
|
|
ar.append(new AcDbLine(pt1, pt2));
|
|
ar.append(new AcDbArc(pt2 + Y * dr, Z, dR * .5, PI * .5, 1.5 * PI));
|
|
ar.append(new AcDbLine(pt3, pt4));
|
|
ar.append(new AcDbArc(pt5 - Y * dR, Z, dR, PI * .5, PI));
|
|
ar.append(new AcDbLine(pt5, pt0));
|
|
|
|
AcDbRegion *pReg = CoreTools::createRegion(ar);
|
|
if (pReg)
|
|
{
|
|
AcDb3dSolid *pSolid = drawRevolved(pReg, AcGePoint3d::kOrigin, Y);
|
|
if (pSolid)
|
|
{
|
|
AcGeVector3d vt = vtZ.crossProduct(Y);
|
|
double a = Y.angleTo(vtZ, vt);
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(a, vt);
|
|
pSolid->transformBy(mat);
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(pt - AcGePoint3d::kOrigin);
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
DELETE_PTR(pReg);
|
|
}
|
|
else
|
|
{
|
|
for (int i = 0; i < ar.length(); i++)
|
|
{
|
|
CoreTools::CloneAndAddToModelSpace((AcDbEntity*)ar[i]);
|
|
}
|
|
}
|
|
}
|
|
|
|
AcDb3dSolid* drawTorus(const AcGePoint3d &pt, const AcGeVector3d &vtZ, const double &R, const double &r)
|
|
{
|
|
AcDb3dSolid *pSolid(NULL);
|
|
AcGeVector3d vtN(vtZ);
|
|
vtN.normalize();
|
|
|
|
AcDbCircle *pPath = new AcDbCircle(pt, vtN, (R + r) * .5);
|
|
|
|
AcGePoint3d ptFirst;
|
|
pPath->getPointAtDist(0, ptFirst);
|
|
AcGeVector3d tangent;
|
|
pPath->getFirstDeriv(ptFirst, tangent);
|
|
|
|
AcDbCircle *pSection = new AcDbCircle(ptFirst, tangent, (R - r) * .5);
|
|
AcDbRegion *pReg = CoreTools::createRegion(pSection);
|
|
if (pReg)
|
|
{
|
|
pSolid = new AcDb3dSolid();
|
|
if (pSolid->extrudeAlongPath(pReg, pPath) != Acad::eOk)
|
|
DELETE_PTR(pSolid);
|
|
DELETE_PTR(pReg);
|
|
}
|
|
|
|
DELETE_PTR(pPath);
|
|
DELETE_PTR(pSection);
|
|
|
|
return pSolid;
|
|
}
|
|
|
|
AcDb3dSolid* cloneAndTransform(AcDb3dSolid *pSolid, const AcGeMatrix3d &mat)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
p->transformBy(mat);
|
|
return p;
|
|
}
|
|
}
|
|
#pragma endregion
|
|
|
|
namespace GESHAN
|
|
{
|
|
#pragma region XHG
|
|
IMP_XDATA_KEY(XHG,H1);
|
|
IMP_XDATA_KEY(XHG,H2);
|
|
IMP_XDATA_KEY(XHG,H3);
|
|
IMP_XDATA_KEY(XHG,H4);
|
|
|
|
IMP_XDATA_KEY(XHG,w);
|
|
IMP_XDATA_KEY(XHG,a);
|
|
|
|
IMP_XDATA_KEY(XHG,L1);
|
|
IMP_XDATA_KEY(XHG,L2);
|
|
|
|
IMP_XDATA_KEY(XHG,B);
|
|
IMP_XDATA_KEY(XHG,B1);
|
|
IMP_XDATA_KEY(XHG,B2);
|
|
IMP_XDATA_KEY(XHG,B3);
|
|
IMP_XDATA_KEY(XHG,B6);
|
|
IMP_XDATA_KEY(XHG,b);
|
|
|
|
IMP_XDATA_KEY(XHG,Pos);
|
|
IMP_XDATA_KEY(XHG,Dir);
|
|
|
|
void XHG::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
double L1(GetL1())
|
|
, L2(GetL2())
|
|
, H1(GetH1())
|
|
, H2(GetH2())
|
|
, H3(GetH3())
|
|
, H4(GetH4())
|
|
, B(GetB())
|
|
, B1(GetB1())
|
|
, B2(GetB2())
|
|
, B3(GetB3())
|
|
, B6(GetB6())
|
|
, a(Geta())
|
|
, w(Getw())
|
|
, b(Getb());
|
|
double t((B - B1) * .5);
|
|
|
|
AcGePoint3d ptPos(GetPos());
|
|
AcGeVector3d Xdir(-1 * GetDir()), X(AcGeVector3d::kXAxis), Y(AcGeVector3d::kYAxis), Z(AcGeVector3d::kZAxis), vt;
|
|
AcGeVector3d Ydir(Xdir);
|
|
Ydir.rotateBy(PI * .5, Z);
|
|
AcGeMatrix3d mat2Pos;
|
|
mat2Pos.setToAlignCoordSys( AcGePoint3d::kOrigin
|
|
, X
|
|
, Y
|
|
, Z
|
|
, ptPos
|
|
, Xdir
|
|
, Ydir
|
|
, Z);
|
|
|
|
AcGePoint3d ptO(AcGePoint3d::kOrigin);
|
|
ptO -= Y * B * .5;
|
|
|
|
AcGePoint3d pt0 = ptO;
|
|
pt0 -= X * L2;
|
|
pt0 -= Z * H1;
|
|
|
|
AcGePoint3d pt1 = pt0;
|
|
pt1 += X * w / sin(a);
|
|
|
|
vt = ptO - pt1;
|
|
vt.normalize();
|
|
vt *= (H1 / sin(a) + H2 / sin(a));
|
|
AcGePoint3d pt2 = pt1 + vt;
|
|
|
|
AcGePoint3d pt3 = pt2;
|
|
pt3 += X * (L1 - L2 - H2 / tan(a));
|
|
|
|
AcGePoint3d pt4 = pt3 + Z * H3;
|
|
|
|
vt.normalize();
|
|
vt *= (H1 + H2 + H3) / sin(a);
|
|
|
|
AcGePoint3d pt5 = pt0 + vt;
|
|
|
|
AcGePoint3d _pt0(pt0 + Y * B)
|
|
, _pt1(pt1 + Y * B)
|
|
, _pt2(pt2 + Y * B)
|
|
, _pt3(pt3 + Y * B)
|
|
, _pt4(pt4 + Y * B)
|
|
, _pt5(pt5 + Y * B);
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 主体
|
|
{
|
|
pSolid =makeSolid(Y * t, 6, pt0, pt1, pt2, pt3, pt4, pt5);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pSolid = makeSolid(-Y * t, 6, _pt0, _pt1, _pt2, _pt3, _pt4, _pt5);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pSolid = makeSolid(-Z * t, 4, pt4, pt5, _pt5, _pt4);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pSolid = makeSolid(-X * t, 4, pt3, pt4, _pt4, _pt3);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pSolid = makeSolid(Z * t, 4, pt0, pt1, _pt1, _pt0);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 电机传动带
|
|
AcGePoint3d ptDjCen(AcGePoint3d::kOrigin);
|
|
double dDjR(.0);
|
|
{
|
|
double R(H3 * .25), r(H3 * .25 * .5);
|
|
dDjR = r * .25;
|
|
double len = (H3 + H4 - R - r) / cos(PI / 6);
|
|
AcGePoint3d ptC(AcGePoint3d::kOrigin);
|
|
vt = X;
|
|
vt.rotateBy(4 * PI / 6, Z);
|
|
AcGePoint3d ptc(ptC + vt * len);
|
|
vt.rotateBy(PI * .5, Z);
|
|
AcGePoint3d pt6 = ptC + vt * R;
|
|
AcGePoint3d pt7 = ptc + vt * r;
|
|
AcGePoint3d pt8 = ptc - vt * r;
|
|
AcGePoint3d pt9 = ptC - vt * R;
|
|
|
|
AcDbPolyline *pPoly = new AcDbPolyline();
|
|
pPoly->addVertexAt(0, pt6.convert2d(AcGePlane::kXYPlane));
|
|
pPoly->addVertexAt(1, pt7.convert2d(AcGePlane::kXYPlane), -1);
|
|
pPoly->addVertexAt(2, pt8.convert2d(AcGePlane::kXYPlane));
|
|
pPoly->addVertexAt(3, pt9.convert2d(AcGePlane::kXYPlane), -1);
|
|
pPoly->setClosed(true);
|
|
AcDbRegion *pReg = CoreTools::createRegion(pPoly);
|
|
DELETE_PTR(pPoly);
|
|
if (pReg)
|
|
{
|
|
AcGeMatrix3d xz;
|
|
xz.setToAlignCoordSys(AcGePoint3d::kOrigin, X, Y, Z, AcGePoint3d::kOrigin, X, Z, Y);
|
|
pReg->transformBy(xz);
|
|
ptC.transformBy(xz);
|
|
ptc.transformBy(xz);
|
|
AcGePoint3d _ptC(CoreTools::MidPt(pt2, pt3));
|
|
_ptC.z += R;
|
|
vt = _ptC - ptC;
|
|
xz.setToIdentity();
|
|
xz.setToTranslation(vt);
|
|
pReg->transformBy(xz);
|
|
ptc.transformBy(xz);
|
|
ptDjCen = ptc;
|
|
|
|
pSolid = makeSolid(pReg, -Y * B3);
|
|
DELETE_PTR(pReg);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 电机
|
|
{
|
|
AcDbCircle *pCir = new AcDbCircle(ptDjCen, Y, dDjR);
|
|
AcDbRegion *pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
pSolid = makeSolid(pReg, Y * t);
|
|
DELETE_PTR(pReg);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pCir = new AcDbCircle(ptDjCen + Y * t, Y, dDjR * 4.);
|
|
pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
pSolid = makeSolid(pReg, Y * B * .5);
|
|
DELETE_PTR(pReg);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 格栅
|
|
{
|
|
// B1 宽 H1高
|
|
//AcGePoint3d pt10(CoreTools::MidPt(pt0, pt1) + Y * t);
|
|
AcGePoint3d pt10(pt0 + Y * t);
|
|
pt10 += X * t;
|
|
AcGePoint3d pt11(pt10 + Y * B1);
|
|
AcGePoint3d pt12(pt11 + X * ((H1+ H2) / sin(a)));
|
|
AcGePoint3d pt13(pt12 - Y * B1);
|
|
|
|
AcGeVector3d _X(X), _Z(X);
|
|
_Z.rotateBy(PI * .5 + a, -Y);
|
|
_X.rotateBy(a, -Y);
|
|
AcGeMatrix3d m;
|
|
m.setToAlignCoordSys(pt10, X, Y, Z, pt10, _X, Y, _Z);
|
|
X = AcGeVector3d::kXAxis;
|
|
|
|
// 面
|
|
pSolid = makeSolid(Z * 1, 4, pt10, pt11, pt12, pt13);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(m);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
pt12.transformBy(m);
|
|
pt13.transformBy(m);
|
|
pSolid = makeSolid(Z * 1, 4, pt12, pt13, pt3 + Y * t, _pt3 - Y * t);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
// 栅条
|
|
AcGePoint3d pt14, pt15, pt16, pt17;
|
|
int num = (int)(B1/(B6 + b));
|
|
double y((B1 - (B6 + b) * num) * .5 + b * .5);
|
|
for (int i = 0; i < num; ++i)
|
|
{
|
|
pt14 = pt10 + Y * y;
|
|
pt15 = pt14 + X * ((H1 + H2) / sin(a));
|
|
pt16 = pt15 + Y * B6;
|
|
pt17 = pt14 + Y * B6;
|
|
y += B6 + b;
|
|
pSolid = makeSolid(Z * B6, 4, pt14, pt15, pt16, pt17);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(m);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
// 横条
|
|
int count(4);
|
|
pt14 = pt10 + X * ((((H1 + H2)/sin(a)) / count) - B6 * .5);
|
|
pt15 = pt14 + X * B6;
|
|
pt16 = pt15 + Y * B1;
|
|
pt17 = pt14 + Y * B1;
|
|
for (int i = 0; i < count - 1; ++i)
|
|
{
|
|
pSolid = makeSolid(Z * 2 * B6, 4, pt14, pt15, pt16, pt17);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(m);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
pt14 = pt14 + X * (((H1 / sin(a)) / 3) - B6 * .5);
|
|
pt15 = pt14 + X * B6;
|
|
pt16 = pt15 + Y * B1;
|
|
pt17 = pt14 + Y * B1;
|
|
}
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
void XHG::draw2d(AcDbVoidPtrArray &ar2d)
|
|
{
|
|
draw3d(ar2d);
|
|
}
|
|
#pragma endregion
|
|
|
|
#pragma region SG
|
|
IMP_XDATA_KEY(SG, H);
|
|
IMP_XDATA_KEY(SG, H1);
|
|
IMP_XDATA_KEY(SG, H2);
|
|
IMP_XDATA_KEY(SG, H3);
|
|
IMP_XDATA_KEY(SG, H4);
|
|
|
|
IMP_XDATA_KEY(SG, a);
|
|
|
|
IMP_XDATA_KEY(SG, L1);
|
|
IMP_XDATA_KEY(SG, L);
|
|
|
|
IMP_XDATA_KEY(SG, B);
|
|
IMP_XDATA_KEY(SG, B1);
|
|
IMP_XDATA_KEY(SG, B6);
|
|
IMP_XDATA_KEY(SG, b);
|
|
|
|
IMP_XDATA_KEY(SG, Dir);
|
|
IMP_XDATA_KEY(SG, Pos);
|
|
|
|
void SG::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
AcGeVector3d vt(AcGeVector3d::kIdentity)
|
|
, X(AcGeVector3d::kXAxis)
|
|
, Y(AcGeVector3d::kYAxis)
|
|
, Z(AcGeVector3d::kZAxis);
|
|
AcGeMatrix3d mat, mat2Pos;
|
|
|
|
double L1(GetL1())
|
|
, L(GetL())
|
|
, H(GetH())
|
|
, H1(GetH1())
|
|
, H2(GetH2())
|
|
, H3(GetH3())
|
|
, H4(GetH4())
|
|
, B(GetB())
|
|
, B1(GetB1())
|
|
, B6(GetB6())
|
|
, a(Geta())
|
|
, b(Getb());
|
|
double t((B - B1) * .5);
|
|
|
|
AcGePoint3d ptPos(GetPos());
|
|
AcGeVector3d Xdir(-1 * GetDir());
|
|
AcGeVector3d Ydir(Xdir);
|
|
Ydir.rotateBy(PI * .5, Z);
|
|
mat2Pos.setToAlignCoordSys( AcGePoint3d::kOrigin
|
|
, X
|
|
, Y
|
|
, Z
|
|
, ptPos
|
|
, Xdir
|
|
, Ydir
|
|
, Z);
|
|
|
|
// 电机上需要有顶棚
|
|
double H5 = 500;
|
|
double _H4 = H4 - H5;
|
|
double L2 = 800; // 除污推杆长
|
|
|
|
AcGePoint3d ptO(AcGePoint3d::kOrigin), pt(AcGePoint3d::kOrigin), _pt(AcGePoint3d::kOrigin);
|
|
|
|
AcGePoint3d pt0(ptO - Y * B * .5);
|
|
AcGePoint3d pt1(pt0 + X * L1);
|
|
AcGePoint3d pt2(pt1 + Z * _H4);
|
|
AcGePoint3d pt3(pt2 - X * (L1 - (_H4 / tan(a))));
|
|
|
|
double l1(L1 - t / tan(a * .5) - t), h4(_H4 - 2 * t);
|
|
vt = X;
|
|
vt.rotateBy(a * .5, -Y);
|
|
AcGePoint3d pt4(pt0 + vt * (t / sin(a * .5)));
|
|
AcGePoint3d pt5(pt4 + X * l1);
|
|
AcGePoint3d pt6(pt5 + Z * h4);
|
|
AcGePoint3d pt7(pt6 - X *(l1 - (h4 / tan(a))));
|
|
|
|
// 池上部分
|
|
{
|
|
// 两侧框架
|
|
{
|
|
AcDbRegion *pReg1 = makeRegion2(4, pt0, pt1, pt2, pt3);
|
|
AcDbRegion *pReg2 = makeRegion2(4, pt4, pt5, pt6, pt7);
|
|
if (!pReg1 || !pReg2)
|
|
{
|
|
DELETE_PTR(pReg1);
|
|
DELETE_PTR(pReg2);
|
|
return;
|
|
}
|
|
|
|
if (pReg1->booleanOper(AcDb::kBoolSubtract, pReg2) == Acad::eOk)
|
|
DELETE_PTR(pReg2);
|
|
else
|
|
return;
|
|
|
|
pReg2 = (AcDbRegion*)pReg1->clone();
|
|
mat.setToTranslation(Y * B);
|
|
pReg2->transformBy(mat);
|
|
|
|
pSolid = makeSolid(pReg1, Y * t);
|
|
if (pSolid)
|
|
{
|
|
DELETE_PTR(pReg1);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pSolid = makeSolid(pReg2, -Y * t);
|
|
if (pSolid)
|
|
{
|
|
DELETE_PTR(pReg2);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 电机平台及顶棚
|
|
{
|
|
pSolid = makeSolid(Y * B
|
|
, 4
|
|
, pt7 - X * (t / sin(a))
|
|
, pt3
|
|
, pt2
|
|
, pt6 + X * t);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
vt = Z * H5;
|
|
mat.setToTranslation(vt);
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat);
|
|
//pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 电机平台四个柱子
|
|
{
|
|
pSolid = makeSolid(Z * (H5 - t)
|
|
, 4
|
|
, pt2
|
|
, pt2 + Y * t
|
|
, (pt2 + Y * t) - X * t
|
|
, pt2 - X * t);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
vt = Ydir * (B - t);
|
|
mat.setToTranslation(vt);
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pSolid = makeSolid(Z * (H5 - t)
|
|
, 4
|
|
, pt7 + Z * t
|
|
, (pt7 + Z * t) + Y * t
|
|
, ((pt7 + Z * t) + Y * t) + X * t
|
|
, (pt7 + Z * t) + X * t);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
vt = Ydir * (B - t);
|
|
mat.setToTranslation(vt);
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 横梁
|
|
{
|
|
vt = X;
|
|
vt.rotateBy(a, -Y);
|
|
pSolid = makeSolid(Y * t
|
|
, 4
|
|
, CoreTools::MidPt(pt6, pt5) - Z * t * .5
|
|
, CoreTools::MidPt(pt6, pt5) + Z * t * .5
|
|
, CoreTools::MidPt(pt4, pt7) + vt * (t * .5 / sin(a))
|
|
, CoreTools::MidPt(pt4, pt7) - vt * (t * .5 / sin(a)));
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
vt = Ydir * (B - t);
|
|
mat.setToTranslation(vt);
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat);
|
|
//pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pSolid = makeSolid(Y * B
|
|
, 4
|
|
, CoreTools::MidPt(pt6, pt5) - Z * t * .5
|
|
, CoreTools::MidPt(pt6, pt5) + Z * t * .5
|
|
, (CoreTools::MidPt(pt6, pt5) + Z * t * .5) + X * t
|
|
, (CoreTools::MidPt(pt6, pt5) - Z * t * .5) + X * t);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pSolid = makeSolid(Y * B
|
|
, 4
|
|
, pt5
|
|
, pt5 - Z * t
|
|
, pt1
|
|
, pt1 + Z * t);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 除污推杆
|
|
{
|
|
pt = CoreTools::MidPt(pt0, pt3);
|
|
pt = CoreTools::MidPt(pt, pt3);
|
|
vt = X;
|
|
vt.rotateBy(a, -Y);
|
|
pSolid = makeSolid(-X * L2
|
|
, 4
|
|
, pt + vt * (t * .5 / sin(a))
|
|
, (pt + vt * (t * .5 / sin(a))) + Y * t
|
|
, ((pt + vt * (t * .5 / sin(a))) + Y * t) - Z * t
|
|
, (pt + vt * (t * .5 / sin(a))) - Z * t);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
vt = Ydir * (B - t);
|
|
mat.setToTranslation(vt);
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat);
|
|
//pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pt -= X * L2;
|
|
pSolid = makeSolid(Y * B
|
|
, 4
|
|
, pt + Z * t * .5
|
|
, pt - Z * t * .5
|
|
, (pt - Z * t * .5) + X * t
|
|
, (pt + Z * t * .5) + X * t);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
vt = X;
|
|
vt.rotateBy(a, -Y);
|
|
pt = CoreTools::MidPt(pt0, pt3);
|
|
_pt = CoreTools::MidPt(pt, pt3);
|
|
double d = pt.distanceTo(_pt);
|
|
_pt -= X * d;
|
|
pSolid = makeSolid(_pt - pt
|
|
, 4
|
|
, pt + vt * .5 * t
|
|
, pt - vt * .5 * t
|
|
, (pt - vt * .5 * t) + Y * t
|
|
, (pt + vt * .5 * t) + Y * t );
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
vt = Ydir * (B - t);
|
|
mat.setToTranslation(vt);
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat);
|
|
//pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
}
|
|
|
|
// 水下格栅
|
|
{
|
|
// 两根柱子
|
|
{
|
|
double l = H / tan(a);
|
|
vt = X;
|
|
vt.rotateBy(a, -Y);
|
|
vt *= -1;
|
|
pSolid = makeSolid(vt * l
|
|
, 4
|
|
, pt0
|
|
, pt0 + X * (t / sin(a))
|
|
, (pt0 + X * (t / sin(a))) + Y * t
|
|
, pt0 + Y * t);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
vt = Ydir * (B - t);
|
|
mat.setToTranslation(vt);
|
|
if (pSolid)
|
|
{
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat);
|
|
//pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
}
|
|
// 格栅
|
|
{
|
|
double l = H / tan(a);
|
|
vt = X;
|
|
vt.rotateBy(a, -Y);
|
|
vt *= -1;
|
|
// B1 宽 H1高
|
|
AcGePoint3d pt10((pt0 + vt * l) + Y * t);
|
|
pt10 += X * t;
|
|
AcGePoint3d pt11(pt10 + Y * B1);
|
|
AcGePoint3d pt12(pt11 + X * l);
|
|
AcGePoint3d pt13(pt12 - Y * B1);
|
|
|
|
AcGeVector3d _X(X), _Z(X);
|
|
_Z.rotateBy(PI * .5 + a, -Y);
|
|
_X.rotateBy(a, -Y);
|
|
AcGeMatrix3d m;
|
|
m.setToAlignCoordSys(pt10, X, Y, Z, pt10, _X, Y, _Z);
|
|
X = AcGeVector3d::kXAxis;
|
|
|
|
// 面
|
|
pSolid = makeSolid(Z * 1, 4, pt10, pt11, pt12, pt13);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(m);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
// 栅条
|
|
AcGePoint3d pt14, pt15, pt16, pt17;
|
|
int num = (int)(B1/(B6 + b));
|
|
double y((B1 - (B6 + b) * num) * .5 + b * .5);
|
|
for (int i = 0; i < num; ++i)
|
|
{
|
|
pt14 = pt10 + Y * y;
|
|
pt15 = pt14 + X * (H1 / sin(a));
|
|
pt16 = pt15 + Y * B6;
|
|
pt17 = pt14 + Y * B6;
|
|
y += B6 + b;
|
|
pSolid = makeSolid(Z * B6, 4, pt14, pt15, pt16, pt17);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(m);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
// 横条
|
|
int count(4);
|
|
pt14 = pt10 + X * (((H1/sin(a)) / count) - B6 * .5);
|
|
pt15 = pt14 + X * B6;
|
|
pt16 = pt15 + Y * B1;
|
|
pt17 = pt14 + Y * B1;
|
|
for (int i = 0; i < count - 1; ++i)
|
|
{
|
|
pSolid = makeSolid(Z * 2 * B6, 4, pt14, pt15, pt16, pt17);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(m);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
pt14 = pt14 + X * (((H1 / sin(a)) / 3) - B6 * .5);
|
|
pt15 = pt14 + X * B6;
|
|
pt16 = pt15 + Y * B1;
|
|
pt17 = pt14 + Y * B1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SG::draw2d(AcDbVoidPtrArray &ar2d)
|
|
{
|
|
draw3d(ar2d);
|
|
}
|
|
#pragma endregion
|
|
|
|
#pragma region ZG
|
|
IMP_XDATA_KEY(ZG,H1);
|
|
IMP_XDATA_KEY(ZG,H2);
|
|
IMP_XDATA_KEY(ZG,H3);
|
|
|
|
IMP_XDATA_KEY(ZG,a);
|
|
IMP_XDATA_KEY(ZG,A);
|
|
IMP_XDATA_KEY(ZG,B);
|
|
|
|
IMP_XDATA_KEY(ZG,D);
|
|
IMP_XDATA_KEY(ZG,d);
|
|
IMP_XDATA_KEY(ZG,L);
|
|
IMP_XDATA_KEY(ZG,l);
|
|
|
|
IMP_XDATA_KEY(ZG,Pos);
|
|
IMP_XDATA_KEY(ZG,Dir);
|
|
|
|
void ZG::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
AcDb3dSolid *pSolid(NULL);
|
|
AcDbCircle *pCir(NULL);
|
|
AcDbRegion *pReg(NULL);
|
|
|
|
AcGeVector3d vt(AcGeVector3d::kIdentity)
|
|
, X(AcGeVector3d::kXAxis)
|
|
, Y(AcGeVector3d::kYAxis)
|
|
, Z(AcGeVector3d::kZAxis);
|
|
AcGeMatrix3d mat, mat2Pos;
|
|
|
|
double L(GetL())
|
|
, l(Getl())
|
|
, H1(GetH1())
|
|
, H2(GetH2())
|
|
, H3(GetH3())
|
|
, B(GetB())
|
|
, A(GetA())
|
|
, a(Geta())
|
|
, D(GetD())
|
|
, d(Getd());
|
|
|
|
AcGePoint3d ptPos(GetPos());
|
|
AcGeVector3d Xdir(-1 * GetDir());
|
|
AcGeVector3d Ydir(Xdir);
|
|
Ydir.rotateBy(PI * .5, Z);
|
|
mat2Pos.setToAlignCoordSys( AcGePoint3d::kOrigin
|
|
, X
|
|
, Y
|
|
, Z
|
|
, ptPos
|
|
, Xdir
|
|
, Ydir
|
|
, Z);
|
|
|
|
// 20 为
|
|
double L1(L - l), L2(H2 / tan(a));
|
|
vt = X;
|
|
vt.rotateBy(a + PI * .5, -Y);
|
|
AcGePoint3d ptO(AcGePoint3d::kOrigin);
|
|
|
|
AcGePoint3d pt0(ptO + vt * d * .5);
|
|
|
|
// 传动轴
|
|
{
|
|
vt = X;
|
|
vt.rotateBy(a, -Y);
|
|
vt *= L1;
|
|
|
|
pCir = new AcDbCircle(pt0, vt, d * .5);
|
|
pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
if (!pReg) return;
|
|
|
|
pSolid = makeSolid(pReg, vt);
|
|
if (pSolid)
|
|
{
|
|
DELETE_PTR(pReg);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 细轴
|
|
{
|
|
//vt.normalize();
|
|
//vt *= -(L - L1);
|
|
//pCir = new AcDbCircle(pt0, vt, d * .25);
|
|
//pReg = CoreTools::createRegion(pCir);
|
|
//DELETE_PTR(pCir);
|
|
//if (!pReg) return Acad::eInvalidInput;
|
|
|
|
//pSolid = GeShTools::makeSolid(pReg, vt);
|
|
//if (pSolid)
|
|
//{
|
|
// pSolid->transformBy(mat2Pos);
|
|
// dc.DrawEntity(*pSolid);
|
|
// Add3DBuffer(pSolid);
|
|
//}
|
|
};
|
|
|
|
// 栅网
|
|
{
|
|
//vt.normalize();
|
|
//vt *= delta;
|
|
//pt0 += vt;
|
|
vt.normalize();
|
|
vt *= -l;
|
|
|
|
pCir = new AcDbCircle(pt0, vt, D * .5);
|
|
pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
if (!pReg) return;
|
|
pSolid = makeSolid(pReg, vt);
|
|
if (pSolid)
|
|
{
|
|
DELETE_PTR(pReg);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 出料口
|
|
{
|
|
vt.normalize();
|
|
AcGeVector3d _vt(-vt);
|
|
AcGePoint3d pt1(pt0 - vt * (H2 / sin(a)));
|
|
pt1 -= Y * d * .5;
|
|
pSolid = makeSolid(Y * d
|
|
, 4
|
|
, pt1
|
|
, pt1 + _vt * 1.5 * d
|
|
, (pt1 + _vt * 1.5 * d) + X * (d * .5 / sin(a))
|
|
, pt1 + X * (1.5 * d * cos(a) + (d * .5 / sin(a))));
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 柱子
|
|
{
|
|
vt.normalize();
|
|
AcGeVector3d _vt(-vt);
|
|
_vt.rotateBy(PI * .5, -Y);
|
|
pCir = new AcDbCircle(((pt0 - _vt * d * .5 ) + X * (L2 * .5)), Z, d * .25);
|
|
pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
pSolid = makeSolid(pReg, Z * (L2 * .5 * tan(a) + d * .5));
|
|
if (pSolid)
|
|
{
|
|
DELETE_PTR(pReg);
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
AcGePoint3d pt1(pt0);
|
|
pt1 -= vt * ((H2 * .5 / tan(a) - d * .25) / cos(a));
|
|
pt1 -= Y * d * .5;
|
|
pt1 -= _vt * d * .5;
|
|
AcGePoint3d pt2(pt1 + Y * d);
|
|
AcGePoint3d pt3(pt2 + _vt * d);
|
|
AcGePoint3d pt4(pt3 - Y * d);
|
|
pSolid = makeSolid(-vt * (d * .5 / cos(a)), 4, pt1, pt2, pt3, pt4);
|
|
if (pSolid)
|
|
{
|
|
pSolid->transformBy(mat2Pos);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ZG::draw2d(AcDbVoidPtrArray &ar2d)
|
|
{
|
|
draw3d(ar2d);
|
|
}
|
|
#pragma endregion
|
|
}
|
|
|
|
namespace BAOQIQI
|
|
{
|
|
IMP_XDATA_KEY(BaoQiQi,_L1);
|
|
IMP_XDATA_KEY(BaoQiQi,_L4);
|
|
IMP_XDATA_KEY(BaoQiQi,_H3);
|
|
IMP_XDATA_KEY(BaoQiQi,_h);
|
|
IMP_XDATA_KEY(BaoQiQi,_r);
|
|
IMP_XDATA_KEY(BaoQiQi,_Type);
|
|
IMP_XDATA_KEY(BaoQiQi,Pos);
|
|
IMP_XDATA_KEY(BaoQiQi,Dir);
|
|
|
|
void BaoQiQi::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
AcDb3dSolid *pSolid(NULL);
|
|
AcDbCircle *pCir(NULL);
|
|
AcDbRegion *pReg(NULL);
|
|
|
|
AcGeVector3d X(AcGeVector3d::kXAxis) , Y(AcGeVector3d::kYAxis) , Z(AcGeVector3d::kZAxis);
|
|
|
|
AcGePoint3d ptPos(GetPos());
|
|
|
|
int iType(Get_Type());
|
|
|
|
if (iType == 0) // 盘式
|
|
{
|
|
double L1(Get_L1()), L4(Get_L4()), h(Get_h()), r(Get_r());
|
|
|
|
pCir = new AcDbCircle(ptPos, Z, r);
|
|
pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
if (!pReg) return;
|
|
pSolid = makeSolid(pReg, Z * h);
|
|
if (pSolid)
|
|
{
|
|
DELETE_PTR(pReg);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pCir = new AcDbCircle(ptPos + Z * h, Z, L1 * .5);
|
|
pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
if (!pReg) return;
|
|
pSolid = makeSolid(pReg, Z * L4);
|
|
if (pSolid)
|
|
{
|
|
DELETE_PTR(pReg);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
else if (iType == 1) // 管式
|
|
{
|
|
double L1(Get_L1()), H3(Get_H3());
|
|
AcGeVector3d vtDir(GetDir());
|
|
pCir = new AcDbCircle(ptPos, vtDir, H3 * .5);
|
|
pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
if (!pReg) return;
|
|
pSolid = makeSolid(pReg, vtDir * L1);
|
|
if (pSolid)
|
|
{
|
|
DELETE_PTR(pReg);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
else
|
|
return;
|
|
}
|
|
|
|
void BaoQiQi::draw2d(AcDbVoidPtrArray &ar2d)
|
|
{
|
|
draw3d(ar2d);
|
|
}
|
|
}
|
|
|
|
namespace SHASHUIFENLI
|
|
{
|
|
#pragma region XCS
|
|
void XCS::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
BOOL hasBr(false);
|
|
double fai, fai1, h, h1, W;
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(fai);
|
|
GETXDATA(fai1);
|
|
GETXDATA(h);
|
|
GETXDATA(h1);
|
|
GETXDATA(W);
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
GETXDATA(hasBr);
|
|
|
|
TESTXDATA(XCS);
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
AcGeVector3d Z(AcGeVector3d::kZAxis), X(Dir);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
|
|
W = fai * .25;
|
|
|
|
double dWh(.0);
|
|
if (hasBr)
|
|
{
|
|
dWh = 50; // 顶板厚10cm
|
|
// 画顶板
|
|
pSolid = drawBox(Pos, Z * dWh, Dir, fai, W);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 栏杆
|
|
drawLanGan(Pos, X, fai, W, ar3d);
|
|
}
|
|
|
|
// 电机
|
|
drawDianJi(Pos + Z * dWh, Z, 200, ar3d);
|
|
|
|
// 传动轴
|
|
pSolid = drawCylinder(Z * -1 * h, Pos, 50);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 桨叶
|
|
double l(fai1 * .8);
|
|
AcGePoint3d pt0(Pos - Z * h);
|
|
AcGePoint3d pt1(pt0 - X * 2 * l / 3);
|
|
AcGePoint3d pt3(pt0 + Z * h / 4);
|
|
AcGePoint3d pt2(pt3 - X * l);
|
|
|
|
AcDbRegion *pReg = makeRegion2(4, pt0, pt1, pt2, pt3);
|
|
if (pReg) ar3d.append(pReg);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI * .5, Z, Pos);
|
|
|
|
pReg = (AcDbRegion*)pReg->clone();
|
|
pReg->transformBy(mat);
|
|
if (pReg) ar3d.append(pReg);
|
|
|
|
pReg = (AcDbRegion*)pReg->clone();
|
|
pReg->transformBy(mat);
|
|
if (pReg) ar3d.append(pReg);
|
|
|
|
pReg = (AcDbRegion*)pReg->clone();
|
|
pReg->transformBy(mat);
|
|
if (pReg) ar3d.append(pReg);
|
|
|
|
// 外壁
|
|
/*
|
|
AcGePoint3d pt0(Pos);
|
|
AcGePoint3d pt1(pt0 - Dir * fai * .5);
|
|
AcGePoint3d pt2(pt1 - Z * 2 * (h / 3));
|
|
AcGePoint3d pt3(pt2 - Z * (h / 3));
|
|
pt3 += X * (fai - fai1) * .5;
|
|
AcGePoint3d pt4(pt3 - Z * 2 * (h1 / 3));
|
|
AcGePoint3d pt5(pt4 - Z * (h1 / 3));
|
|
pt5 += X * fai1 * .25;
|
|
AcGePoint3d pt6(Pos - Z * (h + h1));
|
|
|
|
AcDbRegion *pReg = makeRegion2(7, pt0, pt1, pt2, pt3, pt4, pt5, pt6);
|
|
if (pReg)
|
|
{
|
|
pSolid = drawRevolved(pReg, Pos, Z);
|
|
if (pSolid)
|
|
{
|
|
double dt(10);
|
|
double dFai(fai - dt), dFai1(fai1 - dt);
|
|
pt0 = Pos;
|
|
pt1 = (pt0 - Dir * (dFai * .5));
|
|
pt2 = (pt1 - Z * 2 * (h / 3));
|
|
pt3 = (pt2 - Z * (h / 3));
|
|
pt3 += X * (dFai - dFai1) * .5;
|
|
pt4 = (pt3 - Z * 2 * (h1 / 3));
|
|
pt5 = (pt4 - Z * (h1 / 3 -10));
|
|
pt5 += X * dFai1 * .25;
|
|
pt6 = (Pos - Z * (h + h1 - 10));
|
|
AcDbRegion *pReg1 = makeRegion2(7, pt0, pt1, pt2, pt3, pt4, pt5, pt6);
|
|
if (pReg1)
|
|
{
|
|
AcDb3dSolid *pSolid1 = drawRevolved(pReg1, Pos, Z);
|
|
if (pSolid1)
|
|
{
|
|
if (pSolid->booleanOper(AcDb::kBoolSubtract, pSolid1) != Acad::eOk)
|
|
DELETE_PTR(pSolid1);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
DELETE_PTR(pReg1);
|
|
}
|
|
}
|
|
DELETE_PTR(pReg);
|
|
}*/
|
|
}
|
|
void XCS::draw2d(AcDbVoidPtrArray &ar2d) { draw3d(ar2d); }
|
|
#pragma endregion
|
|
|
|
#pragma region HXS
|
|
void HXS::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double H, L, L1, L2, W;
|
|
int Single;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(H);
|
|
GETXDATA(L);
|
|
GETXDATA(L1);
|
|
GETXDATA(L2);
|
|
GETXDATA(Single);
|
|
GETXDATA(W);
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(HXS);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 向上提,下面是轨道轮子,半径 W/8
|
|
Pos += Z * W / 4;
|
|
|
|
// 顶板
|
|
double dWh(100);
|
|
pSolid = drawBox(Pos, Z * dWh, X, L, W);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 轮子
|
|
{
|
|
double dr(W / 16);
|
|
AcGePoint3d pt0, pt1, pt2, pt3;
|
|
getRect(Pos, X, L, W, pt0, pt1, pt2, pt3);
|
|
|
|
pt0 += Y * dr; pt0 -= Z * dr;
|
|
pt3 -= Y * dr; pt3 -= Z * dr;
|
|
pt1 += Y * dr; pt1 -= Z * dr;
|
|
pt2 -= Y * dr; pt2 -= Z * dr;
|
|
|
|
pSolid = drawCylinder(-X * 100, pt0, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt1, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt2, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-X * 100, pt3, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt0.distanceTo(pt1), pt0, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt3.distanceTo(pt2), pt3, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 栏杆
|
|
drawLanGan(Pos, X, L, W, ar3d);
|
|
|
|
// 吸管
|
|
{
|
|
double dr(100), dPumpH(500);
|
|
double len((W / 4) + H), distPump((W / 4) + dPumpH);
|
|
AcGePoint3d pt1(Pos + X * ((L *.5) - L1));
|
|
AcGePoint3d pt2(pt1 - X * L2);
|
|
|
|
AcGePoint3d pt11(pt1 - Z * distPump);
|
|
AcGePoint3d pt22(pt2 - Z * distPump);
|
|
|
|
pSolid = drawCylinder(-Z * len, pt1, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
drawPump(pt11, Z, ar3d, dPumpH);
|
|
|
|
if (!Single)
|
|
{
|
|
pSolid = drawCylinder(-Z * len, pt2, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
drawPump(pt22, Z, ar3d, dPumpH);
|
|
}
|
|
}
|
|
|
|
//drawPump(Pos, Z, ar3d);
|
|
}
|
|
void HXS::draw2d(AcDbVoidPtrArray &ar2d) { draw3d(ar2d); }
|
|
#pragma endregion
|
|
|
|
#pragma region LCS
|
|
void LCS::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double H, L, W, L1, L2, L3, H1, H2, H3, a;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(H);
|
|
GETXDATA(L);
|
|
GETXDATA(W);
|
|
GETXDATA(L1);
|
|
GETXDATA(L2);
|
|
GETXDATA(L3);
|
|
GETXDATA(H1);
|
|
GETXDATA(H2);
|
|
GETXDATA(H3);
|
|
GETXDATA(a);
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(LCS);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
double dr(H3 * .5);
|
|
double B1(H / tan(a));
|
|
double B2(L - B1);
|
|
|
|
// 画第一个轴
|
|
AcGePoint3d pt1, pt2, pt3;
|
|
AcGePoint3d pt(Pos + Z * H2);
|
|
pt += Y * W * .5;
|
|
pSolid = drawCylinder(-Y * W, pt, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt1 = pt;
|
|
|
|
// 第二个轴
|
|
pt = Pos;
|
|
pt -= Z * H;
|
|
pt += X * B1;
|
|
pt += Z * H3;
|
|
pt += Y * W * .5;
|
|
pSolid = drawCylinder(-Y * W, pt, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt2 = pt;
|
|
|
|
// 第三个轴
|
|
pt += X * (B2 - L3);
|
|
pSolid = drawCylinder(-Y * W, pt, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt3 = pt;
|
|
|
|
// 卸料管
|
|
pt = Pos;
|
|
pt += Z * H2 * .5;
|
|
pSolid = drawCylinder(-Z * (H1 + H2 * .5), pt, L2 * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 传送带
|
|
AcGeVector3d vtX(pt2 - pt1);
|
|
AcGeVector3d vtZ(vtX);
|
|
vtZ.rotateBy(-PI * .5, Y);
|
|
vtZ.normalize();
|
|
vtZ *= 1;
|
|
pSolid = drawBox(CoreTools::MidPt(pt1, pt2) - Y * W * .5, vtZ, vtX, pt2.distanceTo(pt1), W);
|
|
if (pSolid)
|
|
{
|
|
vtZ.normalize();
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(vtZ * dr);
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(-vtZ * 2 * dr);
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pSolid = drawBox(CoreTools::MidPt(pt2, pt3) - Y * W * .5, Z, X, pt2.distanceTo(pt3), W);
|
|
if (pSolid)
|
|
{
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(Z * dr);
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(-Z * 2 * dr);
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
// 罩子
|
|
{
|
|
double r = L2 * .5, dW(W * 1.5);
|
|
double dH2(H2 + r * 1.5);
|
|
AcGePoint3d pt0(Pos);
|
|
pt0 -= X * r;
|
|
AcGePoint3d pt1 = pt0 + X * 2 * r;
|
|
AcGePoint3d pt2 = pt1 + Z * dH2;
|
|
AcGePoint3d pt3 = pt2 - X * r;
|
|
AcGePoint3d pt4 = pt0 + Z * (dH2 - r);
|
|
AcDbVoidPtrArray ar;
|
|
ar.append(new AcDbLine(pt0, pt1));
|
|
ar.append(new AcDbLine(pt1, pt2));
|
|
ar.append(new AcDbLine(pt2, pt3));
|
|
ar.append(new AcDbLine(pt0, pt4));
|
|
ar.append(new AcDbArc(Pos + Z * (dH2 - r), -Y, r, PI * .5, PI));
|
|
|
|
AcDbRegion *pReg = CoreTools::createRegion(ar);
|
|
deleteArrayVoidPtrs< AcDbEntity>(ar);
|
|
if (pReg)
|
|
{
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(-Y * dW * .5);
|
|
pReg->transformBy(mat);
|
|
pSolid = drawExtruded(pReg, Y * dW);
|
|
if (pSolid)
|
|
{
|
|
ar.removeAll();
|
|
r -= 2; dW -= 2; dH2 -= 2;
|
|
pt0 = Pos;
|
|
pt0 -= X * r;
|
|
pt1 = pt0 + X * (r + r + 2);
|
|
pt2 = pt1 + Z * dH2;
|
|
pt3 = pt2 - X * (r + 2);
|
|
pt4 = pt0 + Z * (dH2 - r);
|
|
ar.append(new AcDbLine(pt0, pt1));
|
|
ar.append(new AcDbLine(pt1, pt2));
|
|
ar.append(new AcDbLine(pt2, pt3));
|
|
ar.append(new AcDbLine(pt0, pt4));
|
|
ar.append(new AcDbArc(Pos + Z * (dH2 - r), -Y, r, PI * .5, PI));
|
|
AcDbRegion *pReg1 = CoreTools::createRegion(ar);
|
|
deleteArrayVoidPtrs< AcDbEntity>(ar);
|
|
if (pReg1)
|
|
{
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(-Y * dW * .5);
|
|
pReg1->transformBy(mat);
|
|
AcDb3dSolid *pSolid1 = drawExtruded(pReg1, Y * dW);
|
|
if (pSolid1)
|
|
{
|
|
if (!pSolid->booleanOper(AcDb::kBoolSubtract, pSolid1) == Acad::eOk)
|
|
DELETE_PTR(pSolid1);
|
|
ar3d.append(pSolid);
|
|
}
|
|
DELETE_PTR(pReg1);
|
|
}
|
|
}
|
|
DELETE_PTR(pReg);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
void LCS::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
}
|
|
|
|
namespace LUOXUANBENG
|
|
{
|
|
#pragma region LXB
|
|
void LXB::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, d, seta, L1, L2, L3, P;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(d);
|
|
GETXDATA(P);
|
|
GETXDATA(L1);
|
|
GETXDATA(L2);
|
|
GETXDATA(L3);
|
|
GETXDATA(seta);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(LXB);
|
|
|
|
AcGeVector3d X(Dir), Y(AcGeVector3d::kYAxis);
|
|
X.rotateBy(seta, Y);
|
|
AcGeVector3d Z(X);
|
|
Z.rotateBy(PI * .5, -Y);
|
|
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
Pos += Z * D * .5;
|
|
|
|
// 传动轴
|
|
pSolid = drawCylinder(X * (200 + L1 + L2 + L3), Pos - X * 200, d * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 电机
|
|
drawDianJi(Pos - X * 200, -X, 150, ar3d);
|
|
|
|
// 套轴
|
|
pSolid = drawCylinder(X * (L1 + L2 + L3 * .5), Pos + X * L3 * .5, d * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 支架
|
|
pSolid = drawCylinder(-AcGeVector3d::kZAxis * (D * .5 / cos(seta)), Pos, d * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 螺纹
|
|
int count = 10;
|
|
int delta = (int)(L2 / count);
|
|
double a(CoreTools::A2R(30));
|
|
double r(D * .5 / cos(a));
|
|
AcGeVector3d vtN(Z);
|
|
vtN.rotateBy((PI * .5 - a), Y);
|
|
AcGePoint3d pt(Pos + X * L3);
|
|
AcDbCircle *pCir = new AcDbCircle(pt, vtN, r);
|
|
AcDbRegion *pReg = CoreTools::createRegion(pCir);
|
|
DELETE_PTR(pCir);
|
|
if (pReg)
|
|
{
|
|
pSolid = drawExtruded(pReg, X * 1);
|
|
if (pSolid)
|
|
{
|
|
ar3d.append(pSolid);
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(X * delta);
|
|
for (int i = 1; i < count; ++i)
|
|
{
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
DELETE_PTR(pReg);
|
|
}
|
|
|
|
}
|
|
void LXB::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
}
|
|
|
|
namespace ZHAMEN
|
|
{
|
|
|
|
#pragma region RectZhaMen
|
|
void RectZhaMen::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double A, H, T;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(H);
|
|
GETXDATA(A);
|
|
GETXDATA(T);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(RectZhaMen);
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
|
|
pSolid = drawBox(Pos, Z * A, X, A - 2 * T, T);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
AcGePoint3d pt1(Pos + X * .5 * (A - T)), pt2(Pos - X * .5 * (A - T));
|
|
pSolid = drawBox(pt1, Z * H, X, T, T);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawBox(pt2, Z * H, X, T, T);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
void RectZhaMen::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region CircleZhaMen
|
|
void CircleZhaMen::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double A, H, I, C, T;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(H);
|
|
GETXDATA(A);
|
|
GETXDATA(I);
|
|
GETXDATA(C);
|
|
GETXDATA(T);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(RectZhaMen);
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
|
|
double R(H - C - I);
|
|
double r(R / 3);
|
|
|
|
AcGePoint3d pt0(AcGePoint3d::kOrigin - AcGeVector3d::kXAxis * A * .5);
|
|
pt0 += AcGeVector3d::kYAxis * r;
|
|
AcGePoint3d pt1(pt0 + AcGeVector3d::kYAxis * (C + (R - r)));
|
|
AcGePoint3d pt2(pt1 + AcGeVector3d::kYAxis * I);
|
|
pt2 += AcGeVector3d::kXAxis * I;
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToMirroring(AcGeLine3d(AcGePoint3d::kOrigin, AcGePoint3d::kOrigin + AcGeVector3d::kYAxis * H));
|
|
|
|
AcGePoint3d pt3(pt2);
|
|
pt3.transformBy(mat);
|
|
|
|
AcGePoint3d pt4(pt1);
|
|
pt4.transformBy(mat);
|
|
|
|
AcGePoint3d pt5(pt0);
|
|
pt5.transformBy(mat);
|
|
|
|
AcGePoint3d pt6(AcGePoint3d::kOrigin);
|
|
|
|
AcDbVoidPtrArray ar;
|
|
ar.append(new AcDbLine(pt0, pt1));
|
|
ar.append(new AcDbArc(pt1 + AcGeVector3d::kYAxis * I, AcGeVector3d::kZAxis, I, PI * 1.5, 0));
|
|
ar.append(new AcDbLine(pt2, pt3));
|
|
ar.append(new AcDbArc(pt4 + AcGeVector3d::kYAxis * I, AcGeVector3d::kZAxis, I, PI, 1.5 * PI));
|
|
ar.append(new AcDbLine(pt4, pt5));
|
|
double alpha(asin((R - r) / R));
|
|
AcDbArc *arc = new AcDbArc(AcGePoint3d::kOrigin + AcGeVector3d::kYAxis * R, AcGeVector3d::kZAxis, R, PI + alpha, - alpha);
|
|
ar.append(arc);
|
|
AcGePoint3d pts, pte;
|
|
arc->getStartPoint(pts);
|
|
arc->getEndPoint(pte);
|
|
ar.append(new AcDbLine(pt0, pts));
|
|
ar.append(new AcDbLine(pt5, pte));
|
|
|
|
AcDbRegion *pReg = CoreTools::createRegion(ar);
|
|
if (!pReg)
|
|
{
|
|
#ifndef NDEBUG
|
|
for (int i = 0; i < ar.length(); ++i)
|
|
{
|
|
CoreTools::CloneAndAddToModelSpace((AcDbEntity*)ar[i]);
|
|
}
|
|
#endif
|
|
deleteArrayVoidPtrs< AcDbEntity>(ar);
|
|
acutPrintf(_T("\n创建截面失败,请检查参数!"));
|
|
return;
|
|
}
|
|
deleteArrayVoidPtrs< AcDbEntity>(ar);
|
|
|
|
pSolid = drawExtruded(pReg, AcGeVector3d::kZAxis * T);
|
|
DELETE_PTR(pReg);
|
|
if (!pSolid)
|
|
{
|
|
DELETE_PTR(pSolid);
|
|
return;
|
|
}
|
|
|
|
AcDb3dSolid *pSubSolid = drawCylinder(AcGeVector3d::kZAxis * T, AcGePoint3d::kOrigin + AcGeVector3d::kYAxis * R, R);
|
|
if (pSubSolid)
|
|
{
|
|
if (pSolid->booleanOper(AcDb::kBoolSubtract, pSubSolid) != Acad::eOk)
|
|
DELETE_PTR(pSubSolid);
|
|
}
|
|
|
|
AcGeMatrix3d mat1;
|
|
mat1.setToAlignCoordSys(AcGePoint3d::kOrigin, AcGeVector3d::kXAxis, AcGeVector3d::kYAxis, AcGeVector3d::kZAxis, Pos, X, Z, Y);
|
|
|
|
pSubSolid = drawCylinder(AcGeVector3d::kZAxis * T, AcGePoint3d::kOrigin + AcGeVector3d::kYAxis * R, R);
|
|
if (pSubSolid)
|
|
{
|
|
// 闸门 绕Y转45度
|
|
mat.setToIdentity();
|
|
mat.setToRotation(CoreTools::A2R(10), AcGeVector3d::kYAxis);
|
|
pSubSolid->transformBy(mat);
|
|
pSubSolid->transformBy(mat1);
|
|
ar3d.append(pSubSolid);
|
|
}
|
|
|
|
pSolid->transformBy(mat1);
|
|
ar3d.append(pSolid);
|
|
|
|
}
|
|
void CircleZhaMen::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region ShengNiFa
|
|
void ShengNiFa::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double h, H, DN, D3, T;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(H);
|
|
GETXDATA(h);
|
|
GETXDATA(DN);
|
|
GETXDATA(D3);
|
|
GETXDATA(T);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(RectZhaMen);
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
|
|
double R(D3 * .5), r(DN * .5);
|
|
AcGePoint3d pt0(Pos - Z * h);
|
|
pt0 -= X * R;
|
|
AcGePoint3d pt1(pt0 + Z * T);
|
|
AcGePoint3d pt2(pt1 + X * (R - r - T));
|
|
AcGePoint3d pt3(pt2 + Z * (h - 2 * T));
|
|
AcGePoint3d pt4(pt3 - X * (R - r - T));
|
|
AcGePoint3d pt5(pt4 + Z * T);
|
|
AcGePoint3d pt6(pt5 + X * (R - r));
|
|
AcGePoint3d pt7(pt6 - Z * h);
|
|
|
|
AcDbRegion *pReg = makeRegion2(8, pt0, pt1, pt2, pt3, pt4, pt5, pt6, pt7);
|
|
if (!pReg) return;
|
|
|
|
pSolid = drawRevolved(pReg, Pos, Z);
|
|
DELETE_PTR(pReg);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
double hh(H - h);
|
|
pt0 = Pos - X * R;
|
|
pt1 = pt0 + Z * (hh - R);
|
|
pt2 = pt1 + X * (R- r);
|
|
pt3 = pt2 + X * 2 * r;
|
|
pt4 = pt3 + X * (R - r);
|
|
pt5 = pt4 - Z * (hh - R);
|
|
pt6 = pt5 - X * (R - r);
|
|
pt7 = pt0 + X * (R - r);
|
|
|
|
AcDbVoidPtrArray ar;
|
|
ar.append(new AcDbLine(pt7, pt0));
|
|
ar.append(new AcDbLine(pt0, pt1));
|
|
ar.append(new AcDbLine(pt7, pt2));
|
|
ar.append(new AcDbLine(pt6, pt3));
|
|
ar.append(new AcDbLine(pt6, pt5));
|
|
ar.append(new AcDbLine(pt5, pt4));
|
|
ar.append(new AcDbArc(Pos + Z * (hh - R), Y, r, 0, PI));
|
|
ar.append(new AcDbArc(Pos + Z * (hh - R), Y, R, 0, PI));
|
|
|
|
pReg = CoreTools::createRegion(ar);
|
|
if (!pReg)
|
|
{
|
|
#ifndef NDEBUG
|
|
for (int i = 0; i < ar.length(); ++i)
|
|
{
|
|
CoreTools::CloneAndAddToModelSpace((AcDbEntity*)ar[i]);
|
|
}
|
|
#endif
|
|
deleteArrayVoidPtrs< AcDbEntity>(ar);
|
|
return;
|
|
}
|
|
deleteArrayVoidPtrs< AcDbEntity>(ar);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(-Y * (R - r) * .5);
|
|
pReg->transformBy(mat);
|
|
pSolid = drawExtruded(pReg, Y * (R - r));
|
|
DELETE_PTR(pReg);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(-Z * h * .25, Pos - Z * .25 * h, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(-Z * (h * .25 + hh), Pos + Z * hh, (R - r) * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
void ShengNiFa::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
}
|
|
|
|
namespace GUANIJI
|
|
{
|
|
#pragma region XZG
|
|
void XZG::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double fai, H, W, a;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(fai);
|
|
GETXDATA(H);
|
|
GETXDATA(W);
|
|
GETXDATA(a);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(XZG);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 顶板
|
|
pSolid = drawBox(Pos, Z * 100, X, fai, W);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 栏杆
|
|
drawLanGan(Pos, X, fai, W, ar3d);
|
|
|
|
// 电机
|
|
drawDianJi(Pos + Z * 100, Z, 200, ar3d);
|
|
|
|
double dL(500), dW(250); // 刮泥板尺寸
|
|
H -= dW;
|
|
|
|
// 传动轴
|
|
pSolid = drawCylinder(-Z * H, Pos, 50);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 刮臂
|
|
AcGePoint3d pt, pt1, pt2; // 刮臂端点
|
|
{
|
|
double len(fai * .5 / cos(a));
|
|
AcDbLine line1, line2; // 两条刮臂路径直线
|
|
pt = Pos - Z * (H - 10);
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
line1.setStartPoint(pt);
|
|
line1.setEndPoint(pt + (vt * len));
|
|
pt1 = pt + (vt * fai * .25);
|
|
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
line2.setStartPoint(pt);
|
|
line2.setEndPoint(pt + (vt * len));
|
|
pt2 = pt + (vt * fai * .25);
|
|
}
|
|
|
|
// 吊线
|
|
{
|
|
AcGePoint3d ptM = Pos - Z * H * .5;
|
|
pSolid = drawCylinder(pt1 - ptM, ptM, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(pt2 - ptM, ptM, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 刮泥板
|
|
|
|
double dSp(((dL * .5) / sin(PI * .25)) * 2);
|
|
int num(int((fai - dSp) / dSp));
|
|
pt = Pos - Z * (H + dW * .5);
|
|
//pt += X * (fai * .5 - dSp * .5);
|
|
pSolid = drawBox(pt, X * 1, Y, dL, dW);
|
|
if (pSolid)
|
|
{
|
|
AcGeMatrix3d mat, mat1;
|
|
mat.setToRotation(PI * .25, Z, pt);
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
int count((int)(fai * .5 * cos(a) / dSp));
|
|
|
|
double dist(dSp);
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
dist = dSp;
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
}
|
|
}
|
|
void XZG::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region CZG
|
|
void CZG::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double fai, H, W, a;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(fai);
|
|
GETXDATA(H);
|
|
GETXDATA(W);
|
|
GETXDATA(a);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(CZG);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 顶板
|
|
pSolid = drawBox(Pos + X * fai *.25, Z * 100, X, fai * .5, W);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 栏杆
|
|
drawLanGan(Pos + X * fai *.25, X, fai * .5, W, ar3d);
|
|
// 电机
|
|
drawDianJi(Pos + Z * 100, Z, 200, ar3d);
|
|
// 轴
|
|
pSolid = drawCylinder(-Z * H, Pos, 50);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 臂
|
|
AcGePoint3d pt;
|
|
double dSlabW(100), dSlabH(100);// 刮泥板 和 撇渣板 相同尺寸
|
|
{
|
|
double len(fai * .5 / cos(a));
|
|
pt = Pos - Z * (H - dSlabH);
|
|
AcGeVector3d vt(X), vt1(Z);
|
|
vt.rotateBy(a, -Y);
|
|
vt1.rotateBy(a, -Y);
|
|
pSolid = drawBox(pt + vt * len * .5, vt1 * 10, vt, len, W * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
vt1 = Z;
|
|
vt1.rotateBy(a, Y);
|
|
pSolid = drawBox(pt + vt * len * .5, vt1 * 10, vt, len, W * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 刮板
|
|
{
|
|
double len(fai * .5 / cos(a));
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
pt = Pos - Z * (H - dSlabH *.5);
|
|
pSolid = drawBox(pt + vt * len * .5, Y * 1, vt, len, dSlabW);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
pSolid = drawBox(pt + vt * len * .5, Y * 1, vt, len, dSlabW);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
// 筒
|
|
double dh(250);
|
|
{
|
|
pSolid = drawCylinder(-Z * H * .5, Pos - Z * dh, fai / 8);
|
|
if (pSolid)
|
|
{
|
|
AcDb3dSolid *pSolid1 = drawCylinder(-Z * H * .5, Pos - Z * dh, fai / 8 - 10);
|
|
if (pSolid1)
|
|
{
|
|
if (pSolid->booleanOper(AcDb::kBoolSubtract, pSolid1) != Acad::eOk)
|
|
DELETE_PTR(pSolid1);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
}
|
|
// 撇渣
|
|
double dl = (3 * fai) / 8;
|
|
{
|
|
pt = Pos - Z * dh;
|
|
pt -= X * (fai / 8);
|
|
pt -= X * dl * .5;
|
|
pSolid = drawBox(pt, Y * 5, X, dl, dSlabW);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
// 支架
|
|
{
|
|
pt = Pos - Z * (dh + dSlabH * .5);
|
|
pt -= X * (fai / 8);
|
|
double dHH(H - dh - 1.5 * dSlabH); // 画到刮板上沿
|
|
double dSp(3 * fai / 8 / 4);
|
|
double dist(dSp);
|
|
for (int i = 0; i < 3; ++i)
|
|
{
|
|
pSolid = drawCylinder(-Z * (dHH - (dist + fai / 8) * tan(a)), pt - X * dist, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
dist += dSp;
|
|
}
|
|
|
|
}
|
|
}
|
|
void CZG::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region ZG
|
|
void ZG::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double fai, H, W, a;
|
|
int Half;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(fai);
|
|
GETXDATA(H);
|
|
GETXDATA(W);
|
|
GETXDATA(a);
|
|
GETXDATA(Half);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(ZG);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 顶板
|
|
{
|
|
double dL(fai);
|
|
AcGePoint3d pt(Pos);
|
|
if (Half)
|
|
{
|
|
pt = Pos + X * fai * .25;
|
|
dL = fai * .5;
|
|
}
|
|
pSolid = drawBox(pt, Z * 100, X, dL, W);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 栏杆
|
|
drawLanGan(pt, X, dL, W, ar3d);
|
|
}
|
|
// 电机
|
|
drawDianJi(Pos + Z * 100, Z, 200, ar3d);
|
|
|
|
double dL(500), dW(250); // 刮板数据
|
|
H -= dW;
|
|
// 轴
|
|
pSolid = drawCylinder(-Z * H, Pos, 50);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 臂
|
|
double len(fai * .5 / cos(a));
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
AcGePoint3d pt(Pos - Z * (H - 10));
|
|
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
|
|
// 刮板
|
|
{
|
|
double dSp(((dL * .5) / sin(PI * .25)) * 2);
|
|
int num(int((fai - dSp) / dSp));
|
|
pt = Pos - Z * (H + dW * .5);
|
|
pSolid = drawBox(pt, X * 1, Y, dL, dW);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI * .25, Z, pt);
|
|
pSolid->transformBy(mat);
|
|
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
int count((int)(fai * .5 * cos(a) / dSp));
|
|
|
|
double dist(dSp);
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
dist = dSp;
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
}
|
|
|
|
// 筒
|
|
double dSlabW(100);
|
|
double dh(250);
|
|
{
|
|
pSolid = drawCylinder(-Z * H * .5, Pos - Z * dh, fai / 8);
|
|
if (pSolid)
|
|
{
|
|
AcDb3dSolid *pSolid1 = drawCylinder(-Z * H * .5, Pos - Z * dh, fai / 8 - 10);
|
|
if (pSolid1)
|
|
{
|
|
if (pSolid->booleanOper(AcDb::kBoolSubtract, pSolid1) != Acad::eOk)
|
|
DELETE_PTR(pSolid1);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
}
|
|
// 撇渣
|
|
{
|
|
AcGeLine3d line(Pos, Pos - Z * H);
|
|
AcGeMatrix3d rot;
|
|
rot.setToMirroring(line);
|
|
|
|
double dl = (3 * fai) / 8;
|
|
pt = Pos - Z * dh;
|
|
pt -= X * (fai / 8);
|
|
pt -= X * dl * .5;
|
|
pSolid = drawBox(pt, Y * 5, X, dl, dSlabW);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
if (!Half && pSolid != NULL)
|
|
{
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(rot);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 支架
|
|
pt = Pos - Z * (dh + dSlabW * .5);
|
|
pt -= X * (fai / 8);
|
|
double dHH(H - dh - dSlabW * .5);
|
|
double dSp(3 * fai / 8 / 4);
|
|
double dist(dSp);
|
|
for (int i = 0; i < 3; ++i)
|
|
{
|
|
pSolid = drawCylinder(-Z * (dHH - (dist + fai / 8) * tan(a)), pt - X * dist, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
dist += dSp;
|
|
}
|
|
|
|
if (!Half)
|
|
{
|
|
pt = Pos - Z * (dh + dSlabW * .5);
|
|
pt += X * (fai / 8);
|
|
double dHH(H - dh - dSlabW * .5);
|
|
double dSp(3 * fai / 8 / 4);
|
|
double dist(dSp);
|
|
for (int i = 0; i < 3; ++i)
|
|
{
|
|
pSolid = drawCylinder(-Z * (dHH - (dist + fai / 8) * tan(a)), pt + X * dist, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
dist += dSp;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
void ZG::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region QG
|
|
void QG::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double G, W, W1;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(W);
|
|
GETXDATA(W1);
|
|
GETXDATA(G);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(QG);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 板
|
|
double dr(150);
|
|
pSolid = drawBox(Pos + Z * 2 * dr, Z * 100, X, W, W1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 轮子 半径 W/8 厚 100
|
|
{
|
|
AcGePoint3d pt0, pt1, pt2, pt3;
|
|
getRect(Pos + Z * dr * 2, X, W, W1, pt0, pt1, pt2, pt3);
|
|
|
|
pt0 += Y * dr; pt0 -= Z * dr;
|
|
pt3 -= Y * dr; pt3 -= Z * dr;
|
|
pt1 += Y * dr; pt1 -= Z * dr;
|
|
pt2 -= Y * dr; pt2 -= Z * dr;
|
|
|
|
pSolid = drawCylinder(-X * 100, pt0, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt1, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt2, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-X * 100, pt3, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt0.distanceTo(pt1), pt0, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt3.distanceTo(pt2), pt3, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 刮泥板
|
|
AcGePoint3d pt(Pos + Z * dr * 2);
|
|
pt -= Z * G * .5;
|
|
pSolid = drawBox(pt, Y * 1, X, W, G);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
void QG::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region PJ
|
|
void PJ::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double H, W, W1;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(W);
|
|
GETXDATA(W1);
|
|
GETXDATA(H);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(PJ);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 板
|
|
double dr(150);
|
|
pSolid = drawBox(Pos + Z * 2 * dr, Z * 100, X, W, W1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 栏杆
|
|
drawLanGan(Pos + Z * 2 * dr, X, W, W1, ar3d);
|
|
|
|
// 轮子
|
|
{
|
|
AcGePoint3d pt0, pt1, pt2, pt3;
|
|
getRect(Pos + Z * dr * 2, X, W, W1, pt0, pt1, pt2, pt3);
|
|
|
|
pt0 += Y * dr; pt0 -= Z * dr;
|
|
pt3 -= Y * dr; pt3 -= Z * dr;
|
|
pt1 += Y * dr; pt1 -= Z * dr;
|
|
pt2 -= Y * dr; pt2 -= Z * dr;
|
|
|
|
pSolid = drawCylinder(-X * 100, pt0, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt1, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt2, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-X * 100, pt3, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt0.distanceTo(pt1), pt0, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt3.distanceTo(pt2), pt3, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 撇渣
|
|
{
|
|
AcGePoint3d pt0(Pos + Z * dr * 2);
|
|
pt0 -= X * W * .5;
|
|
pt0 += X * W / 3;
|
|
AcGePoint3d pt1(pt0);
|
|
pt1 += X * W / 3;
|
|
|
|
pSolid = drawCylinder(-Z * dr * 4, pt0, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(-Z * dr * 4, pt1, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt0 -= Z * 4 * dr;
|
|
pt1 -= Z * 4 * dr;
|
|
|
|
pSolid = drawCylinder(Y * dr * 6, pt0, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Y * dr * 6, pt1, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt0 += Y * dr * 6;
|
|
|
|
pt1 += Y * dr * 6;
|
|
|
|
AcGePoint3d pt(CoreTools::MidPt(pt0, pt1));
|
|
pSolid = drawBox(pt, Y* 1, X, W, 200);
|
|
if (pSolid)
|
|
{
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(-PI / 4, pt0 - pt1, pt0);
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
|
|
// 刮泥
|
|
{
|
|
AcGePoint3d pt0(Pos + Z * dr * 2);
|
|
pt0 -= X * W * .5;
|
|
pt0 += X * W / 3;
|
|
AcGePoint3d pt1(pt0);
|
|
pt1 += X * W / 3;
|
|
|
|
pt0 -= Y * W1 / 4;
|
|
pt1 -= Y * W1 / 4;
|
|
|
|
pSolid = drawCylinder(-Z * dr * 4, pt0, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(-Z * dr * 4, pt1, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt0 -= Z * 4 * dr;
|
|
pt1 -= Z * 4 * dr;
|
|
|
|
double dh(200);
|
|
AcGeVector3d vt(Y);
|
|
vt.rotateBy(PI / 4, -X);
|
|
vt.normalize();
|
|
vt *= (H - dh - 2 * dr) / cos(PI / 4);
|
|
|
|
pSolid = drawCylinder(vt, pt0, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(vt, pt1, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt0 += vt;
|
|
pt1 += vt;
|
|
|
|
pSolid = drawCylinder(Y * dh, pt0, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(Y * dh, pt1, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt0 += Y * dh;
|
|
pt0 -= Z * dh * .5;
|
|
pt1 += Y * dh;
|
|
pt1 -= Z * dh * .5;
|
|
|
|
AcGePoint3d pt(CoreTools::MidPt(pt0, pt1));
|
|
pSolid = drawBox(pt, Y * 1, X, W, 200);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
{
|
|
AcGePoint3d pt(Pos + Z * (2 * dr + 100));
|
|
pt += Z * 100;
|
|
pt += X * 500;
|
|
drawDianJi(pt, X, 100, ar3d);
|
|
pt -= X * 500;
|
|
|
|
pt -= Y * W1 / 4;
|
|
pt -= X * 500;
|
|
drawDianJi(pt, -X, 100, ar3d);
|
|
//drawDianJi();
|
|
}
|
|
}
|
|
void PJ::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region SX
|
|
void SX::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double L, H, Lk, W1;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(L);
|
|
GETXDATA(Lk);
|
|
GETXDATA(W1);
|
|
GETXDATA(H);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(SX);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 板
|
|
double dr(150);
|
|
pSolid = drawBox(Pos + Z * 2 * dr, Z * 100, X, L, W1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 栏杆
|
|
drawLanGan(Pos + Z * 2 * dr, X, L, W1, ar3d);
|
|
|
|
// 轮子
|
|
{
|
|
AcGePoint3d pt0, pt1, pt2, pt3;
|
|
getRect(Pos + Z * dr * 2, X, Lk, W1, pt0, pt1, pt2, pt3);
|
|
|
|
pt0 += Y * dr; pt0 -= Z * dr;
|
|
pt3 -= Y * dr; pt3 -= Z * dr;
|
|
pt1 += Y * dr; pt1 -= Z * dr;
|
|
pt2 -= Y * dr; pt2 -= Z * dr;
|
|
|
|
pSolid = drawCylinder(-X * 100, pt0, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt1, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt2, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-X * 100, pt3, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt0.distanceTo(pt1), pt0, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt3.distanceTo(pt2), pt3, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 横向主管 半径 100
|
|
{
|
|
AcGePoint3d pt(Pos + Z * (2 * dr - 100));
|
|
pt -= X * L * .5;
|
|
pSolid = drawCylinder(X * L, pt, 100);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 吸盘 80 x 30 cm 间距 1m 半径 50
|
|
{
|
|
double dL(800), dW(300), dS(1000), r(50);
|
|
int count = int((Lk - 1 * dS) / 1000);
|
|
AcGePoint3d pt(Pos + Z * 2 * dr);
|
|
pt -= X * Lk * .5;
|
|
pt += X * dS;
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
pSolid = drawCylinder(-Z * H, pt, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawBox(pt - Z * H, Z * 100, X, dL, dW);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt += X * dS;
|
|
}
|
|
}
|
|
}
|
|
void SX::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region SB
|
|
void SB::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double L, H, Lk, W1;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(L);
|
|
GETXDATA(Lk);
|
|
GETXDATA(W1);
|
|
GETXDATA(H);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(SB);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 板
|
|
double dr(150);
|
|
pSolid = drawBox(Pos + Z * 2 * dr, Z * 100, X, L, W1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 栏杆
|
|
drawLanGan(Pos + Z * 2 * dr, X, L, W1, ar3d);
|
|
|
|
// 轮子
|
|
{
|
|
AcGePoint3d pt0, pt1, pt2, pt3;
|
|
getRect(Pos + Z * dr * 2, X, Lk, W1, pt0, pt1, pt2, pt3);
|
|
|
|
pt0 += Y * dr; pt0 -= Z * dr;
|
|
pt3 -= Y * dr; pt3 -= Z * dr;
|
|
pt1 += Y * dr; pt1 -= Z * dr;
|
|
pt2 -= Y * dr; pt2 -= Z * dr;
|
|
|
|
pSolid = drawCylinder(-X * 100, pt0, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt1, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(X * 100, pt2, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-X * 100, pt3, dr);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt0.distanceTo(pt1), pt0, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * pt3.distanceTo(pt2), pt3, dr * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 电机
|
|
AcGePoint3d ptDJ0, ptDJ1;
|
|
{
|
|
AcGePoint3d pt0(Pos + Z * (2 * dr + 100)), pt1(Pos + Z * (2 * dr + 100));
|
|
pt0 -= X * Lk * .25;
|
|
pt1 += X * Lk * .25;
|
|
drawDianJi(pt0, Z, 200, ar3d);
|
|
drawDianJi(pt1, Z, 200, ar3d);
|
|
ptDJ0 = pt0;
|
|
ptDJ1 = pt1;
|
|
}
|
|
|
|
// 横向主管 半径 100
|
|
{
|
|
AcGePoint3d pt(Pos + Z * (2 * dr - 100));
|
|
pt -= X * L * .25;
|
|
pSolid = drawCylinder(X * L * .75, pt, 100);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 竖管 + 泵
|
|
{
|
|
pSolid = drawCylinder(-Z * H, ptDJ0, 50);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-Z * H, ptDJ1, 50);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
drawPump(ptDJ0 - Z * H * .5, Z, ar3d);
|
|
drawPump(ptDJ1 - Z * H * .5, Z, ar3d);
|
|
}
|
|
|
|
// 吸盘
|
|
{
|
|
AcGePoint3d pt0(ptDJ0 - Z * H), pt1(ptDJ1 - Z * H);
|
|
double dl(Lk * .5 * .8);
|
|
pSolid = drawBox(pt0, Z * 200, X, dl, 500);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawBox(pt1, Z * 200, X, dl, 500);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 支架
|
|
{
|
|
AcGePoint3d pt0(ptDJ0 - X * Lk / 8);
|
|
AcGePoint3d pt1(pt0 + X * Lk / 4);
|
|
AcGePoint3d pt2(pt1 + X * Lk / 4);
|
|
AcGePoint3d pt3(pt2 + X * Lk / 4);
|
|
|
|
pSolid = drawCylinder(-Z * H, pt0, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-Z * H, pt1, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-Z * H, pt2, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-Z * H, pt3, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
}
|
|
void SB::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region LIANTIAO
|
|
void LIANTIAO::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE), LEFT(FALSE), DianJi(FALSE);
|
|
|
|
double L, L1, L2, L3, B, R, H, H1, W;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(L);
|
|
GETXDATA(L1);
|
|
GETXDATA(L2);
|
|
GETXDATA(B);
|
|
GETXDATA(R);
|
|
GETXDATA(H);
|
|
GETXDATA(H1);
|
|
GETXDATA(W);
|
|
GETXDATA(L3);
|
|
GETXDATA(LEFT);
|
|
GETXDATA(DianJi);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(LIANTIAO);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL), *pSolid1(NULL), *pSolid2(NULL);
|
|
|
|
AcGePoint3d pt1(Pos - X * (L * .5 - L1));
|
|
pt1 += Z * (B + R);
|
|
AcGePoint3d pt2(Pos + X * (L * .5 - L2));
|
|
pt2 += Z * (B + R);
|
|
AcGePoint3d pt3(pt2 + Z * (H1 - (B + R)));
|
|
AcGePoint3d pt4(pt1 + Z * (H1 - (B + R)));
|
|
|
|
AcGeMatrix3d mat;
|
|
// 四个转动轴
|
|
{
|
|
pSolid = drawCylinder(-Y * L3, pt1 + Y * (W * .5), R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-Y * L3, pt2 + Y * (W * .5), R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-Y * L3, pt3 + Y * (W * .5), R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-Y * L3, pt4 + Y * (W * .5), R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Y * L3, pt1 - Y * (W * .5), R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(Y * L3, pt2 - Y * (W * .5), R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(Y * L3, pt3 - Y * (W * .5), R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(Y * L3, pt4 - Y * (W * .5), R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Y * W, pt1 - Y * W * .5, R * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(Y * W, pt2 - Y * W * .5, R * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(Y * W, pt3 - Y * W * .5, R * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(Y * W, pt4 - Y * W * .5, R * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
// 传动带
|
|
{
|
|
// 横四条
|
|
pSolid = drawBox(pt1 - Y * (W * .5 - L3 * .5), X * (pt1.distanceTo(pt2)), Y, L3 * .5, 1);
|
|
mat.setToTranslation(-Z * (R - .5));
|
|
pSolid->transformBy(mat);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
//pSolid1 = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToTranslation(Z * (H1 - B + R - 1));
|
|
pSolid1 = cloneAndTransform(pSolid, mat);
|
|
if (pSolid1) ar3d.append(pSolid1);
|
|
|
|
mat.setToTranslation(Y * (W - L3));
|
|
ar3d.append(cloneAndTransform(pSolid, mat));
|
|
ar3d.append(cloneAndTransform(pSolid1, mat));
|
|
|
|
// 竖四条
|
|
pSolid = drawBox(pt1 - Y * (W * .5 - L3 * .5), Z * (pt1.distanceTo(pt4)), Y, L3 * .5, 1);
|
|
mat.setToTranslation(-X * (R - .5));
|
|
pSolid->transformBy(mat);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
mat.setToTranslation(X * (2 * R + pt1.distanceTo(pt2) - 1));
|
|
pSolid1 = cloneAndTransform(pSolid, mat);
|
|
if (pSolid1) ar3d.append(pSolid1);
|
|
|
|
mat.setToTranslation(Y * (W - L3));
|
|
ar3d.append(cloneAndTransform(pSolid, mat));
|
|
ar3d.append(cloneAndTransform(pSolid1, mat));
|
|
}
|
|
|
|
// 刮泥板
|
|
{
|
|
double dS(pt1.distanceTo(pt2) - 2 * R);
|
|
dS *= .5;
|
|
|
|
pSolid = drawBox(pt1, -Z * B, Y, W - L3 * .5, 1);
|
|
mat.setToTranslation(-Z * (R - .5));
|
|
pSolid->transformBy(mat);
|
|
mat.setToTranslation(X * R);
|
|
pSolid->transformBy(mat);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
mat.setToTranslation(X * dS);
|
|
pSolid1 = cloneAndTransform(pSolid, mat);
|
|
ar3d.append(pSolid1);
|
|
pSolid2 = cloneAndTransform(pSolid1, mat);
|
|
ar3d.append(pSolid2);
|
|
|
|
mat.setToTranslation(Z * (pt1.distanceTo(pt4) + 2 * R + B));
|
|
ar3d.append(cloneAndTransform(pSolid, mat));
|
|
ar3d.append(cloneAndTransform(pSolid1, mat));
|
|
ar3d.append(cloneAndTransform(pSolid2, mat));
|
|
}
|
|
|
|
// 电机
|
|
if (DianJi)
|
|
{
|
|
double dDjL(500); // 电机长
|
|
double dR(250); // 电机半径
|
|
AcGePoint3d pt((LEFT ? pt4 : pt3) + Y * (W * .5 + dDjL));
|
|
pt += Z * (H - H1 + dR);
|
|
drawDianJi(pt, -Y, dR, ar3d, dDjL);
|
|
// 传动轴
|
|
pt += -Y * dDjL;
|
|
pSolid = drawCylinder(-Y * (L3 * .25), pt, R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 传动带
|
|
double dW(L3 * .25); // 带宽
|
|
pt -= Y * dW * .5;
|
|
pSolid = drawBox(pt - (X * (R - .5)), -Z * (H - H1 + dR), Y, dW, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawBox(pt + (X * (R - .5)), -Z * (H - H1 + dR), Y, dW, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
}
|
|
void LIANTIAO::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
}
|
|
|
|
namespace NONGSUOJI
|
|
{
|
|
#pragma region NC
|
|
void NC::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, H, W, a;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(H);
|
|
GETXDATA(W);
|
|
GETXDATA(a);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(NC);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 顶板
|
|
{
|
|
double dL(D);
|
|
AcGePoint3d pt(Pos);
|
|
pSolid = drawBox(pt, Z * 100, X, dL, W);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 栏杆
|
|
drawLanGan(pt, X, dL, W, ar3d);
|
|
}
|
|
// 电机
|
|
drawDianJi(Pos + Z * 100, Z, 200, ar3d);
|
|
|
|
double dL(500), dW(250); // 刮板尺寸
|
|
H -= dW;
|
|
// 轴
|
|
pSolid = drawCylinder(-Z * H, Pos, 50);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 臂
|
|
{
|
|
double len(D * .5 * cos(a));
|
|
|
|
AcGePoint3d pt(Pos - Z * (H - 10));
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * 250;
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos - Z * (H - 10);
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * 250;
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos - Z * (H - 10);
|
|
vt = Y;
|
|
vt.rotateBy(a, X);
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * 250;
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos - Z * (H - 10);
|
|
vt = -Y;
|
|
vt.rotateBy(a, -X);
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * 250;
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
}
|
|
// 刮板
|
|
{
|
|
AcGePoint3d pt;
|
|
{
|
|
double dSp(((dL * .5) / sin(PI * .25)) * 2);
|
|
int num(int((D - dSp) / dSp));
|
|
pt = Pos - Z * (H + dW * .5);
|
|
//pt += X * (D * .5 - dSp * .5);
|
|
pSolid = drawBox(pt, X * 1, Y, dL, dW);
|
|
if (pSolid)
|
|
{
|
|
ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI * .25, Z, pt);
|
|
pSolid->transformBy(mat);
|
|
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
int count((int)(D * .5 * cos(a) / dSp));
|
|
|
|
double dist(dSp);
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
dist = dSp;
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
double dL(500), dW(250);
|
|
double dSp(((dL * .5) / sin(PI * .25)) * 2);
|
|
int num(int((D - dSp) / dSp));
|
|
pt = Pos - Z * (H + dW * .5);
|
|
//pt += Y * (D * .5 - dSp * .5);
|
|
pSolid = drawBox(pt, Y * 1, X, dL, dW);
|
|
if (pSolid)
|
|
{
|
|
ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI * .25, Z, pt);
|
|
pSolid->transformBy(mat);
|
|
|
|
AcGeVector3d vt(Y);
|
|
vt.rotateBy(a, X);
|
|
int count((int)(D * .5 * cos(a) / dSp));
|
|
|
|
double dist(dSp);
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
vt = -Y;
|
|
vt.rotateBy(a, -X);
|
|
dist = dSp;
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
double dh(250);
|
|
// 吊线
|
|
{
|
|
double len(D * .5 * cos(a));
|
|
AcGePoint3d pt = Pos - Z * (H * .5 + dh);
|
|
AcGePoint3d pt0 = Pos - Z * H;
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
AcGePoint3d pt1 = pt0 + vt * len;
|
|
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
AcGePoint3d pt2 = pt0 + vt * len;
|
|
|
|
vt = Y;
|
|
vt.rotateBy(a, X);
|
|
AcGePoint3d pt3 = pt0 + vt * len;
|
|
|
|
vt = -Y;
|
|
vt.rotateBy(a, -X);
|
|
AcGePoint3d pt4 = pt0 + vt * len;
|
|
|
|
pSolid = drawCylinder(pt1 - pt, pt, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(pt2 - pt, pt, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(pt3 - pt, pt, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(pt4 - pt, pt, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
}
|
|
|
|
// 筒
|
|
double dSlabW(100);
|
|
{
|
|
pSolid = drawCylinder(-Z * H / 3, Pos - Z * dh, D / 8);
|
|
if (pSolid)
|
|
{
|
|
AcDb3dSolid *pSolid1 = drawCylinder(-Z * H * .5, Pos - Z * dh, D / 8 - 10);
|
|
if (pSolid1)
|
|
{
|
|
if (pSolid->booleanOper(AcDb::kBoolSubtract, pSolid1) != Acad::eOk)
|
|
DELETE_PTR(pSolid1);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
void NC::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region NB
|
|
void NB::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, H, W, a;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(H);
|
|
GETXDATA(W);
|
|
GETXDATA(a);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(NC);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 顶板
|
|
{
|
|
double dL(D * .5);
|
|
AcGePoint3d pt(Pos + X * dL * .5);
|
|
pSolid = drawBox(pt, Z * 100, X, dL, W);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 栏杆
|
|
drawLanGan(pt, X, dL, W, ar3d);
|
|
}
|
|
// 电机
|
|
drawDianJi(Pos + Z * 100, Z, 200, ar3d);
|
|
double dL(500), dW(250); // 刮板尺寸
|
|
H -= dW;
|
|
// 轴
|
|
pSolid = drawCylinder(-Z * H, Pos, 50);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 臂
|
|
{
|
|
double len(D * .5 * cos(a));
|
|
|
|
AcGePoint3d pt(Pos - Z * (H - 10));
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * 250;
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos - Z * (H - 10);
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * 250;
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos - Z * (H - 10);
|
|
vt = Y;
|
|
vt.rotateBy(a, X );
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * 250;
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos - Z * (H - 10);
|
|
vt = -Y;
|
|
vt.rotateBy(a, -X);
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * 250;
|
|
pSolid = drawCylinder(vt * len, pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
}
|
|
// 刮板
|
|
{
|
|
AcGePoint3d pt;
|
|
{
|
|
double dSp(((dL * .5) / sin(PI * .25)) * 2);
|
|
int num(int((D - dSp) / dSp));
|
|
pt = Pos - Z * (H + dW * .5);
|
|
//pt += X * (D * .5 - dSp * .5);
|
|
pSolid = drawBox(pt, X * 1, Y, dL, dW);
|
|
if (pSolid)
|
|
{
|
|
ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI * .25, Z, pt);
|
|
pSolid->transformBy(mat);
|
|
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
int count((int)(D * .5 * cos(a) / dSp));
|
|
|
|
double dist(dSp);
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
dist = dSp;
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
}
|
|
}
|
|
{
|
|
double dL(500), dW(250);
|
|
double dSp(((dL * .5) / sin(PI * .25)) * 2);
|
|
int num(int((D - dSp) / dSp));
|
|
pt = Pos - Z * (H + dW * .5);
|
|
//pt += Y * (D * .5 - dSp * .5);
|
|
pSolid = drawBox(pt, Y * 1, X, dL, dW);
|
|
if (pSolid)
|
|
{
|
|
ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI * .25, Z, pt);
|
|
pSolid->transformBy(mat);
|
|
AcGeVector3d vt(Y);
|
|
vt.rotateBy(a, X);
|
|
int count((int)(D * .5 * cos(a) / dSp));
|
|
|
|
double dist(dSp);
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
vt = -Y;
|
|
vt.rotateBy(a, -X);
|
|
dist = dSp;
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
AcDb3dSolid *p = (AcDb3dSolid*)pSolid->clone();
|
|
mat.setToIdentity();
|
|
mat.setToTranslation(vt * (dist / cos(a)));
|
|
p->transformBy(mat);
|
|
ar3d.append(p);
|
|
dist += dSp;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// 吊线
|
|
{
|
|
double len(D * .5 * cos(a));
|
|
AcGePoint3d pt = Pos - Z * (H / 3);
|
|
AcGePoint3d pt0 = Pos - Z * H;
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(a, -Y);
|
|
AcGePoint3d pt1 = pt0 + vt * len;
|
|
|
|
vt = -X;
|
|
vt.rotateBy(a, Y);
|
|
AcGePoint3d pt2 = pt0 + vt * len;
|
|
|
|
vt = Y;
|
|
vt.rotateBy(a, X);
|
|
AcGePoint3d pt3 = pt0 + vt * len;
|
|
|
|
vt = -Y;
|
|
vt.rotateBy(a, -X);
|
|
AcGePoint3d pt4 = pt0 + vt * len;
|
|
|
|
pSolid = drawCylinder(pt1 - pt, pt, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(pt2 - pt, pt, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(pt3 - pt, pt, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(pt4 - pt, pt, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
}
|
|
|
|
// 筒
|
|
//double dSlabW(100);
|
|
//double dh(250);
|
|
//{
|
|
// pSolid = drawCylinder(-Z * H * .5, Pos - Z * dh, D / 8);
|
|
// if (pSolid)
|
|
// {
|
|
// AcDb3dSolid *pSolid1 = drawCylinder(-Z * H * .5, Pos - Z * dh, D / 8 - 10);
|
|
// if (pSolid1)
|
|
// {
|
|
// if (pSolid->booleanOper(AcDb::kBoolSubtract, pSolid1) != Acad::eOk)
|
|
// DELETE_PTR(pSolid1);
|
|
// ar3d.append(pSolid);
|
|
// }
|
|
// }
|
|
//}
|
|
}
|
|
void NB::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
}
|
|
|
|
namespace BAOQIJI
|
|
{
|
|
#pragma region YHG
|
|
void YHG::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, L, L1, L2;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(L);
|
|
GETXDATA(L1);
|
|
GETXDATA(L2);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(YHG);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
// 主轴
|
|
AcGePoint3d pt(Pos + Z * D * .5);
|
|
pt += X * (L * .5 + L2);
|
|
pSolid = drawCylinder(-X * (L1 + L + L2), pt, D / 4);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 电机
|
|
double dr(L1 * .5);
|
|
pt = Pos + Z * D * .5;
|
|
pt -= X * (L * .5 + L1 * .5);
|
|
pt += Z * D / 4;
|
|
drawDianJi(pt, Z, dr, ar3d);
|
|
|
|
// 刷子
|
|
double sp(100);
|
|
int count(int(L / sp) - 1);
|
|
pt = Pos + Z * D * .5;
|
|
pt -= X * L * .5;
|
|
pt += X * sp;
|
|
AcGeVector3d vt(Z);
|
|
double a(PI * .25);
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
for (int j = 0; j < 8; ++j)
|
|
{
|
|
vt.rotateBy(j * a, X);
|
|
pSolid = drawBox(pt, vt * D * .5, X, 5, D * PI / 16);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
pt += X * sp;
|
|
}
|
|
}
|
|
void YHG::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region AD
|
|
void AD::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, L, L1, L2;
|
|
int DJ(false);
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(L);
|
|
GETXDATA(L1);
|
|
GETXDATA(L2);
|
|
GETXDATA(DJ);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(AD);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
// 主轴
|
|
AcGePoint3d pt(Pos + Z * D * .5);
|
|
pt += X * (L * .5 + L2);
|
|
pSolid = drawCylinder(-X * (L1 + L + L2), pt, D / 4);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 电机
|
|
double dr(L1 * .5);
|
|
pt = Pos + Z * D * .5;
|
|
pt -= X * (L * .5 + L1 * .5);
|
|
pt += Z * D / 4;
|
|
if (DJ)
|
|
drawDianJi(pt, Z, dr, ar3d);
|
|
|
|
// 刷子
|
|
double sp(100);
|
|
int count(int(L / sp) - 1);
|
|
pt = Pos + Z * D * .5;
|
|
pt -= X * L * .5;
|
|
pt += X * sp;
|
|
AcGeVector3d vt(Z);
|
|
double a(PI * .25);
|
|
for (int i = 0; i < count; ++i)
|
|
{
|
|
pSolid = drawCylinder(X * 5, pt, D * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt += X * sp;
|
|
}
|
|
}
|
|
void AD::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
}
|
|
|
|
namespace JIAYAOHUNHE
|
|
{
|
|
#pragma region GJ
|
|
void GJ::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, H, SP;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(H);
|
|
GETXDATA(SP);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(GJ);
|
|
|
|
double d(D * .5);
|
|
double R(D * .5), r(d * .5);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
pSolid = drawCylinder(Z * 200, Pos, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
AcGePoint3d pt(Pos + Z * 100);
|
|
pSolid = drawCylinder(-X * SP, pt, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt -= X * (SP + R);
|
|
pt += Z * 100;
|
|
drawDianJi(pt, Z, 100, ar3d);
|
|
|
|
pSolid = drawCylinder(-Z * H * .5, pt, R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(-Z * H, pt, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt -= Z * (H - 50);
|
|
pSolid = drawBox(pt, Y * 1, X, D, 100);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI * .5, Z, pt);
|
|
pSolid->transformBy(mat);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
}
|
|
void GJ::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region PJ
|
|
void PJ::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, H, L, W, E, W1;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(H);
|
|
GETXDATA(L);
|
|
GETXDATA(W);
|
|
GETXDATA(E);
|
|
GETXDATA(W1);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(PJ);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 桥
|
|
//pSolid = drawBox(Pos, Z * 10, X, L, 200);
|
|
//if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 电机
|
|
drawDianJi(Pos + Z * 10, Z, 100, ar3d, 200, 25);
|
|
|
|
// 轴
|
|
pSolid = drawCylinder(-Z * (H - E), Pos, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 桨
|
|
double dH(H/8);
|
|
AcGePoint3d pt(Pos - Z * (H - E));
|
|
pt += Z * dH * .5;
|
|
pSolid = drawBox(pt, Y, X, D, dH);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI * .5, Z, pt);
|
|
pSolid->transformBy(mat);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
}
|
|
void PJ::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region TJ
|
|
void TJ::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, H, fai, W1, H1, E(100);
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(H);
|
|
GETXDATA(H1);
|
|
GETXDATA(fai);
|
|
GETXDATA(W1);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(TJ);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 桥
|
|
//pSolid = drawBox(Pos, Z * H1, X, fai, 200);
|
|
//if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 电机
|
|
drawDianJi(Pos + Z * 10, Z, 100, ar3d, 200, 25);
|
|
|
|
// 轴
|
|
pSolid = drawCylinder(-Z * (H - E), Pos, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 桨
|
|
double dH(H / 8);
|
|
AcGePoint3d pt(Pos - Z * (H - E));
|
|
pt += Z * dH * .5;
|
|
pSolid = drawBox(pt, Y, X, D, dH);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI * .5, Z, pt);
|
|
pSolid->transformBy(mat);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
void TJ::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
#pragma region LJF
|
|
void LJF::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, H, W1, L, h, h1, h0;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(H);
|
|
GETXDATA(L);
|
|
GETXDATA(W1);
|
|
GETXDATA(h);
|
|
GETXDATA(h0);
|
|
GETXDATA(h1);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(LJF);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
// 桥
|
|
//pSolid = drawBox(Pos, Z * h, X, L, 200);
|
|
//if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 电机
|
|
drawDianJi(Pos + Z * 10, Z, 100, ar3d, 200, 25);
|
|
|
|
// 轴
|
|
pSolid = drawCylinder(-Z * H, Pos, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 桨
|
|
AcGePoint3d pt(Pos - Z * (h + h1 + h0 / 3));
|
|
pt -= X * D * .5;
|
|
pSolid = drawCylinder(X * D, pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * h0 / 3;
|
|
pSolid = drawCylinder(X * D, pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos - Z * (h + h1 + h0 / 3);
|
|
pt -= Y * D * .5;
|
|
pSolid = drawCylinder(Y * D, pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * h0 / 3;
|
|
pSolid = drawCylinder(Y * D, pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos - Z * (h + h1);
|
|
pt -= X * D * .5;
|
|
pSolid = drawCylinder(-Z * h0, pt, 5);
|
|
if (pSolid)
|
|
{
|
|
ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(X * 40);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pt += X * D;
|
|
pSolid = drawCylinder(-Z * h0, pt, 5);
|
|
if (pSolid)
|
|
{
|
|
ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(-X * 40);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pt = Pos - Z * (h + h1);
|
|
pt -= Y * D * .5;
|
|
pSolid = drawCylinder(-Z * h0, pt, 5);
|
|
if (pSolid)
|
|
{
|
|
ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(Y * 40);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
|
|
pt += Y * D;
|
|
pSolid = drawCylinder(-Z * h0, pt, 5);
|
|
if (pSolid)
|
|
{
|
|
ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToTranslation(-Y * 40);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
ar3d.append(pSolid);
|
|
}
|
|
}
|
|
void LJF::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
}
|
|
|
|
namespace LVBUJI
|
|
{
|
|
#pragma region ZHUANPAN
|
|
void ZHUANPAN::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE), LEFT(FALSE), DianJi(FALSE);
|
|
|
|
double L, D, H, L1, L2, S, T;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(L);
|
|
GETXDATA(D);
|
|
GETXDATA(H);
|
|
GETXDATA(L1);
|
|
GETXDATA(L2);
|
|
GETXDATA(T);
|
|
GETXDATA(S);
|
|
GETXDATA(LEFT);
|
|
GETXDATA(DianJi);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(ZHUANPAN);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
|
|
AcDb3dSolid *pSolid(NULL);
|
|
|
|
double R(D * .5); // 盘半径
|
|
double r(R * .25); // 轴半径
|
|
AcGePoint3d ptL(Pos);
|
|
ptL += Z * R;
|
|
ptL -= X * L * .5;
|
|
// 传动轴
|
|
{
|
|
pSolid = drawCylinder(X * L , ptL, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
// 滤片
|
|
{
|
|
double dL(L - L1 - L2);
|
|
double d(.0);
|
|
AcGePoint3d pt(ptL);
|
|
pt += X * L1;
|
|
while (d < dL)
|
|
{
|
|
pSolid = drawCylinder(X * T, pt, R);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt += X * (T + S);
|
|
d += (T + S);
|
|
}
|
|
}
|
|
// 电机
|
|
if (DianJi)
|
|
{
|
|
double dDjL(500); // 电机长
|
|
double dR(250); // 电机半径
|
|
AcGePoint3d pt(Pos + X * (LEFT ? (-L * .5 - dDjL) : (L * .5 + dDjL)));
|
|
pt += Z * (dR + H);
|
|
AcGeVector3d vt(LEFT ? X : -X);
|
|
drawDianJi(pt, vt, dR, ar3d, dDjL);
|
|
// 传动轴
|
|
pt += vt * dDjL;
|
|
pSolid = drawCylinder(vt * ((LEFT ? L1 : L2) * .5), pt, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 传动带
|
|
double dW(100); // 带宽
|
|
pt += vt * ((LEFT ? L1 : L2) * .5);
|
|
pt -= vt * dW * .5;
|
|
pSolid = drawBox(pt + Y * (r - .5), -Z * (H - R + dR), vt, dW, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawBox(pt - Y * (r - .5), -Z * (H - R + dR), vt, dW, 1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
}
|
|
void ZHUANPAN::draw2d(AcDbVoidPtrArray &ar2d){draw3d(ar2d);}
|
|
#pragma endregion
|
|
|
|
}
|
|
|
|
namespace QIBIJI
|
|
{
|
|
#pragma region QS_I_P
|
|
void QS_I_P::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, D1, d, H, H1, L, LL;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(D1);
|
|
GETXDATA(d);
|
|
GETXDATA(H);
|
|
GETXDATA(H1);
|
|
GETXDATA(L);
|
|
GETXDATA(LL);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(QS - I - P);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
L *= .5;
|
|
|
|
double dHPan(100);
|
|
AcDb3dSolid *pSolid = (AcDb3dSolid*)GiDrawUtility::DrawCone(Pos, Z, L * .5, L, H - dHPan, .0);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
AcGePoint3d pt(Pos + Z * (H - dHPan));
|
|
pSolid = drawCylinder(Z * dHPan, pt, d * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos + Z * H;
|
|
double R(D * .5), fai(5);
|
|
double r(R - 2 * fai);
|
|
pSolid = drawTorus(pt, Z, R, r);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(X * D, pt - X * D * .5, fai);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Y * D, pt - Y * D * .5, fai);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 螺杆
|
|
pSolid = drawCylinder(-Z * LL, Pos, d * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
}
|
|
void QS_I_P::draw2d(AcDbVoidPtrArray &ar2d) { draw3d(ar2d); }
|
|
#pragma endregion
|
|
|
|
#pragma region QS_I_Y
|
|
void QS_I_Y::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D1, d, H, H1, H2, L, L1, LL;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D1);
|
|
GETXDATA(d);
|
|
GETXDATA(H);
|
|
GETXDATA(H1);
|
|
GETXDATA(H2);
|
|
GETXDATA(L);
|
|
GETXDATA(L1);
|
|
GETXDATA(LL);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(QS - I - Y);
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
L1 *= .5;
|
|
|
|
double dHPan(150);
|
|
AcDb3dSolid *pSolid = (AcDb3dSolid*)GiDrawUtility::DrawCone(Pos, Z, L1 * .5, L1, H - dHPan, .0);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Z * dHPan, Pos + Z * (H - dHPan), L1);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = (AcDb3dSolid*)GiDrawUtility::DrawCone(Pos + Z * H, Z, D1 * .5, L1, 50, .0);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 摇柄
|
|
double dl(20);
|
|
AcGePoint3d pt(Pos + Z * H);
|
|
pt += X * L1;
|
|
pSolid = drawCylinder(X * dl, pt - Z * 5, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt += X * dl;
|
|
pSolid = drawCylinder(-Z * (H1 + 5), pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * 300;
|
|
pSolid = drawCylinder(X * (L - L1 - dl), pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 螺杆
|
|
pSolid = drawCylinder(-Z * LL, Pos, d * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
void QS_I_Y::draw2d(AcDbVoidPtrArray &ar2d) { draw3d(ar2d); }
|
|
#pragma endregion
|
|
|
|
#pragma region QS_I_L
|
|
void QS_I_L::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double D, H, H1, L, F, LL, M;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(D);
|
|
GETXDATA(M);
|
|
GETXDATA(H1);
|
|
GETXDATA(F);
|
|
GETXDATA(L);
|
|
GETXDATA(H);
|
|
GETXDATA(LL);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(QS - I - L);
|
|
|
|
F *= .5;
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
|
|
AcDb3dSolid *pSolid = (AcDb3dSolid*)GiDrawUtility::DrawCone(Pos, Z, F * .5, F, H1 - (F * .5), .0);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 方台
|
|
AcGePoint3d pt(Pos + Z * (H1 - (F * .5)));
|
|
pSolid = drawBox(pt, Z * F, X, F, F);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 电机
|
|
pt = Pos + Z * H1;
|
|
pt -= X * F * .5;
|
|
pSolid = drawCylinder(-X * F, pt, F * .25);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 摇杆轴
|
|
pt = Pos + Z * H1;
|
|
pt += X * F * .5;
|
|
pSolid = drawCylinder(X * F * .5, pt, F * .125);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 摇杆
|
|
pt = Pos + Z * H1;
|
|
pt += X * F * .75;
|
|
pSolid = drawCylinder(-Z * 200, pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt -= Z * 200;
|
|
pSolid = (AcDb3dSolid*)GiDrawUtility::DrawSphere(pt, 10);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 天线
|
|
double seta(PI / 6);
|
|
AcGeVector3d vt(X);
|
|
vt.rotateBy(seta, -Y);
|
|
vt.normalize();
|
|
double dl((D * .5) / cos(seta));
|
|
pt = Pos + Z * (H1 + F * .5);
|
|
pt += X * F * .5;
|
|
pSolid = drawCylinder(vt * dl, pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
AcGeMatrix3d mat;
|
|
mat.setToRotation(PI / 3, Z, Pos);
|
|
|
|
for (size_t i = 1; i < 6; ++i)
|
|
{
|
|
pSolid = (AcDb3dSolid*)pSolid->clone();
|
|
pSolid->transformBy(mat);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
|
|
// 手盘
|
|
double dr((dl * .5 * cos(seta)) + F * .5);
|
|
pt = Pos + Z * (H1 + F * .5 + dl * .5 * sin(seta));
|
|
pSolid = drawTorus(pt, Z, dr + 2.5, dr - 2.5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
// 螺杆
|
|
pSolid = drawCylinder(-Z * LL, Pos, M * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
void QS_I_L::draw2d(AcDbVoidPtrArray &ar2d) { draw3d(ar2d); }
|
|
#pragma endregion
|
|
|
|
#pragma region QS_II_L
|
|
void QS_II_L::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double H, M, L3, L, G, F, LL;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(H);
|
|
GETXDATA(F);
|
|
GETXDATA(G);
|
|
GETXDATA(M);
|
|
GETXDATA(L3);
|
|
GETXDATA(L);
|
|
GETXDATA(LL);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(QS - II - L);
|
|
|
|
L *= .5;
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
|
|
AcDb3dSolid *pSolid = drawBox(Pos + X * L3 * .5, Z * G, X, L3 + 2 * L, F);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
Pos += Z * G;
|
|
QS_II_Y::drawQBJ(Pos, Dir, H, M, L, ar3d);
|
|
QS_II_Y::drawQBJ(Pos + X * L3, Dir, H, M, L, ar3d);
|
|
AcGePoint3d pt(Pos + Z * H);
|
|
pSolid = drawCylinder(X * L3, pt, M * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
double dL((L3 - 2 * L) / 3);
|
|
pt = Pos + X * L;
|
|
pt += X * dL * .5;
|
|
pSolid = drawBox(pt, Z * (H + 150), X, dL, F);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 螺杆
|
|
pSolid = drawCylinder(-Z * LL, Pos, M * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-Z * LL, Pos + X * L3, M * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
void QS_II_L::draw2d(AcDbVoidPtrArray &ar2d) { draw3d(ar2d); }
|
|
#pragma endregion
|
|
|
|
#pragma region QS_II_Y
|
|
void QS_II_Y::draw3d(AcDbVoidPtrArray &ar3d)
|
|
{
|
|
if (!m_pXDataMap) return;
|
|
|
|
BOOL bRel(FALSE);
|
|
|
|
double H, M, L3, L, LL;
|
|
|
|
AcGePoint3d Pos;
|
|
AcGeVector3d Dir;
|
|
|
|
GETXDATA(H);
|
|
GETXDATA(M);
|
|
GETXDATA(L3);
|
|
GETXDATA(L);
|
|
GETXDATA(LL);
|
|
|
|
GETXDATA(Pos);
|
|
GETXDATA(Dir);
|
|
|
|
TESTXDATA(QS - II - Y);
|
|
|
|
L *= .5;
|
|
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
drawQBJ(Pos, Dir, H, M, L, ar3d);
|
|
drawQBJ(Pos + X * L3, Dir, H, M, L, ar3d);
|
|
|
|
AcGePoint3d pt(Pos + Z * H);
|
|
AcDb3dSolid *pSolid = drawCylinder(X * L3, pt, M * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
double H1(300);
|
|
double L1(450);
|
|
// 摇柄
|
|
double dl(20);
|
|
pt = Pos + Z * H;
|
|
pt += X * (L3 + L);
|
|
pSolid = drawCylinder(X * dl, pt - Z * 5, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt += X * dl;
|
|
pSolid = drawCylinder(-Z * (H1 + 5), pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pt -= Z * H1;
|
|
pSolid = drawCylinder(X * (L1 - L - dl), pt, 5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
// 螺杆
|
|
pSolid = drawCylinder(-Z * LL, Pos, M * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
pSolid = drawCylinder(-Z * LL, Pos + X * L3, M * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
void QS_II_Y::draw2d(AcDbVoidPtrArray &ar2d) { draw3d(ar2d); }
|
|
void QS_II_Y::drawQBJ(const AcGePoint3d & Pos
|
|
, const AcGeVector3d &Dir
|
|
, const double &H
|
|
, const double &M
|
|
, const double &L
|
|
, AcDbVoidPtrArray &ar3d)
|
|
{
|
|
AcGeVector3d X(Dir), Z(AcGeVector3d::kZAxis);
|
|
AcGeVector3d Y = Z.crossProduct(X);
|
|
X.normalize();
|
|
Y.normalize();
|
|
Z.normalize();
|
|
|
|
AcGePoint3d pt;
|
|
|
|
double dHPan(200);
|
|
AcDb3dSolid *pSolid = (AcDb3dSolid*)GiDrawUtility::DrawCone(Pos, Z, L * .5, L, H - dHPan * .5, .0);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = drawCylinder(Z * dHPan, Pos + Z * (H - dHPan * .5), L);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pSolid = (AcDb3dSolid*)GiDrawUtility::DrawCone(Pos + Z * (H + dHPan * .5), Z, L * .5, L, 50, .0);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
|
|
pt = Pos + Z * (H + dHPan * .5 + 50);
|
|
pSolid = drawCylinder(Z * 500, pt, M * .5);
|
|
if (pSolid) ar3d.append(pSolid);
|
|
}
|
|
#pragma endregion
|
|
|
|
}
|
|
|
|
void CParamEquImplBase::transformBy(const AcGeMatrix3d & xform)
|
|
{
|
|
// 只移动X Y
|
|
if (!m_pXDataMap) return;
|
|
AcGePoint3d pt;
|
|
if (m_pXDataMap->GetAt(_T("Pos"), pt))
|
|
{
|
|
double z = pt.z;
|
|
pt.transformBy(xform);
|
|
//pt.z = z;
|
|
m_pXDataMap->SetAt(_T("Pos"), pt);
|
|
}
|
|
|
|
}
|
|
|
|
void CParamEquImplBase::setElev(const double &dElev)
|
|
{
|
|
if (m_pXDataMap)
|
|
{
|
|
AcGePoint3d pt;
|
|
if (m_pXDataMap->GetAt(_T("Pos"), pt))
|
|
{
|
|
pt.z = dElev;
|
|
m_pXDataMap->SetAt(_T("Pos"), pt);
|
|
}
|
|
}
|
|
}
|
|
|
|
AcGePoint3d CParamEquImplBase::getPos()
|
|
{
|
|
if (m_pXDataMap)
|
|
{
|
|
AcGePoint3d pt;
|
|
if (m_pXDataMap->GetAt(_T("Pos"), pt))
|
|
{
|
|
return pt;
|
|
}
|
|
}
|
|
return AcGePoint3d::kOrigin;
|
|
}
|
|
|
|
AcGeVector3d CParamEquImplBase::getDir()
|
|
{
|
|
if (m_pXDataMap)
|
|
{
|
|
AcGeVector3d vt;
|
|
if (m_pXDataMap->GetAt(_T("Dir"), vt))
|
|
{
|
|
return vt;
|
|
}
|
|
}
|
|
return AcGeVector3d::kIdentity;
|
|
}
|