1549 lines
51 KiB
C++
1549 lines
51 KiB
C++
// DrawPumpDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "DrawPumpDlg.h"
|
|
#include "twt_pump.h"
|
|
#include "SelectPumpDlg.h"
|
|
#include "SelectBlkDlg.h"
|
|
|
|
#include <dbPipeValve.h>
|
|
|
|
#include <dbPump.h>
|
|
#include <DbDoubleLinePipe.h>
|
|
#include <DbSymbolAnnotate.h>
|
|
//#include <dbwall.h>
|
|
#include <dbwatertank.h>
|
|
#include "TSectionEdJig.h"
|
|
#include <vector>
|
|
#include "dbray.h"
|
|
#include <algorithm>
|
|
#include <map>
|
|
|
|
#include "DbDoubleLinePipeReducer.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
#define E6TOL 1.e-6
|
|
//extern TARCH_IMPEXP int DragMovePickSet(PickSet &ss, const TCHAR *pszPrompt, const XPoint &ptBase, XPoint &ptFinal);
|
|
|
|
//***************************************************************************************************
|
|
// 剖面生成
|
|
//***************************************************************************************************
|
|
//取得一条剖线的信息
|
|
BOOL SelectSectionLine(XPoly2D &poly, AcGeVector3d &vecView)
|
|
{
|
|
RBList mask(RTDXF0, _T("ATS_SYMB_SECTION"), NULL);
|
|
Entity ent;
|
|
if(ent.FilterSelect(_T("\n请选择一剖切线:"), mask)!=RTNORM)
|
|
return FALSE;
|
|
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbSymbSection, pPouLine);
|
|
if(pPouLine){
|
|
pPouLine->GetPoly2D(poly);
|
|
if(poly.IsSelfIntersect())
|
|
{
|
|
ads_printf(_T("\n剖切线不合适!"));
|
|
return FALSE;
|
|
}
|
|
double nViewDir=pPouLine->GetViewDirection();
|
|
vecView=AcGeVector3d(cos(nViewDir), sin(nViewDir), 0.0);
|
|
return TRUE;
|
|
}
|
|
OPENOBJ_END();
|
|
return FALSE;
|
|
}
|
|
|
|
XString LoadTgBlk(const TCHAR *szBlkName)
|
|
{
|
|
CString csTK, csRecord;
|
|
SplitBlkStr(szBlkName, csTK, csRecord);
|
|
XString xsTmp;
|
|
if(LoadDwbBlock((const TCHAR*)csTK, (const TCHAR*)csRecord, xsTmp) != RTNORM) {
|
|
return _T("");
|
|
}
|
|
return xsTmp;
|
|
}
|
|
|
|
//cet 2009.12.23 add
|
|
//为水泵剖面图中管线添加水泵接口
|
|
//idPump(原始水泵id), vtSection(剖切线方向), ptSecPumpIns(剖面水泵插入点)
|
|
void DrawPumpInterface(AcDbObjectId idPump, AcGeVector3d vtSection, AcGePoint3d ptSecPumpIns)
|
|
{
|
|
if (!idPump.isValid())
|
|
{
|
|
return;
|
|
}
|
|
|
|
TDbPump *pPump = NULL;
|
|
acdbOpenObject(pPump, idPump, AcDb::kForRead);
|
|
if (pPump != NULL)
|
|
{
|
|
int nInterfaceNum = pPump->GetInterfaceNum();
|
|
TPipeInterface iFace;
|
|
TDbPipe *pPipe = NULL;
|
|
double dLen = 1.0, dWidth = 1.0;
|
|
for (int i = 0; i < nInterfaceNum; i++)
|
|
{
|
|
pPump->GetInterface(i,iFace);
|
|
|
|
if (iFace.m_idPipe.isValid() && !iFace.m_idPipe.isErased())
|
|
{
|
|
// 检查管线是否与剖面生成方向平行或垂直
|
|
acdbOpenObject(pPipe, iFace.m_idPipe, AcDb::kForRead);
|
|
if (pPipe != NULL)
|
|
{
|
|
AcGePoint3d ptS, ptE;
|
|
ptS = pPipe->StartPoint();
|
|
ptE = pPipe->EndPoint();
|
|
ptS.z = 0;
|
|
ptE.z = 0;
|
|
|
|
AcGePoint3d ptTemp = ptSecPumpIns;
|
|
ptTemp = Wcs2Ucs(ptTemp); // cet 2011.10.13 add
|
|
ptTemp.y += pPipe->StartPoint().z - pPump->GetLocation().z; //确定相对剖面水泵水泵接口Y坐标值
|
|
ptTemp = Ucs2Wcs(ptTemp); // cet 2011.10.13 add
|
|
AcGeVector3d vtr = ptE - ptS;
|
|
dLen = pPump->GetPumpLength();
|
|
dWidth = pPump->GetPumpWidth();
|
|
if (vtr.isPerpendicularTo(vtSection)) // 管线与剖面方向垂直
|
|
{
|
|
AcGeVector3d vtX = AcGeVector3d::kXAxis;
|
|
AcGeVector3d vtY = AcGeVector3d::kYAxis;
|
|
vtX.rotateBy(Ucs2Wcs(0.0), AcGeVector3d::kZAxis); // cet 2011.10.13 add
|
|
vtY.rotateBy(Ucs2Wcs(0.0), AcGeVector3d::kZAxis); // cet 2011.10.13 add
|
|
|
|
if (vtr.isParallelTo(vtX))
|
|
{
|
|
if (vtSection.isCodirectionalTo(vtY))
|
|
{
|
|
if (vtr.isCodirectionalTo(vtX)) // 管线与X轴方向相同
|
|
{
|
|
LoadTgBlk(_T("$pump$00000060"));
|
|
ptTemp += vtX * dLen / 2; //确定相对剖面水泵插入点水泵接口坐标位置
|
|
InsertBlock(_T("$pump$00000060"), ptTemp, dLen, dWidth, Ucs2Wcs(0.0), LAY_TWT_PUMP);
|
|
}
|
|
else// 管线与X轴方向相反
|
|
{
|
|
LoadTgBlk(_T("$pump$00000060"));
|
|
ptTemp += -vtX * dLen / 2;
|
|
InsertBlock(_T("$pump$00000060"), ptTemp, dLen, dWidth, Ucs2Wcs(PI), LAY_TWT_PUMP);
|
|
}
|
|
}
|
|
else if (vtSection.isCodirectionalTo(-vtY))
|
|
{
|
|
if (vtr.isCodirectionalTo(vtX)) // 管线与X轴方向相同
|
|
{
|
|
LoadTgBlk(_T("$pump$00000060"));
|
|
ptTemp += -vtX * dLen / 2;
|
|
InsertBlock(_T("$pump$00000060"), ptTemp, dLen, dWidth, Ucs2Wcs(PI), LAY_TWT_PUMP);
|
|
}
|
|
else// 管线与剖面方向相反
|
|
{
|
|
LoadTgBlk(_T("$pump$00000060"));
|
|
ptTemp += vtX * dLen / 2;
|
|
InsertBlock(_T("$pump$00000060"), ptTemp, dLen, dWidth, Ucs2Wcs(0.0), LAY_TWT_PUMP);
|
|
}
|
|
}
|
|
}
|
|
else if (vtr.isParallelTo(vtY))
|
|
{
|
|
if (vtSection.isCodirectionalTo(vtX))
|
|
{
|
|
if (vtr.isCodirectionalTo(vtY)) // 管线与X轴方向相同
|
|
{
|
|
LoadTgBlk(_T("$pump$00000060"));
|
|
ptTemp += -vtX * dLen /2;
|
|
InsertBlock(_T("$pump$00000060"), ptTemp, dLen, dWidth, Ucs2Wcs(PI), LAY_TWT_PUMP);
|
|
}
|
|
else// 管线与X轴方向相反
|
|
{
|
|
LoadTgBlk(_T("$pump$00000060"));
|
|
ptTemp += vtX * dLen /2;
|
|
InsertBlock(_T("$pump$00000060"), ptTemp, dLen, dWidth, Ucs2Wcs(0.0), LAY_TWT_PUMP);
|
|
}
|
|
}
|
|
else if (vtSection.isCodirectionalTo(-vtX))
|
|
{
|
|
if (vtr.isCodirectionalTo(vtY)) // 管线与Y轴方向相同
|
|
{
|
|
LoadTgBlk(_T("$pump$00000060"));
|
|
ptTemp += vtX * dLen /2;
|
|
InsertBlock(_T("$pump$00000060"), ptTemp, dLen, dWidth, Ucs2Wcs(0.0), LAY_TWT_PUMP);
|
|
}
|
|
else if (vtr.isCodirectionalTo(-vtY))// 管线与Y轴方向相反
|
|
{
|
|
LoadTgBlk(_T("$pump$00000060"));
|
|
ptTemp += -vtX * dLen /2;
|
|
InsertBlock(_T("$pump$00000060"), ptTemp, dLen, dWidth, Ucs2Wcs(PI), LAY_TWT_PUMP);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (vtr.isParallelTo(vtSection)) // 管线与剖面方向平行
|
|
{
|
|
LoadTgBlk(_T("$pump$00000061"));
|
|
InsertBlock(_T("$pump$00000061"), ptTemp, dLen, dWidth, Ucs2Wcs(0.0), LAY_TWT_PUMP);
|
|
}
|
|
|
|
pPipe->close();
|
|
}
|
|
}
|
|
}
|
|
|
|
pPump->close();
|
|
}
|
|
}
|
|
|
|
// cet 2010.1.8 add
|
|
// 双线管与水泵相连时, 修改管线坐标位置使之与水泵接口吻合
|
|
void ModifyDPipePos(Entity ent, TDbPipe *pPipe, AcGePoint3d &ptPipeS, AcGePoint3d &ptPipeE)
|
|
{
|
|
if (ent.Is(_T("ATS_DOUBLELINEPIPE")) && pPipe != NULL)
|
|
{
|
|
AcDbEntity *pEnt = NULL;
|
|
AcDbObjectId idEnt;
|
|
double dPumpLen;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
idEnt = pPipe->GetNode(i);
|
|
if (idEnt.isValid())
|
|
{
|
|
acdbOpenObject(pEnt, idEnt, AcDb::kForRead);
|
|
if (pEnt != NULL)
|
|
{
|
|
TDbPump *pPump = TDbPump::cast(pEnt);
|
|
if (pPump !=NULL)
|
|
{
|
|
dPumpLen = pPump->GetPumpLength();
|
|
|
|
TDbDoubleLinePipe *pPipe2 = (TDbDoubleLinePipe *)pPipe;
|
|
if (pPipe2 != NULL)
|
|
{
|
|
double dThick = pPipe2->GetFlangeThick();
|
|
AcGePoint3d ptS = ptPipeS;
|
|
AcGePoint3d ptE = ptPipeE;
|
|
AcGeVector3d vtr = ptE - ptS;
|
|
|
|
vtr.normalize();
|
|
const double dDist = 0.137722; //剖面水泵中接口的长度
|
|
vtr = vtr * (dPumpLen * dDist + dThick); //双管线端点移动方向和距离
|
|
if (i == 0)
|
|
{
|
|
ptS += vtr;
|
|
ptPipeS = ptS;
|
|
}
|
|
else
|
|
{
|
|
ptE -= vtr;
|
|
ptPipeE = ptE;
|
|
}
|
|
}
|
|
}
|
|
|
|
pEnt->close();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// zxl 2012.06.27 modify 根据剖切符号绘制剖面
|
|
bool GetSectionByLine(PickSet &ss, bool &bByCustom, XPoly2D &poly, AcGeVector3d &vecView)
|
|
{
|
|
RBList rbMask(RTDXF0, _T("ATS_SYMB_SECTION"), NULL);
|
|
Entity ent;
|
|
TCHAR cRet = _T('\0');
|
|
int ret(0);
|
|
XPoint pt;
|
|
INITGET_BEG(0, _T("S"));
|
|
ret = SelectEntity(_T("请选择剖切符号[手动绘制剖切符号(S)]<退出>:"), ent, pt, rbMask, _T("S"), cRet);
|
|
INITGET_END();
|
|
#if (ADS == 19)
|
|
if (cRet == _T('\0'))
|
|
{
|
|
TCHAR szCh[20];
|
|
acedGetInput(szCh);
|
|
cRet = szCh[0];
|
|
}
|
|
#endif
|
|
|
|
if (ret == RTKWORD)
|
|
{
|
|
if (cRet == _T('S'))
|
|
{
|
|
bByCustom = true;
|
|
return true;
|
|
}
|
|
}
|
|
else if(ret != RTNORM)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbSymbSection, pPouLine);
|
|
if(pPouLine){
|
|
pPouLine->GetPoly2D(poly);
|
|
if(poly.IsSelfIntersect())
|
|
{
|
|
ads_printf(_T("\n剖切线不合适!"));
|
|
return false;
|
|
}
|
|
double nViewDir = pPouLine->GetViewDirection();
|
|
vecView = AcGeVector3d(cos(nViewDir), sin(nViewDir), 0.0);
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
RBList mask = ads_buildlist( -4, _T("<or"),
|
|
-4, _T("<and"), RTDXF0, _T("ATS_PIPE,ATS_PUMP,ATS_DOUBLELINEPIPE,ATS_WALL,ATS_WATERTANK"), 8, _T("*"), -4, _T("and>"),
|
|
-4, _T("<and"), RTDXF0, _T("LINE"), 8, _T("WALL"), -4, _T("and>"),
|
|
-4, _T("or>"), NULL);
|
|
if(SelectEntities(_T("\n请选择需要剖切的范围:"), ss, mask)!=RTNORM)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
//2008-12-18 改为先绘制剖断符号,然后生成剖面
|
|
void PumpSection()
|
|
{
|
|
// if(!SelectSectionLine(poly,vecView))
|
|
// return;
|
|
// RBList mask = ads_buildlist( -4, _T("<or"),
|
|
// -4, _T("<and"), RTDXF0, _T("ATS_PIPE,ATS_PUMP,ATS_DOUBLELINEPIPE,ATS_WALL,ATS_WATERTANK"), 8, _T("*"), -4, _T("and>"),
|
|
// -4, _T("<and"), RTDXF0, _T("LINE"), 8, _T("WALL"), -4, _T("and>"),
|
|
// -4, _T("or>"), NULL);
|
|
// if(SelectEntities(_T("\n请选择需要剖切的范围:"), ssComps, mask)!=RTNORM)
|
|
// return;
|
|
// XPoly2D poly;
|
|
|
|
XPushVar<int> vOrthoMode(_T("ORTHOMODE"), 1); //f8
|
|
PickSet ssComps(SS_FREE);
|
|
g_ssPickFirst.Free();
|
|
AcGeVector3d vecView, vt3d;
|
|
|
|
// 增加根据剖切符号绘制剖面的功能 zxl 2012.06.27 modify
|
|
// TSectionEdJig secJig;
|
|
// secJig.SymbSection();
|
|
// secJig.GetPickset(ssComps);
|
|
//
|
|
// ptIns = secJig.GetSecPoint();
|
|
// vecView = secJig.GetSecDir();
|
|
|
|
XPoly2D poly;
|
|
bool bByCustom = false;
|
|
if (!GetSectionByLine(ssComps, bByCustom, poly, vecView))
|
|
{
|
|
return;
|
|
}
|
|
XPoint ptIns;
|
|
if (bByCustom)
|
|
{
|
|
TSectionEdJig secJig;
|
|
secJig.SymbSection();
|
|
secJig.GetPickset(ssComps);
|
|
|
|
ptIns = secJig.GetSecPoint();
|
|
vecView = secJig.GetSecDir();
|
|
}
|
|
else
|
|
{
|
|
ptIns = *poly.GetPointListAt(0);
|
|
}
|
|
|
|
ptIns.z = 0;
|
|
PickSet ssNew(SS_FREE), ssWall(SS_FREE);
|
|
ssNew.IncludeBegin();
|
|
vecView.normalize();
|
|
|
|
AcGePlane plane(ptIns, vecView); //以剖切0点,剖切方向,确定投影面
|
|
AcGePoint3d ptOrigin;
|
|
AcGeVector3d vtNormal(0,0,1);
|
|
AcGeVector3d vtToX(1,0,0);
|
|
AcGeVector3d vtToY(0,1,0);
|
|
vtToX.rotateBy(Ucs2Wcs(0.0), AcGeVector3d::kZAxis); // cet 2011.10.12 add 未考虑ucs
|
|
vtToY.rotateBy(Ucs2Wcs(0.0), AcGeVector3d::kZAxis); // cet 2011.10.12 add
|
|
|
|
//顺着剖切的方向是Y轴,根据右手定则,与z轴差乘是X轴
|
|
AcGeMatrix3d mat;
|
|
AcGeVector3d vtFromX = vecView.crossProduct(vtNormal);
|
|
mat.setToAlignCoordSys(ptOrigin, vtFromX, vecView, vtNormal, ptOrigin, vtToX, vtToY, vtNormal);
|
|
Entity entLast;
|
|
AcDbObjectId idPump = AcDbObjectId::kNull; // cet 2009.12.29 add
|
|
AcGePoint3d ptBlkInsTemp; // cet 2009.12.29 add
|
|
|
|
//把投影到PLANE的结果,坐标转换到正常坐标,因为有高度,所以再旋转90度
|
|
for(long i=0;i<ssComps.Length();i++){
|
|
AcGeMatrix3d matWcs;
|
|
AcGePoint3d ptStart, ptEnd, ptNewS, ptNewE;
|
|
matWcs.setToRotation(-PI/2, vtToX);
|
|
Entity ent = ssComps[i];
|
|
if(ent.Is(_T("LINE"))){
|
|
XLine line(ent, 1);
|
|
ptStart = line.StartPoint();
|
|
ptEnd = line.EndPoint();
|
|
XVector3D vt = line.Direction3d();
|
|
vt3d = vt.AsAcGeVector3d();
|
|
if(vecView.isParallelTo(vt3d) == Adesk::kTrue){
|
|
ptStart.z = 0;
|
|
ptEnd.z = 3000;
|
|
}
|
|
else{
|
|
AcGePoint3d ptStart2, ptEnd2;
|
|
ptStart2 = ptStart;
|
|
ptEnd2 = ptEnd;
|
|
ptStart2.z = 3000;
|
|
ptEnd2.z = 3000;
|
|
ptNewS = ptStart2.project(plane, vecView);
|
|
ptNewE = ptEnd2.project(plane, vecView);
|
|
ptNewS.transformBy(mat);
|
|
ptNewE.transformBy(mat);
|
|
ptNewS.transformBy(matWcs);
|
|
ptNewE.transformBy(matWcs);
|
|
XLine lineNew2(XPoint(ptNewS), XPoint(ptNewE), 1);
|
|
lineNew2.Make();
|
|
entLast.GetLast();
|
|
ssWall += entLast;
|
|
}
|
|
ptNewS = ptStart.project(plane, vecView);
|
|
ptNewE = ptEnd.project(plane, vecView);
|
|
ptNewS.transformBy(mat);
|
|
ptNewE.transformBy(mat);
|
|
ptNewS.transformBy(matWcs);
|
|
ptNewE.transformBy(matWcs);
|
|
XLine lineNew(XPoint(ptNewS), XPoint(ptNewE), 1);
|
|
lineNew.Make();
|
|
entLast.GetLast();
|
|
ssWall += entLast;
|
|
}
|
|
else if(ent.Is(_T("ATS_WALL"))){
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbWall, pWall);
|
|
if(pWall){
|
|
double nWallHeight = pWall->GetHeight();
|
|
double nWallEle = pWall->StartPoint().z;
|
|
AcDbVoidPtrArray blockArray;
|
|
XExplodeStream dc(blockArray);
|
|
if(pWall->ExplodeOrDraw2d(dc)==Acad::eOk){
|
|
int nCount = blockArray.length();
|
|
for (int m=0; m<nCount; m++){
|
|
AcDbEntity *pEntity = (AcDbEntity *)blockArray[m];
|
|
if(pEntity->isKindOf(AcDbLine::desc())) {
|
|
AcDbLine *pLine = AcDbLine::cast(pEntity);
|
|
ptStart = pLine->startPoint();
|
|
ptEnd = pLine->endPoint();
|
|
ptStart.z = nWallEle;
|
|
ptEnd.z = nWallEle;
|
|
|
|
XLine line(XPoint(ptStart), XPoint(ptEnd), 1);
|
|
XVector3D vt = line.Direction3d();
|
|
vt3d = vt.AsAcGeVector3d();
|
|
if(vecView.isParallelTo(vt3d) == Adesk::kTrue){
|
|
// ptStart.z = 0;
|
|
ptEnd.z += nWallHeight;
|
|
}
|
|
else{
|
|
AcGePoint3d ptStart2, ptEnd2;
|
|
ptStart2 = ptStart;
|
|
ptEnd2 = ptEnd;
|
|
ptStart2.z += nWallHeight;
|
|
ptEnd2.z += nWallHeight;
|
|
ptNewS = ptStart2.project(plane, vecView);
|
|
ptNewE = ptEnd2.project(plane, vecView);
|
|
ptNewS.transformBy(mat);
|
|
ptNewE.transformBy(mat);
|
|
ptNewS.transformBy(matWcs);
|
|
ptNewE.transformBy(matWcs);
|
|
XLine lineNew2(XPoint(ptNewS), XPoint(ptNewE), 1);
|
|
lineNew2.Make();
|
|
entLast.GetLast();
|
|
ssWall += entLast;
|
|
}
|
|
ptNewS = ptStart.project(plane, vecView);
|
|
ptNewE = ptEnd.project(plane, vecView);
|
|
ptNewS.transformBy(mat);
|
|
ptNewE.transformBy(mat);
|
|
ptNewS.transformBy(matWcs);
|
|
ptNewE.transformBy(matWcs);
|
|
XLine lineNew(XPoint(ptNewS), XPoint(ptNewE), 1);
|
|
lineNew.Make();
|
|
entLast.GetLast();
|
|
ssWall += entLast;
|
|
|
|
}
|
|
}
|
|
ReleaseEntSet(blockArray);//按new出来的指针处理
|
|
}
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
else if(ent.Is(_T("ATS_PUMP"))){
|
|
CString csBlk;
|
|
AcGePoint3d ptBlkIns;
|
|
double dLen = 2.0; // cet 2009.12.22 add
|
|
double dWidth = 2.0; // cet 2009.12.22 add
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbPump, pEquip);
|
|
if(pEquip){
|
|
XPoint ptLoc = pEquip->GetLocation();
|
|
ptBlkIns = ptLoc;
|
|
XVector3D vt = pEquip->GetDirection();
|
|
CString csBlkFront = pEquip->GetBlockFront();
|
|
CString csBlkLeft = pEquip->GetBlockLeft();
|
|
dLen = pEquip->GetPumpLength(); // cet 2009.12.22 add
|
|
dWidth = pEquip->GetPumpWidth(); // cet 2009.12.22 add
|
|
vt3d = vt.AsAcGeVector3d();
|
|
if(vecView.isParallelTo(vt3d) == Adesk::kTrue)
|
|
csBlk = csBlkLeft;
|
|
else
|
|
csBlk = csBlkFront;
|
|
}
|
|
OPENOBJ_END();
|
|
ptBlkIns = ptBlkIns.project(plane, vecView);
|
|
ptBlkIns.transformBy(mat);
|
|
ptBlkIns.transformBy(matWcs);
|
|
XString xsBlk = LoadTgBlk((const TCHAR*)csBlk);
|
|
|
|
ptBlkInsTemp = ptBlkIns; // cet 2009.12.29 add
|
|
ptBlkInsTemp.z = 0;
|
|
// cet 2009.12.22 del
|
|
// InsertBlock((const TCHAR*)xsBlk, ptBlkIns, 2, 2, 0, LAY_TWT_PUMP);
|
|
|
|
InsertBlock((const TCHAR*)xsBlk, ptBlkInsTemp, dLen, dWidth, Ucs2Wcs(0.0), LAY_TWT_PUMP); // cet 2009.12.29 add
|
|
acdbGetObjectId(idPump, ent); // cet 2009.12.29 add
|
|
|
|
entLast.GetLast();
|
|
ssWall += entLast;
|
|
}
|
|
else if(ent.Is(_T("ATS_WATERTANK"))){
|
|
CString csBlk;
|
|
AcGePoint3d ptBlkIns, ptHole, ptWaterIn1, ptWaterIn2, ptWaterInFrom, ptOverfallStart, ptOverfallEnd;
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbWaterTank, pEquip);
|
|
if(pEquip){
|
|
XPoint ptLoc = pEquip->GetLocation();
|
|
ptHole = XPoint(pEquip->GetHoleInsert()).AsAcGePoint3d();
|
|
ptWaterIn1 = XPoint(pEquip->GetWaterIn1()).AsAcGePoint3d();
|
|
ptWaterIn2 = XPoint(pEquip->GetWaterIn2()).AsAcGePoint3d();
|
|
ptWaterInFrom = XPoint(pEquip->GetWaterInFrom()).AsAcGePoint3d();
|
|
ptOverfallStart = XPoint(pEquip->GetOverfallStart()).AsAcGePoint3d();
|
|
ptOverfallEnd = XPoint(pEquip->GetOverfallEnd()).AsAcGePoint3d();
|
|
double nRotate = pEquip->GetRotation();
|
|
ptBlkIns = ptLoc;
|
|
TDbWaterTank *pNewTank = new TDbWaterTank();
|
|
pNewTank = (TDbWaterTank *)pEquip->clone();
|
|
ptBlkIns = ptBlkIns.project(plane, vecView);
|
|
ptBlkIns.transformBy(mat);
|
|
ptBlkIns.transformBy(matWcs);
|
|
|
|
XPoint ptLocNew = ptBlkIns;
|
|
//因为立面的插入点也是矩形的中心,所以手工抬高水箱,保证水箱立面底标高为0
|
|
ads_polar(ptLocNew, PI/2, pEquip->GetHeight()* 10* pEquip->GetPScale()/2, ptLocNew);
|
|
//重新计算水箱其它参数点位置
|
|
AcGeVector3d vectTmp2(ptLocNew.x - ptLoc.x, ptLocNew.y - ptLoc.y, 0);
|
|
AcGeMatrix3d mat2;
|
|
mat2.setToTranslation(vectTmp2);
|
|
ptHole.transformBy(mat2);
|
|
ptWaterIn1.transformBy(mat2);
|
|
ptWaterIn2.transformBy(mat2);
|
|
ptWaterInFrom.transformBy(mat2);
|
|
ptOverfallStart.transformBy(mat2);
|
|
ptOverfallEnd.transformBy(mat2);
|
|
|
|
ptLocNew.z = 0;
|
|
ptHole.z = 0;
|
|
ptWaterIn1.z = 0;
|
|
ptWaterIn2.z = 0;
|
|
ptWaterInFrom.z = 0;
|
|
ptOverfallStart.z = 0;
|
|
ptOverfallEnd.z = 0;
|
|
pNewTank->SetLocation(ptLocNew);
|
|
pNewTank->SetHoleInsert(ptHole);
|
|
pNewTank->SetWaterIn1(ptWaterIn1);
|
|
pNewTank->SetWaterIn2(ptWaterIn2);
|
|
pNewTank->SetWaterInFrom(ptWaterInFrom);
|
|
pNewTank->SetOverfallStart(ptOverfallStart);
|
|
pNewTank->SetOverfallEnd(ptOverfallEnd);
|
|
//计算是主立面还是左立面
|
|
//AcGeVector3d vectTmp3(sin(nRotate),cos(nRotate),0); cet 2011.11.2 modify 参考向量有误
|
|
AcGeVector3d vectTmp3 = AcGeVector3d::kXAxis;
|
|
vectTmp3.rotateBy(nRotate + PI / 2, AcGeVector3d::kZAxis);
|
|
|
|
if(vecView.isParallelTo(vectTmp3) == Adesk::kTrue)
|
|
pNewTank->SetShowType(1);
|
|
else
|
|
pNewTank->SetShowType(2);
|
|
|
|
AddToCurrentSpace(pNewTank, Adesk::kTrue);
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
else if(ent.Is(_T("ATS_PIPE")) || ent.Is(_T("ATS_DOUBLELINEPIPE"))){
|
|
// 管线就不投影,直接把管线做2次矩阵变换即可, 把Z坐标变成Y坐标,把Y坐标变成Z坐标
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbPipe, pPipe);
|
|
if(pPipe){
|
|
ptStart = pPipe->StartPoint();
|
|
ptEnd = pPipe->EndPoint();
|
|
AcGeVector3d vtPipe(ptStart.x - ptEnd.x, ptStart.y - ptEnd.y, 0);
|
|
AcDbObjectId idPipeNew = NULL;
|
|
|
|
//cet 2010.1.8 add
|
|
//双线管与水泵相连时, 修改管线坐标位置使之与水泵接口吻合
|
|
ModifyDPipePos(ent, pPipe, ptStart, ptEnd);
|
|
|
|
ptNewS = ptStart;
|
|
ptNewE = ptEnd;
|
|
ptNewS.transformBy(mat);
|
|
ptNewE.transformBy(mat);
|
|
ptNewS.transformBy(matWcs);
|
|
ptNewE.transformBy(matWcs);
|
|
// cet 2013.6.3 del 保持剖切前后,管线相对位置关系
|
|
// ptNewS.z = 0;
|
|
// ptNewE.z = 0;
|
|
|
|
if(ent.Is(_T("ATS_PIPE"))){
|
|
TDbPipe *pNewPipe = new TDbPipe;
|
|
pNewPipe->SetDnDiameter(pPipe->GetDnDiameter());
|
|
pNewPipe->SetModelType(TPipeSys::kSystem);
|
|
pNewPipe->SetRadius(pPipe->GetRadius());
|
|
pNewPipe->setLayer(pPipe->layer());
|
|
pNewPipe->SetSysType(pPipe->GetSysType());
|
|
pNewPipe->SetStartPoint(ptNewS);
|
|
pNewPipe->SetEndPoint(ptNewE);
|
|
pNewPipe->SetRadiusIn(-2);
|
|
idPipeNew = AddToCurrentSpace(pNewPipe, Adesk::kTrue);
|
|
}
|
|
else if(ent.Is(_T("ATS_DOUBLELINEPIPE"))){
|
|
TDbDoubleLinePipe *pNewPipe = new TDbDoubleLinePipe;
|
|
TDbDoubleLinePipe *pPipe2=(TDbDoubleLinePipe *)pPipe;
|
|
pNewPipe->SetWidth(pPipe2->GetWidth());
|
|
pNewPipe->SetPipeWeight(pPipe2->GetPipeWeight());
|
|
pNewPipe->SetDnDiameter(pPipe2->GetDnDiameter());
|
|
pNewPipe->SetFlange(pPipe2->GetFlange());
|
|
pNewPipe->SetRate(pPipe2->GetRate());
|
|
pNewPipe->SetFlangeDn(pPipe2->GetFlangeDn());
|
|
pNewPipe->SetFlangeThick(pPipe2->GetFlangeThick());
|
|
pNewPipe->setLayer(pPipe->layer());
|
|
pNewPipe->SetDoteLayer(InitLayer(LAY_TWT_DOTE));
|
|
pNewPipe->SetStartPoint(ptNewS);
|
|
pNewPipe->SetEndPoint(ptNewE);
|
|
idPipeNew = AddToCurrentSpace(pNewPipe, Adesk::kTrue);
|
|
|
|
}
|
|
if(vecView.isParallelTo(vtPipe) == Adesk::kTrue)
|
|
continue;
|
|
|
|
DList<AcDbObjectId> lstAttachment;
|
|
pPipe->GetAttachments(lstAttachment);
|
|
int leng = lstAttachment.Length();
|
|
AcGePoint3d ptValve;
|
|
for(int m=0;m<leng;m++){
|
|
AcDbObjectId idTmp = *lstAttachment[m];
|
|
TDbPipeValve *pNewValve = NULL;
|
|
OPENOBJ_BEGIN(idTmp, AcDb::kForRead, TDbPipeValve, pValve);
|
|
if(pValve){
|
|
pNewValve = (TDbPipeValve *)pValve->clone();
|
|
XPoint ptValve2 = pValve->GetLocation();
|
|
ptValve = ptValve2;
|
|
}
|
|
else
|
|
continue;
|
|
OPENOBJ_END();
|
|
AcGePoint3d ptNewValve = ptValve;
|
|
ptNewValve.transformBy(mat);
|
|
ptNewValve.transformBy(matWcs);
|
|
XVector3D vectBase(ptNewE.x - ptNewS.x, ptNewE.y - ptNewS.y, 0);
|
|
pNewValve->SetDirection(vectBase);
|
|
//ptNewValve.z = 0;
|
|
pNewValve->SetLocation(ptNewValve);
|
|
pNewValve->SetPipeId(idPipeNew);
|
|
AddToCurrentSpace(pNewValve, Adesk::kTrue);
|
|
}
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
else if (ent.Is(_T("ATS_DOUBLELINEPIPEREDUCER"))) // cet 2010.3.30 add
|
|
{
|
|
TDbDoubleLinePipeReducer *pDblLinePipeReducer = NULL;
|
|
AcDbObjectId idEnt = AcDbObjectId::kNull;
|
|
acdbGetObjectId(idEnt, ent);
|
|
acdbOpenObject(pDblLinePipeReducer, idEnt, AcDb::kForRead);
|
|
if (pDblLinePipeReducer != NULL)
|
|
{
|
|
double dAngle = pDblLinePipeReducer->GetAngle();
|
|
double dReducerLen = 0.0; // 大小接头总长
|
|
int nLinkType = pDblLinePipeReducer->GetLinkType();
|
|
int nPipeType = pDblLinePipeReducer->GetType();
|
|
double dSPipeDia = pDblLinePipeReducer->GetSPipeDiameter();
|
|
double dEPipeDia = pDblLinePipeReducer->GetEPipeDiameter();
|
|
double dSPipeFlangeDist = pDblLinePipeReducer->GetSPipeFlangeDist();
|
|
double dEPipeFlangeDist = pDblLinePipeReducer->GetEPipeFlangeDist();
|
|
double dSFlangeDia = pDblLinePipeReducer->GetSFlangeDiameter();
|
|
double dSFlangeThick = pDblLinePipeReducer->GetSFlangeThick();
|
|
double dEFlangeDia = pDblLinePipeReducer->GetEFlangeDiameter();
|
|
double dEFlangeThick = pDblLinePipeReducer->GetEFlangeThick();
|
|
double dLen = pDblLinePipeReducer->GetLenght();
|
|
AcGePoint3d ptS = pDblLinePipeReducer->GetStartPosition();
|
|
pDblLinePipeReducer->Close();
|
|
|
|
AcGeVector3d vtReducer = AcGeVector3d::kXAxis;
|
|
vtReducer.rotateBy(dAngle, AcGeVector3d::kZAxis);
|
|
if (vecView.isParallelTo(vtReducer)) // 剖切方向与大小接头方向平行
|
|
{
|
|
AcGeVector3d vt = vtReducer;
|
|
double dAngle2 = Wcs2Ucs(dAngle);
|
|
if (dAngle2 > PI / 2 && dAngle2 <= PI * 3 / 2)
|
|
{
|
|
vt.rotateBy(-PI / 2, AcGeVector3d::kZAxis);
|
|
}
|
|
else
|
|
{
|
|
vt.rotateBy(PI / 2, AcGeVector3d::kZAxis);
|
|
}
|
|
AcGePoint3d ptStart, ptEnd; // 大小接头管径圆心
|
|
ptStart = ptS;
|
|
if (nPipeType == TDbDoubleLinePipeReducer::eCenter)
|
|
{
|
|
ptEnd = ptStart + vtReducer * dLen;
|
|
}
|
|
else if (nPipeType == TDbDoubleLinePipeReducer::eUp)
|
|
{
|
|
ptEnd = ptStart + vtReducer * dLen + vt * (dSPipeDia - dEPipeDia) / 2;
|
|
}
|
|
else if (nPipeType == TDbDoubleLinePipeReducer::eDown)
|
|
{
|
|
ptEnd = ptStart + vtReducer * dLen - vt * (dSPipeDia - dEPipeDia) / 2;
|
|
}
|
|
|
|
ptStart = ptStart.project(plane, vecView);
|
|
ptStart.transformBy(mat);
|
|
ptStart.transformBy(matWcs);
|
|
ptEnd = ptEnd.project(plane, vecView);
|
|
ptEnd.transformBy(mat);
|
|
ptEnd.transformBy(matWcs);
|
|
ptEnd.z = 0;
|
|
ptStart.z = 0;
|
|
AcDbCircle *pCir1 = new AcDbCircle(ptStart, AcGeVector3d::kZAxis, dSPipeDia / 2), *pCir2 = new AcDbCircle(ptEnd, AcGeVector3d::kZAxis, dEPipeDia / 2);
|
|
pCir1->setLayer(InitLayer(_T("PIPE-双管")));
|
|
pCir2->setLayer(InitLayer(_T("PIPE-双管")));
|
|
AddToCurrentSpace(pCir1, Adesk::kTrue);
|
|
AddToCurrentSpace(pCir2, Adesk::kTrue);
|
|
if (nLinkType == TDbDoubleLinePipeReducer::eFlangeLink)
|
|
{
|
|
AcDbCircle *pCir3 = new AcDbCircle(ptStart, AcGeVector3d::kZAxis, dSFlangeDia / 2), *pCir4 = new AcDbCircle(ptEnd, AcGeVector3d::kZAxis, dEFlangeDia / 2);
|
|
pCir3->setLayer(InitLayer(_T("PIPE-双管")));
|
|
pCir4->setLayer(InitLayer(_T("PIPE-双管")));
|
|
AddToCurrentSpace(pCir3, Adesk::kTrue);
|
|
AddToCurrentSpace(pCir4, Adesk::kTrue);
|
|
}
|
|
continue;
|
|
}
|
|
|
|
if (nLinkType == TDbDoubleLinePipeReducer::eJointing)
|
|
{
|
|
dReducerLen = dLen;
|
|
}
|
|
else if (nLinkType == TDbDoubleLinePipeReducer::eFlangeLink)
|
|
{
|
|
dReducerLen = dSPipeFlangeDist + dLen + dEPipeFlangeDist;
|
|
}
|
|
|
|
AcGePoint3d ptTmp = ptS + vtReducer * dReducerLen;
|
|
AcGeVector3d vtX = AcGeVector3d::kXAxis;
|
|
AcGeVector3d vtY = AcGeVector3d::kYAxis;
|
|
vtX.rotateBy(Ucs2Wcs(0.0), AcGeVector3d::kZAxis); // cet 2011.10.12 add 未考虑ucs
|
|
vtY.rotateBy(Ucs2Wcs(0.0), AcGeVector3d::kZAxis); // cet 2011.10.12 add 未考虑ucs
|
|
dAngle = Wcs2Ucs(dAngle);
|
|
if (vecView.isCodirectionalTo(vtX)) // 剖切方向与X轴方向相同
|
|
{
|
|
ptTmp.x = ptS.x;
|
|
if (dAngle >= 0 && dAngle < PI)
|
|
{
|
|
dAngle = PI;
|
|
}
|
|
else
|
|
{
|
|
dAngle = 0.0;
|
|
}
|
|
}
|
|
else if (vecView.isCodirectionalTo(-vtX)) // 剖切方向与X轴方向相反
|
|
{
|
|
ptTmp.x = ptS.x;
|
|
if (dAngle >= 0 && dAngle < PI)
|
|
{
|
|
dAngle = 0.0;
|
|
}
|
|
else
|
|
{
|
|
dAngle = PI;
|
|
}
|
|
}
|
|
else if (vecView.isCodirectionalTo(vtY)) // 剖切方向与Y轴方向相同
|
|
{
|
|
ptTmp.y = ptS.y;
|
|
if (dAngle >= 0 && dAngle < PI)
|
|
{
|
|
dAngle = 0.0;
|
|
}
|
|
else
|
|
{
|
|
dAngle = PI;
|
|
}
|
|
}
|
|
else if (vecView.isCodirectionalTo(-vtY)) // 剖切方向与Y轴方向相反
|
|
{
|
|
ptTmp.y = ptS.y;
|
|
if (dAngle >= 0 && dAngle < PI)
|
|
{
|
|
dAngle = PI;
|
|
}
|
|
else
|
|
{
|
|
dAngle = 0.0;
|
|
}
|
|
}
|
|
dAngle = Ucs2Wcs(dAngle);
|
|
vtReducer = AcGeVector3d::kXAxis;
|
|
vtReducer.rotateBy(dAngle, AcGeVector3d::kZAxis);
|
|
|
|
double dLenX = ptS.distanceTo(ptTmp); // 大小接头剖切时的投影长度
|
|
double dScale = dLenX / dReducerLen;
|
|
AcGePoint3d ptLocation;
|
|
ptS = ptS.project(plane, vecView);
|
|
ptS.transformBy(mat);
|
|
ptS.transformBy(matWcs);
|
|
ptS.z = 0;
|
|
if (nLinkType == TDbDoubleLinePipeReducer::eJointing)
|
|
{
|
|
ptLocation = ptS + vtReducer * dLen / 2;
|
|
}
|
|
else if (nLinkType == TDbDoubleLinePipeReducer::eFlangeLink)
|
|
{
|
|
ptLocation = ptS + vtReducer * (dSPipeFlangeDist + dLen / 2);
|
|
}
|
|
TDbDoubleLinePipeReducer* pNewReducer = new TDbDoubleLinePipeReducer();
|
|
pNewReducer->SetLocation(ptLocation);
|
|
pNewReducer->SetSPipeDiameter(dSPipeDia);
|
|
pNewReducer->SetEPipeDiameter(dEPipeDia);
|
|
pNewReducer->SetSPipeFlangeDist(dSPipeFlangeDist* dScale);
|
|
pNewReducer->SetEPipeFlangeDist(dEPipeFlangeDist* dScale);
|
|
pNewReducer->SetSFlangeDiameter(dSFlangeDia);
|
|
pNewReducer->SetEFlangeDiameter(dEFlangeDia);
|
|
pNewReducer->SetSFlangeThick(dSFlangeThick* dScale);
|
|
pNewReducer->SetEFlangeThick(dEFlangeThick* dScale);
|
|
pNewReducer->SetLenght(dLen * dScale);
|
|
pNewReducer->SetLinkType(nLinkType);
|
|
pNewReducer->SetType(TDbDoubleLinePipeReducer::eCenter);
|
|
pNewReducer->setLayer(InitLayer(_T("PIPE-双管")));
|
|
pNewReducer->SetAngle(dAngle);
|
|
pNewReducer->SetStartPosition(ptS);
|
|
pNewReducer->AddPipeReducerInterface();
|
|
AddToCurrentSpace(pNewReducer, Adesk::kTrue);
|
|
}
|
|
}
|
|
}
|
|
AcDbObjectIdArray cloneSet;
|
|
long len = ssWall.Length();
|
|
for(long j=0;j<len;j++){
|
|
Entity ent = ssWall[j];
|
|
AcDbObjectId id;
|
|
acdbGetObjectId(id, ent);
|
|
cloneSet.append(id);
|
|
}
|
|
DeleteRepeateWall(&cloneSet); //把多生成出来的墙线、图块消隐
|
|
//为水泵剖面图中管线添加水泵接口
|
|
DrawPumpInterface(idPump, vecView, ptBlkInsTemp); // cet 2009.12.29 add
|
|
|
|
ssNew.IncludeEnd();
|
|
if(ssNew.Length() < 1)
|
|
return;
|
|
double x,y,z;
|
|
|
|
ssNew.Redraw(2);
|
|
ssNew.GetExtend(ptIns, &x, &y, &z);
|
|
|
|
ptIns = Wcs2Ucs(ptIns);
|
|
ptIns.z = 0;
|
|
int nRet = DragMovePickSet(ssNew, _T("\n请点取系统图位置<退出>: "), ptIns, XPoint());
|
|
if(nRet != RTNORM){
|
|
ssNew.Erase();
|
|
return;
|
|
}
|
|
ssNew.Redraw(1);
|
|
|
|
acedUpdateDisplay();
|
|
actrTransactionManager->flushGraphics(); //acad 刷新
|
|
}
|
|
|
|
void UpdateInterfacePt(int nPreLength, int nPreWidth, TDbPump *pEquip)
|
|
{
|
|
if (pEquip == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
//根据图块大小做一矩形
|
|
XPoint ptLocation = pEquip->GetLocation();
|
|
int nInterfaceNum = pEquip->GetInterfaceNum();
|
|
int nCurLength = (int)pEquip->GetPumpLength();
|
|
int nCurWidth = (int)pEquip->GetPumpWidth();
|
|
|
|
AcDbPolyline polyLine;
|
|
|
|
AcGeVector3d vtDir = AcGeVector3d::kXAxis;
|
|
double dAngle = pEquip->GetAngle();
|
|
vtDir.rotateBy(dAngle, AcGeVector3d::kZAxis);
|
|
|
|
AcGePoint3d ptPosT = ptLocation;
|
|
ptPosT.z = 0;
|
|
AcGeVector3d vtr = vtDir;
|
|
vtr = vtr.rotateBy(PI / 2, AcGeVector3d::kZAxis);
|
|
|
|
AcGePoint3d pt1 = ptPosT + vtDir * (nCurLength / 2.0) + vtr * (nCurWidth / 2.0);
|
|
AcGePoint3d pt2 = pt1 - vtDir * nCurLength;
|
|
AcGePoint3d pt3 = pt2 - vtr * nCurWidth;
|
|
AcGePoint3d pt4 = pt3 + vtDir * nCurLength;
|
|
|
|
polyLine.addVertexAt(0, pt1.convert2d(AcGePlane::kXYPlane));
|
|
polyLine.addVertexAt(1, pt2.convert2d(AcGePlane::kXYPlane));
|
|
polyLine.addVertexAt(2, pt3.convert2d(AcGePlane::kXYPlane));
|
|
polyLine.addVertexAt(3, pt4.convert2d(AcGePlane::kXYPlane));
|
|
polyLine.addVertexAt(4, pt1.convert2d(AcGePlane::kXYPlane));
|
|
|
|
//修改接口的位置
|
|
TPipeInterface iFace;
|
|
std::vector<TPipeInterface> vec;
|
|
AcDbRay ray;
|
|
AcGePoint3dArray arPt;
|
|
for (int i = 0; i < nInterfaceNum; i++)
|
|
{
|
|
iFace = pEquip->GetInterface(i);
|
|
XPoint ptTemp = iFace.m_ptLocation;
|
|
ptTemp.z = 0;
|
|
ptLocation.z = 0;
|
|
AcGeVector3d vtr = ptTemp - ptLocation; //根据图块插入点和接口点做一向量
|
|
|
|
vtr.normalize();
|
|
ray.setBasePoint(ptLocation);
|
|
ray.setUnitDir(vtr);
|
|
|
|
arPt.setLogicalLength(0);
|
|
polyLine.intersectWith(&ray, AcDb::kOnBothOperands, arPt); //射线与矩形的交点即为图块大小变化后相应接口点的位置点
|
|
if (arPt.length() == 1)
|
|
{
|
|
iFace.m_ptLocation = arPt[0];
|
|
ptTemp = arPt[0];
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
|
|
// 检查接口点与管线的关系
|
|
if (iFace.m_idPipe.isValid() && !iFace.m_idPipe.isErased())
|
|
{
|
|
TDbPipe *pPipe = NULL;
|
|
acdbOpenObject(pPipe, iFace.m_idPipe, AcDb::kForRead);
|
|
if (pPipe != NULL)
|
|
{
|
|
XPoint ptS = pPipe->StartPoint();
|
|
XPoint ptE = pPipe->EndPoint();
|
|
if (!(ptS.Distance(ptTemp) < 1e-3 || ptE.Distance(ptTemp) < 1e-3))
|
|
{
|
|
iFace.m_idPipe.setNull();
|
|
}
|
|
pPipe->close();
|
|
}
|
|
}
|
|
|
|
vec.push_back(iFace);
|
|
}
|
|
|
|
pEquip->RemoveInterfaces();
|
|
|
|
std::vector<TPipeInterface>::iterator iter = vec.begin();
|
|
for (; iter != vec.end(); ++iter)
|
|
{
|
|
pEquip->AddInterface(*iter);
|
|
}
|
|
}
|
|
|
|
//***************************************************************************************************
|
|
// 编辑水泵
|
|
//***************************************************************************************************
|
|
|
|
// zxl 2013.11.05 add
|
|
CString GetDwbName(const CString sNameInDwg, int &nType)
|
|
{
|
|
nType = 1;
|
|
CString sOldName = sNameInDwg, sNewName;
|
|
sNewName = sOldName.Right(sOldName.GetLength() - 6);
|
|
sNewName = _T("pump(") + sNewName +_T(")");
|
|
if (sNewName.Compare(_T("pump(00000078)")) == 0 || sNewName.Compare(_T("pump(00000079)")) == 0 || sNewName.Compare(_T("pump(00000080)")) == 0
|
|
|| sNewName.Compare(_T("pump(00000041)")) == 0 || sNewName.Compare(_T("pump(00000042)")) == 0 || sNewName.Compare(_T("pump(00000053)")) == 0)
|
|
{
|
|
nType = 0;
|
|
}
|
|
return sNewName;
|
|
}
|
|
|
|
int EditPump(AcDbObjectId id)
|
|
{
|
|
if(!id)
|
|
return RTERROR;
|
|
|
|
CTemporaryResourceOverride vTemp;
|
|
CDrawPumpDlg dlg(1);
|
|
int iLength(0), iWidth(0), iHeight(0), iInEle(0), iOutEle(0);
|
|
double nEle(0);
|
|
OPENOBJ_BEGIN(id, AcDb::kForRead, TDbPump, pEquip);
|
|
if(pEquip){
|
|
iLength = (int)pEquip->GetPumpLength();
|
|
iWidth = (int)pEquip->GetPumpWidth();
|
|
iHeight = (int)pEquip->GetPumpHeight();
|
|
nEle = pEquip->GetLocation().z/1000;
|
|
if(fabs(nEle) < 0.0001)
|
|
nEle = 0;
|
|
iInEle = (int)pEquip->GetInPipeEle();
|
|
iOutEle = (int)pEquip->GetOutPipeEle();
|
|
dlg.m_csSpec = pEquip->GetSpare();
|
|
dlg.m_csBlockFront = pEquip->GetBlockFront();// zxl 2013.11.05 add
|
|
dlg.m_csBlockFront = GetDwbName(dlg.m_csBlockFront, dlg.m_iType);
|
|
}
|
|
OPENOBJ_END();
|
|
dlg.m_iHeight = iHeight;
|
|
dlg.m_iLength = iLength;
|
|
dlg.m_iWidth = iWidth;
|
|
dlg.m_nEle = nEle;
|
|
dlg.m_iInEle = iInEle;
|
|
dlg.m_iOutEle = iOutEle;
|
|
|
|
if(dlg.DoModal() != IDOK)
|
|
return 1;
|
|
OPENOBJ_BEGIN(id, AcDb::kForWrite, TDbPump, pEquip);
|
|
if(pEquip){
|
|
pEquip->SetPumpLength(dlg.m_iLength);
|
|
pEquip->SetPumpWidth(dlg.m_iWidth);
|
|
pEquip->SetPumpHeight(dlg.m_iHeight);
|
|
pEquip->SetInPipeEle((double)dlg.m_iInEle);
|
|
pEquip->SetOutPipeEle((double)dlg.m_iOutEle);
|
|
pEquip->SetSpare(dlg.m_csSpec);
|
|
|
|
CString csDwb = g_csDwbPath + _T("pump");
|
|
XString xsTmp, xsTmp2;
|
|
if(dlg.m_iType == 0){
|
|
if(LoadDwbBlock(csDwb, _T("00000030"), xsTmp) != RTNORM)
|
|
return 1;
|
|
}
|
|
else{
|
|
if(LoadDwbBlock(csDwb, _T("00000057"), xsTmp) != RTNORM)
|
|
return 1;
|
|
}
|
|
|
|
if (LoadDwbBlock(csDwb, _T("00000046"), XString()) != RTNORM) // cet 2011.2.28 add 剖切时需要的图块
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
if (LoadDwbBlock(csDwb, _T("00000060"), XString()) != RTNORM) // cet 2011.3.3 add 剖切时需要的图块
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
if (LoadDwbBlock(csDwb, _T("00000061"), XString()) != RTNORM) // cet 2011.3.3 add 剖切时需要的图块
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
if(g_bBlk3D){
|
|
if(LoadDwbBlock(csDwb, dlg.m_csBlock3D, xsTmp2) != RTNORM)
|
|
return 1;
|
|
}
|
|
XString xsTk, xsRecord, xsTmpFront, xsTmpLeft;
|
|
SplitSlbName(dlg.m_csBlockFront, xsTk, xsRecord);
|
|
xsTk = g_csDwbPath + xsTk + _T(".tk");
|
|
CString csDesName = GetBlkDesName(xsRecord, xsTk);
|
|
if(LoadDwbBlock(csDwb, xsRecord, xsTmpFront) != RTNORM)
|
|
return 1;
|
|
int idx = csDesName.Find(_T("-"));
|
|
if(idx > -1){
|
|
CString csRight = csDesName.Right(8);
|
|
xsRecord = csRight;
|
|
if(LoadDwbBlock(csDwb, xsRecord, xsTmpLeft) != RTNORM)
|
|
return 1;
|
|
}
|
|
pEquip->SetBlock2d(GetBlockIdFromString(xsTmp));
|
|
pEquip->SetBlock3d(GetBlockIdFromString(xsTmp2));
|
|
pEquip->SetBlockFront(xsTmpFront);
|
|
pEquip->SetBlockLeft(xsTmpLeft);
|
|
|
|
XPoint ptLoc = pEquip->GetLocation();
|
|
ptLoc.z = dlg.m_nEle*1000;
|
|
pEquip->SetLocation(ptLoc);
|
|
UpdateInterfacePt(iLength, iWidth, pEquip); // cet 2009.12.18 add
|
|
}
|
|
OPENOBJ_END();
|
|
return 1;
|
|
}
|
|
|
|
//***************************************************************************************************
|
|
// 绘制水泵
|
|
//***************************************************************************************************
|
|
|
|
void DrawPumpCmd()
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
CDrawPumpDlg dlg;
|
|
if(dlg.DoModal() != IDOK)
|
|
return;
|
|
|
|
CString csDwb = g_csDwbPath + _T("pump");
|
|
XString xsTmp, xsTmp2;
|
|
if(dlg.m_iType == 0){
|
|
if(LoadDwbBlock(csDwb, _T("00000030"), xsTmp) != RTNORM)
|
|
return;
|
|
}
|
|
else{
|
|
if(LoadDwbBlock(csDwb, _T("00000057"), xsTmp) != RTNORM)
|
|
return;
|
|
}
|
|
|
|
if (LoadDwbBlock(csDwb, _T("00000046"), XString()) != RTNORM) // cet 2011.2.28 add 剖切时需要的图块
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (LoadDwbBlock(csDwb, _T("00000060"), XString()) != RTNORM) // cet 2011.3.3 add 剖切时需要的图块
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (LoadDwbBlock(csDwb, _T("00000061"), XString()) != RTNORM) // cet 2011.3.3 add 剖切时需要的图块
|
|
{
|
|
return;
|
|
}
|
|
|
|
if(g_bBlk3D){
|
|
if(LoadDwbBlock(csDwb, dlg.m_csBlock3D, xsTmp2) != RTNORM)
|
|
return;
|
|
}
|
|
InitLayer(LAY_TWT_PUMP);
|
|
//XPushVarStr clayer(_T("CLAYER"), LAY_TWT_PUMP); cet 2011.10.11 del 导致产生图层"CLAYER"
|
|
XPoint ptIns, pt1, pt2;
|
|
XPushVar<int> vOsMode(_T("OSMODE"), 0);
|
|
xg_getvar(_T("VIEWCTR"), ptIns);
|
|
ptIns = Ucs2Wcs(ptIns);
|
|
ptIns.z = dlg.m_nEle*1000;
|
|
|
|
//从幻灯片得到正立面,左立面图块
|
|
XString xsTk, xsRecord, xsTmpFront, xsTmpLeft;
|
|
SplitSlbName(dlg.m_csBlockFront, xsTk, xsRecord);
|
|
xsTk = g_csDwbPath + xsTk + _T(".tk");
|
|
CString csDesName = GetBlkDesName(xsRecord, xsTk);
|
|
if(LoadDwbBlock(csDwb, xsRecord, xsTmpFront) != RTNORM)
|
|
return;
|
|
int idx = csDesName.Find(_T("-"));
|
|
if(idx > -1){
|
|
CString csRight = csDesName.Right(8);
|
|
xsRecord = csRight;
|
|
if(LoadDwbBlock(csDwb, xsRecord, xsTmpLeft) != RTNORM)
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
XPoint ptTmp;
|
|
while(1){
|
|
// int iRet = ads_getpoint(NULL, _T("请输入点<退出>:"), ptIns);
|
|
// if(iRet != RTNORM)
|
|
// break;
|
|
TDbPump *pEquip = new TDbPump;
|
|
pEquip->SetHidePipe(FALSE);
|
|
pEquip->SetSpare(dlg.m_csSpec);
|
|
pEquip->SetBlock2d(GetBlockIdFromString(xsTmp));
|
|
pEquip->SetBlock3d(GetBlockIdFromString(xsTmp2));
|
|
pEquip->SetPumpLength(dlg.m_iLength);
|
|
pEquip->SetPumpWidth(dlg.m_iWidth);
|
|
pEquip->SetPumpHeight(dlg.m_iHeight);
|
|
pEquip->SetBlockFront(xsTmpFront);
|
|
pEquip->SetBlockLeft(xsTmpLeft);
|
|
pEquip->SetInsert(ptIns);
|
|
pEquip->SetLocation(ptIns);
|
|
pEquip->SetInPipeEle((double)dlg.m_iInEle);
|
|
pEquip->SetOutPipeEle((double)dlg.m_iOutEle);
|
|
AcGeVector3d vtX = AcGeVector3d::kXAxis;
|
|
vtX.rotateBy(Ucs2Wcs(0.0), AcGeVector3d::kZAxis);
|
|
pEquip->setLayer(LAY_TWT_PUMP); // cet 2011.10.11 add
|
|
pEquip->SetDirection(vtX);
|
|
|
|
// ---开始---cet add 2009.12.10
|
|
//为水泵添加两个夹点
|
|
AcDbExtents extents;
|
|
AcDbObjectId idBlock = pEquip->GetBlock2d();
|
|
AcGeScale3d scale(1);
|
|
double xx = 0, yy = 0;
|
|
GetInsertExtend(idBlock, xx, yy); //PipeTools.h
|
|
if (xx > 1.0E-3)
|
|
{
|
|
scale.sx *= dlg.m_iLength * xx;
|
|
}
|
|
if (yy > 1.0E-3)
|
|
{
|
|
scale.sy *= dlg.m_iWidth * yy;
|
|
}
|
|
//求图块边缘点
|
|
if (idBlock.isValid())
|
|
{
|
|
AcDbBlockReference insert(ptIns, idBlock);
|
|
insert.setScaleFactors(scale);
|
|
if(insert.geomExtentsBestFit(extents) == Acad::eOk)
|
|
{
|
|
XPoint ptMax = extents.maxPoint();
|
|
XPoint ptMin = extents.minPoint();
|
|
|
|
XPoint ptInter1,ptInter2;
|
|
AcGeVector3d vtDir = AcGeVector3d::kXAxis;
|
|
vtDir.rotateBy(Ucs2Wcs(0.0), AcGeVector3d::kZAxis); // cet 2011.8.29 add
|
|
AcGePoint3d ptPosT = ptIns;
|
|
ptPosT.z = 0;
|
|
AcDbLine line(ptPosT + vtDir*dlg.m_iLength * 3 / 4,ptPosT - vtDir*dlg.m_iLength * 3 / 4);
|
|
// cet 2011.9.14 modify 外包框有误
|
|
// AcDbPolyline polyLine;
|
|
// AcGePoint3d pt1 = ptMin;
|
|
// AcGePoint3d pt2 = pt1 + vtDir * dlg.m_iLength * xx;
|
|
// AcGePoint3d pt3 = ptMax;
|
|
// AcGePoint3d pt4 = pt3 - vtDir * dlg.m_iLength * xx;
|
|
AcDbPolyline polyLine;
|
|
AcGeVector3d vtX = AcGeVector3d::kXAxis;
|
|
AcGeVector3d vtY = AcGeVector3d::kYAxis;
|
|
ptPosT = Wcs2Ucs(ptPosT);
|
|
AcGePoint3d pt1 = ptPosT - vtX * dlg.m_iLength * xx * 0.5 - vtY * dlg.m_iLength * xx * 0.5;
|
|
AcGePoint3d pt2 = ptPosT + vtX * dlg.m_iLength * xx * 0.5 - vtY * dlg.m_iLength * xx * 0.5;
|
|
AcGePoint3d pt3 = ptPosT + vtX * dlg.m_iLength * xx * 0.5 + vtY * dlg.m_iLength * xx * 0.5;
|
|
AcGePoint3d pt4 = ptPosT - vtX * dlg.m_iLength * xx * 0.5 + vtY * dlg.m_iLength * xx * 0.5;
|
|
pt1 = Ucs2Wcs(pt1);
|
|
pt2 = Ucs2Wcs(pt2);
|
|
pt3 = Ucs2Wcs(pt3);
|
|
pt4 = Ucs2Wcs(pt4);
|
|
|
|
polyLine.addVertexAt(0, pt1.convert2d(AcGePlane::kXYPlane));
|
|
polyLine.addVertexAt(1, pt2.convert2d(AcGePlane::kXYPlane));
|
|
polyLine.addVertexAt(2, pt3.convert2d(AcGePlane::kXYPlane));
|
|
polyLine.addVertexAt(3, pt4.convert2d(AcGePlane::kXYPlane));
|
|
polyLine.addVertexAt(4, pt1.convert2d(AcGePlane::kXYPlane));
|
|
AcGePoint3dArray arPts;
|
|
polyLine.intersectWith(&line, AcDb::kOnBothOperands, arPts);
|
|
if (arPts.length() == 2)
|
|
{
|
|
TPipeInterface iFace;
|
|
iFace.m_faceType = TPipeInterface::kBoundry;
|
|
iFace.m_vtLocation = XVector3D(vtDir);
|
|
iFace.m_sSysLabel = _T("1");
|
|
iFace.m_ptLocation = arPts[0];
|
|
pEquip->AddInterface(iFace);
|
|
|
|
iFace.m_sSysLabel = _T("2");
|
|
iFace.m_ptLocation = arPts[1];
|
|
pEquip->AddInterface(iFace);
|
|
}
|
|
} //----结束--- cet add 2009.12.10
|
|
}
|
|
|
|
AddToCurrentSpace(pEquip, Adesk::kTrue);
|
|
|
|
PickSet ss(SS_FREE);
|
|
Entity ent;
|
|
ent.GetLast();
|
|
ss += ent;
|
|
double x,y,z;
|
|
actrTransactionManager->flushGraphics(); //acad 刷新
|
|
ss.GetExtend(ptIns, &x, &y, &z);
|
|
ptTmp= ptIns;
|
|
ptIns.z = 0;
|
|
// int nRet = DragMovePickSet(ss, _T("\n请点取水泵位置<退出>: "), ptIns, XPoint());
|
|
|
|
int nRet = DragPickSet1(ss, Wcs2Ucs(ptIns)); // cet 2011.8.29 modify 将点转换为ucs
|
|
if(nRet != RTNORM){
|
|
ss.Erase();
|
|
return;
|
|
}
|
|
ptIns.z = ptTmp.z;
|
|
}
|
|
}
|
|
|
|
//***************************************************************************************************
|
|
// 开孔
|
|
//***************************************************************************************************
|
|
|
|
void CreateHole()
|
|
{
|
|
XPoint p1, p2, ptTmp1, ptTmp2, ptInt;
|
|
if(ads_getpoint(NULL, _T("\n请输入第一角点:<退出>"), p1) != RTNORM)
|
|
return;
|
|
p1 = Ucs2Wcs(p1);
|
|
if(ads_getcorner(p1, _T("\n再点取其对角点 <退出>:"), p2) != RTNORM)
|
|
return;
|
|
p2 = Ucs2Wcs(p2);
|
|
XRectAngle rect(p1, p2);
|
|
rect.Make();
|
|
ads_polar(rect.GetLowLeft(), PI/2.5, rect.Height(), ptTmp1);
|
|
ads_polar(rect.GetUpLeft(), PI/4+PI/2*3, rect.Height(), ptTmp2);
|
|
XLine line1(rect.GetLowLeft(), ptTmp1);
|
|
XLine line2(rect.GetUpLeft(), ptTmp2);
|
|
int ret = line1.Intersection(&line2, ptInt);
|
|
if(ret != 1)
|
|
return;
|
|
XLine line3(rect.GetLowLeft(), ptInt, 1);
|
|
line3.Make();
|
|
XLine line4(rect.GetUpRight(), ptInt, 1);
|
|
line4.Make();
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDrawPumpDlg dialog
|
|
|
|
|
|
CDrawPumpDlg::CDrawPumpDlg(int iMode, CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDrawPumpDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CDrawPumpDlg)
|
|
m_iLength = 400;
|
|
m_iWidth = 400;
|
|
m_iType = 1;
|
|
m_iHeight = 1577;
|
|
m_nEle = 0.0;
|
|
m_iInEle = 150;
|
|
m_iOutEle = 450;
|
|
m_csSpec = _T("");
|
|
//}}AFX_DATA_INIT
|
|
m_iMode = iMode;
|
|
m_csBlockFront= _T("pump(00000073)"); //排水点
|
|
m_csBlock3D = _T("00000047");
|
|
}
|
|
|
|
|
|
void CDrawPumpDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDrawPumpDlg)
|
|
DDX_Text(pDX, IDC_EDIT_LENGTH, m_iLength);
|
|
DDX_Text(pDX, IDC_EDIT_WIDTH, m_iWidth);
|
|
DDX_Radio(pDX, IDC_RADIO_TYPE1, m_iType);
|
|
DDX_Text(pDX, IDC_EDIT_HEIGHT, m_iHeight);
|
|
DDX_Text(pDX, IDC_EDIT_ELE, m_nEle);
|
|
DDX_Text(pDX, IDC_EDIT_IN_ELE, m_iInEle);
|
|
DDX_Text(pDX, IDC_EDIT_OUT_ELE, m_iOutEle);
|
|
DDX_Text(pDX, IDC_EDIT_SPEC, m_csSpec);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDrawPumpDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CDrawPumpDlg)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE1, OnRadioType1)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE2, OnRadioType2)
|
|
ON_BN_CLICKED(IDC_BUTTON_SELECT, OnButtonSelect)
|
|
ON_WM_PAINT()
|
|
ON_BN_CLICKED(IDC_PREVIEW1, OnPreview1)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDrawPumpDlg message handlers
|
|
|
|
BOOL CDrawPumpDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
if(m_iMode == 1){
|
|
// CRect rect;
|
|
// this->GetWindowRect(&rect);
|
|
// rect.right -= 155;
|
|
// this->MoveWindow(&rect);
|
|
CWnd *pWnd = GetDlgItem(IDC_BUTTON_SELECT);
|
|
if (pWnd != NULL)
|
|
{
|
|
pWnd->ShowWindow(FALSE);
|
|
}
|
|
}
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
|
|
|
|
|
|
void CDrawPumpDlg::OnRadioType1()
|
|
{
|
|
m_csBlockFront= _T("pump(00000079)");
|
|
m_csBlock3D = _T("00000050");
|
|
OpenSlide();
|
|
}
|
|
|
|
void CDrawPumpDlg::OnRadioType2()
|
|
{
|
|
UpdateData(TRUE);
|
|
if(m_iType == 1){
|
|
m_iLength = m_iWidth;
|
|
UpdateData(FALSE);
|
|
}
|
|
m_csBlockFront= _T("pump(00000073)");
|
|
m_csBlock3D = _T("00000035");
|
|
OpenSlide();
|
|
}
|
|
|
|
void CDrawPumpDlg::OnButtonSelect()
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
CSelectPumpDlg dlg;
|
|
if(dlg.DoModal() != IDOK)
|
|
return;
|
|
// if(dlg.m_csRetSpec == _T("FLG、FLGR")){ //熊猫
|
|
// m_csBlockFront= _T("pump(00000039)");
|
|
// m_csBlock3D = _T("00000049");
|
|
// m_iType = 1;
|
|
// }
|
|
// else if(dlg.m_csRetSpec == _T("FWG、FWGR")){
|
|
// m_csBlockFront= _T("pump(00000042)");
|
|
// m_csBlock3D = _T("00000050");
|
|
// m_iType = 0;
|
|
// }
|
|
// else if(dlg.m_csRetSpec == _T("KQL")){ //凯泉
|
|
// m_csBlockFront= _T("pump(00000054)");
|
|
// m_csBlock3D = _T("00000049");
|
|
// m_iType = 1;
|
|
// }
|
|
// else if(dlg.m_csRetSpec == _T("KQW")){ //凯泉
|
|
// m_csBlockFront= _T("pump(00000053)");
|
|
// m_csBlock3D = _T("00000050");
|
|
// m_iType = 0;
|
|
// }
|
|
// else if(dlg.m_csRetSpec == _T("DL") && dlg.m_lstFactory[dlg.m_iFactory] == _T("上海双轮泵业")){ //双轮
|
|
// m_csBlockFront= _T("pump(00000040)");
|
|
// m_csBlock3D = _T("00000047");
|
|
// m_iType = 1;
|
|
// }
|
|
// else if(dlg.m_csRetSpec == _T("XBD-DN")){ //凯泉
|
|
// m_csBlockFront= _T("pump(00000059)");
|
|
// m_csBlock3D = _T("00000047");
|
|
// m_iType = 1;
|
|
// }
|
|
if(dlg.m_csRetSpec == _T("FLG")){
|
|
m_csBlockFront= _T("pump(00000072)");
|
|
m_csBlock3D = _T("00000049");
|
|
m_iType = 1;
|
|
}
|
|
else if(dlg.m_csRetSpec == _T("FWG")){
|
|
m_csBlockFront= _T("pump(00000078)");
|
|
m_csBlock3D = _T("00000050");
|
|
m_iType = 0;
|
|
}
|
|
else if(dlg.m_csRetSpec == _T("DL") && dlg.m_iFactory == 1){
|
|
m_csBlockFront= _T("pump(00000073)");
|
|
m_csBlock3D = _T("00000047");
|
|
m_iType = 1;
|
|
}
|
|
else if(dlg.m_csRetSpec == _T("SLS")){
|
|
m_csBlockFront= _T("pump(00000077)");
|
|
m_csBlock3D = _T("00000049");
|
|
m_iType = 1;
|
|
}
|
|
else if(dlg.m_csRetSpec == _T("GDL")){
|
|
m_csBlockFront= _T("pump(00000076)");
|
|
m_csBlock3D = _T("00000047");
|
|
m_iType = 1;
|
|
}
|
|
else if(dlg.m_csRetSpec == _T("SLW")){
|
|
m_csBlockFront= _T("pump(00000080)");
|
|
m_csBlock3D = _T("00000050");
|
|
m_iType = 0;
|
|
}
|
|
else if(dlg.m_csRetSpec == _T("DFL")){
|
|
m_csBlockFront= _T("pump(00000074)");
|
|
m_csBlock3D = _T("00000047");
|
|
m_iType = 1;
|
|
}
|
|
else if(dlg.m_csRetSpec == _T("DL")){
|
|
m_csBlockFront= _T("pump(00000075)");
|
|
m_csBlock3D = _T("00000047");
|
|
m_iType = 1;
|
|
}
|
|
else if(dlg.m_csRetSpec == _T("DFW")){
|
|
m_csBlockFront= _T("pump(00000079)");
|
|
m_csBlock3D = _T("00000050");
|
|
m_iType = 0;
|
|
}
|
|
else{//IS
|
|
m_iType = 0;
|
|
m_csBlockFront= _T("pump(00000041)");
|
|
m_csBlock3D = _T("00000050");
|
|
}
|
|
UpdateData(FALSE);
|
|
m_iLength = dlg.m_iLenght;
|
|
m_iHeight = dlg.m_iHeight;
|
|
m_iWidth = dlg.m_iWidth;
|
|
m_iInEle = (int)dlg.m_nRetH;
|
|
m_iOutEle = (int)dlg.m_nRetH3;
|
|
m_csSpec = dlg.m_csRetPumpSpec;
|
|
UpdateData(FALSE);
|
|
OpenSlide();
|
|
}
|
|
|
|
void CDrawPumpDlg::OnPaint()
|
|
{
|
|
CPaintDC dc(this); // device context for painting
|
|
OpenSlide();
|
|
|
|
// ZXL 2013.11.01 ADD
|
|
if(m_csBlockFront == _T("pump(00000039)") || m_csBlockFront == _T("pump(00000054)") || m_csBlockFront == _T("pump(00000072)") || m_csBlockFront == _T("pump(00000077)"))
|
|
{
|
|
m_csBlock3D = _T("00000049");
|
|
}
|
|
else if(m_csBlockFront == _T("pump(00000042)") || m_csBlockFront == _T("pump(00000053)") || m_csBlockFront == _T("pump(00000078)") || m_csBlockFront == _T("pump(00000080)") || m_csBlockFront == _T("pump(00000079)"))
|
|
{
|
|
m_csBlock3D = _T("00000050");
|
|
}
|
|
else
|
|
{
|
|
m_csBlock3D = _T("00000047");
|
|
}
|
|
}
|
|
|
|
void CDrawPumpDlg::OpenSlide()
|
|
{
|
|
UpdateData(TRUE);
|
|
CWnd *pImageBox = GetDlgItem(IDC_PREVIEW1);
|
|
DrawSlide((const TCHAR*)m_csBlockFront, pImageBox);
|
|
}
|
|
|
|
void CDrawPumpDlg::OnPreview1()
|
|
{
|
|
UpdateData(TRUE);
|
|
CTemporaryResourceOverride vTemp;
|
|
CSelectBlkDlg dlg;
|
|
dlg.m_csTkName = _T("PUMP");
|
|
if(m_iType == 0)
|
|
dlg.m_csType = _T("卧式立面");
|
|
else
|
|
dlg.m_csType = _T("立式立面");
|
|
|
|
CWnd *pWnd = GetDlgItem(IDC_PREVIEW1);
|
|
CRect rect;
|
|
dlg.m_staticSlide.m_csCurRecord = m_csBlockFront;
|
|
pWnd->GetWindowRect(&rect);
|
|
dlg.m_ptBase = rect.TopLeft();
|
|
if(dlg.DoModal() == IDOK){
|
|
CString csRet = dlg.m_staticSlide.m_csCurRecord;
|
|
XString xsTKName, xsRocord;
|
|
SplitSlbName(csRet, xsTKName, xsRocord);
|
|
csRet.Format(_T("%s(%s)"), dlg.m_csTkName, xsRocord);
|
|
m_csBlockFront = csRet;
|
|
OpenSlide();
|
|
}
|
|
}
|