762 lines
22 KiB
C++
762 lines
22 KiB
C++
// AccessoryDrainDlg.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
|
|
#include "DbEquipment.h"
|
|
#include "AcDbObjectPtr.h"
|
|
#include "DbPipe.h"
|
|
#include "PickEntSet.h"
|
|
#include "TBlockEdJig.h"
|
|
#include "AccessoryDrainDlg.h"
|
|
#include "SelectBlkDlg.h"
|
|
#include "SanitaryDangDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAccessoryDrainDlg dialog
|
|
|
|
void ReplaceDrainAccessory(CAccessoryDrainDlg *pDlg, double nScale, PickSet &ss)
|
|
{
|
|
CString csDwb = g_csDwbPath + _T("TwtSys");
|
|
XString xsTmp1, xsTmp2, xsTmp3, xsTmp4, xsTmp5, xsTmp6, xsTmp7, xsTmp8, xsTmp9, xsTmp10, xsTmp11, xsTmp12;
|
|
XString xsTmp13;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000147"), xsTmp1) != RTNORM)//排水点
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000141"), xsTmp2) != RTNORM)//圆地漏
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000137"), xsTmp3) != RTNORM)//方地漏
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000136"), xsTmp4) != RTNORM)//清扫口
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000139"), xsTmp5) != RTNORM)//雨水斗
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000140"), xsTmp6) != RTNORM)//毛发聚集器
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000138"), xsTmp7) != RTNORM)//排水漏斗
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000329"), xsTmp8) != RTNORM)//防爆地漏
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000327"), xsTmp9) != RTNORM)//两用地漏
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000328"), xsTmp10) != RTNORM)//多通道地漏
|
|
return;
|
|
if(g_Option::instance().g_bBlk3D){
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000362"), xsTmp11) != RTNORM)//S存水弯
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000363"), xsTmp12) != RTNORM)//P存水弯
|
|
return;
|
|
}
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000543"), xsTmp13) != RTNORM)//洗衣机地漏 cet 2013.1.5 add
|
|
return;
|
|
|
|
AcDbObjectId recordId1 = GlobalFunc::GetBlockIdFromString(xsTmp1);
|
|
AcDbObjectId recordId2 = GlobalFunc::GetBlockIdFromString(xsTmp2);
|
|
AcDbObjectId recordId3 = GlobalFunc::GetBlockIdFromString(xsTmp3);
|
|
AcDbObjectId recordId4 = GlobalFunc::GetBlockIdFromString(xsTmp4);
|
|
AcDbObjectId recordId5 = GlobalFunc::GetBlockIdFromString(xsTmp5);
|
|
AcDbObjectId recordId6 = GlobalFunc::GetBlockIdFromString(xsTmp6);
|
|
AcDbObjectId recordId7 = GlobalFunc::GetBlockIdFromString(xsTmp7);
|
|
AcDbObjectId recordId8 = GlobalFunc::GetBlockIdFromString(xsTmp8);
|
|
AcDbObjectId recordId9 = GlobalFunc::GetBlockIdFromString(xsTmp9);
|
|
AcDbObjectId recordId10 = GlobalFunc::GetBlockIdFromString(xsTmp10);
|
|
AcDbObjectId recordId11 = GlobalFunc::GetBlockIdFromString(xsTmp11);
|
|
AcDbObjectId recordId12 = GlobalFunc::GetBlockIdFromString(xsTmp12);
|
|
AcDbObjectId recordId13 = GlobalFunc::GetBlockIdFromString(xsTmp13); // cet 2013.1.5 add
|
|
|
|
pDlg->UpdateData();
|
|
if(pDlg->m_iType == 0)
|
|
g_Option::instance().g_csInsBlkName = xsTmp1;
|
|
else if(pDlg->m_iType == 1)
|
|
g_Option::instance().g_csInsBlkName = xsTmp2;
|
|
else if(pDlg->m_iType == 2)
|
|
g_Option::instance().g_csInsBlkName = xsTmp3;
|
|
else if(pDlg->m_iType == 3)
|
|
g_Option::instance().g_csInsBlkName = xsTmp4;
|
|
else if(pDlg->m_iType == 4)
|
|
g_Option::instance().g_csInsBlkName = xsTmp5;
|
|
else if(pDlg->m_iType == 5)
|
|
g_Option::instance().g_csInsBlkName = xsTmp6;
|
|
else if(pDlg->m_iType == 6)
|
|
g_Option::instance().g_csInsBlkName = xsTmp7;
|
|
else if(pDlg->m_iType == 7)
|
|
g_Option::instance().g_csInsBlkName = xsTmp8;
|
|
else if(pDlg->m_iType == 8)
|
|
g_Option::instance().g_csInsBlkName = xsTmp9;
|
|
else if(pDlg->m_iType == 9)
|
|
g_Option::instance().g_csInsBlkName = xsTmp10;
|
|
else if(pDlg->m_iType == 10)
|
|
g_Option::instance().g_csInsBlkName = xsTmp2;
|
|
else if(pDlg->m_iType == 11) // cet 2013.1.5 add
|
|
g_Option::instance().g_csInsBlkName = xsTmp13;
|
|
|
|
AcDbObjectId recordId = GlobalFunc::GetBlkIdByName(g_Option::instance().g_csInsBlkName);
|
|
AcDbObjectId idRef;
|
|
long len = ss.Length();
|
|
for(long i=0;i<len;i++)
|
|
{
|
|
Entity ent = ss[i];
|
|
OPENOBJ_BEGIN(ent, AcDb::kForWrite, CDbEquipment, pEquip);
|
|
idRef = pEquip->GetBlock2d();
|
|
if(recordId1 != idRef && recordId2 != idRef && recordId3 != idRef && recordId4 != idRef && recordId5 != idRef
|
|
&& recordId6 != idRef && recordId7 != idRef && recordId8 != idRef && recordId9 != idRef && recordId10 != idRef
|
|
&& recordId11 != idRef && recordId12 != idRef && recordId13 != idRef)
|
|
{
|
|
continue;
|
|
}
|
|
pEquip->SetBlock2d(recordId);
|
|
pEquip->SetScale(nScale);
|
|
pEquip->SetDang(pDlg->m_nNg);
|
|
pEquip->SetSpare(pDlg->m_nBigQ);
|
|
pEquip->SetSysBlock((const TCHAR*)pDlg->m_csSysBlk);
|
|
|
|
extern TCHAR *LAY_EQUIP_LEAK;
|
|
extern TCHAR *LAY_EQUIP_GULLY;
|
|
extern TCHAR *LAY_EQ_DIRT;
|
|
|
|
CString dd = LAY_EQUIP_LEAK;
|
|
if(pDlg->m_iType == 1 || pDlg->m_iType == 2 || pDlg->m_iType == 7 || pDlg->m_iType == 8 || pDlg->m_iType == 9 || pDlg->m_iType == 10 || pDlg->m_iType == 11) // cet 2013.1.5 modify 增加洗衣机地漏
|
|
pEquip->setLayer(LAY_EQUIP_LEAK);
|
|
else if(pDlg->m_iType == 4)
|
|
pEquip->setLayer(LAY_EQUIP_GULLY);
|
|
else
|
|
pEquip->setLayer(LAY_EQ_DIRT);
|
|
|
|
pEquip->SetNumber(_T(""));
|
|
if(pDlg->m_iType == 1 || pDlg->m_iType == 3 || pDlg->m_iType == 4 || pDlg->m_iType == 5 || pDlg->m_iType == 6 || pDlg->m_iType == 7 || pDlg->m_iType == 8 || pDlg->m_iType == 9)
|
|
pEquip->SetNumber(_T("CIRCLE-94"));
|
|
else if(pDlg->m_iType == 0){
|
|
if(_tcsicmp(pDlg->m_csSysBlk, _T("TWTSYS(00000101)")) == 0 || _tcsicmp(pDlg->m_csSysBlk, _T("TWTSYS(00000102)")) == 0)
|
|
pEquip->SetBlock3d(GlobalFunc::GetBlockIdFromString(xsTmp11));
|
|
else if(_tcsicmp(pDlg->m_csSysBlk, _T("TWTSYS(00000103)")) == 0)
|
|
pEquip->SetBlock3d(GlobalFunc::GetBlockIdFromString(xsTmp12));
|
|
pEquip->SetNumber(_T("CIRCLE-1"));
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
|
|
}
|
|
|
|
extern CString GetLayerNames(const TCHAR * szTgSubName);
|
|
extern AcDbObjectId InitLayer(const TCHAR *szLayer, AcDbDatabase *pDb = NULL);
|
|
void InsDrainAccessory()
|
|
{
|
|
CString csDwb = g_csDwbPath + _T("TwtSys");
|
|
XString xsTmp1, xsTmp2, xsTmp3, xsTmp4, xsTmp5, xsTmp6, xsTmp7, xsTmp8, xsTmp9, xsTmp10, xsTmp11, xsTmp12;
|
|
XString xsTmp13; // cet 2013.1.5 add
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000147"), xsTmp1) != RTNORM)//排水点
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000141"), xsTmp2) != RTNORM)//圆地漏
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000137"), xsTmp3) != RTNORM)//方地漏
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000136"), xsTmp4) != RTNORM)//清扫口
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000139"), xsTmp5) != RTNORM)//雨水斗
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000140"), xsTmp6) != RTNORM)//毛发聚集器
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000138"), xsTmp7) != RTNORM)//排水漏斗
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000329"), xsTmp8) != RTNORM)//防爆地漏
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000327"), xsTmp9) != RTNORM)//两用地漏
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000328"), xsTmp10) != RTNORM)//多通道地漏
|
|
return;
|
|
if(g_Option::instance().g_bBlk3D){
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000362"), xsTmp11) != RTNORM)//S存水弯
|
|
return;
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000363"), xsTmp12) != RTNORM)//P存水弯
|
|
return;
|
|
}
|
|
if(GlobalFunc::LoadDwbBlock(csDwb, _T("00000543"), xsTmp13) != RTNORM)//洗衣机地漏 cet 2013.1.5 add
|
|
return;
|
|
|
|
int nOsMode=0;
|
|
xg_getvar(_T("OSMODE"), &nOsMode);
|
|
nOsMode &= ~0x4000;
|
|
nOsMode |= OS_INT|OS_NEA;
|
|
XPushVar<int> vOsMode(_T("OSMODE"), nOsMode);
|
|
CAccessoryDrainDlg dlg(acedGetAcadFrame());
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
dlg.Create(IDD_ACCESSORY_DRAIN, acedGetAcadFrame());
|
|
dlg.ShowWindow(SW_SHOW);
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
extern TCHAR *LAY_EQ_DIRT;
|
|
extern TCHAR *LAY_EQUIP_LEAK;
|
|
extern TCHAR *LAY_EQUIP_GULLY;
|
|
|
|
XPoint ptIns;
|
|
InitLayer(LAY_EQ_DIRT);
|
|
InitLayer(LAY_EQUIP_LEAK);
|
|
InitLayer(LAY_EQUIP_GULLY);
|
|
RBList rbMaskPipe(RTDXF0, _T("ATS_PIPE"), 8, GetLayerNames(_T("管")), NULL);
|
|
g_Option::instance().g_nInsBlkRotate = 0;
|
|
double nScale = 1;
|
|
if(dlg.m_iType == 0)
|
|
nScale = g_Option::instance().g_nDrainPtRadius;
|
|
while(1){
|
|
dlg.UpdateData();
|
|
if(dlg.m_iType == 0)
|
|
g_Option::instance().g_csInsBlkName = xsTmp1;
|
|
else if(dlg.m_iType == 1)
|
|
g_Option::instance().g_csInsBlkName = xsTmp2;
|
|
else if(dlg.m_iType == 2)
|
|
g_Option::instance().g_csInsBlkName = xsTmp3;
|
|
else if(dlg.m_iType == 3)
|
|
g_Option::instance().g_csInsBlkName = xsTmp4;
|
|
else if(dlg.m_iType == 4)
|
|
g_Option::instance().g_csInsBlkName = xsTmp5;
|
|
else if(dlg.m_iType == 5)
|
|
g_Option::instance().g_csInsBlkName = xsTmp6;
|
|
else if(dlg.m_iType == 6)
|
|
g_Option::instance().g_csInsBlkName = xsTmp7;
|
|
else if(dlg.m_iType == 7)
|
|
g_Option::instance().g_csInsBlkName = xsTmp8;
|
|
else if(dlg.m_iType == 8)
|
|
g_Option::instance().g_csInsBlkName = xsTmp9;
|
|
else if(dlg.m_iType == 9)
|
|
g_Option::instance().g_csInsBlkName = xsTmp10;
|
|
else if(dlg.m_iType == 10)
|
|
g_Option::instance().g_csInsBlkName = xsTmp2;
|
|
else if (dlg.m_iType == 11) // cet 2013.1.5 add
|
|
g_Option::instance().g_csInsBlkName = xsTmp13;
|
|
|
|
TBlockEdJig jig(g_Option::instance().g_csInsBlkName, ptIns, nScale);
|
|
|
|
// jig.SetPrompt(_T("\n请指定附件在管线上的插入点[放大(E)/缩小(D)]<退出>:"));
|
|
// jig.SetKeyword(_T("E D R"));
|
|
|
|
jig.SetPrompt(_T("\n请指定附件在管线上的插入点[放大(E)/缩小(D)/替换(S)]<退出>:"));
|
|
jig.SetKeyword(_T("E D R S"));
|
|
int nKeyIndex = 0;
|
|
int nRetCode = jig.DoIt(&nKeyIndex);
|
|
if(nRetCode == RTNORM){
|
|
ptIns = jig.GetPickPoint();
|
|
|
|
AcDbObjectId recordId = GlobalFunc::GetBlockIdFromString(g_Option::instance().g_csInsBlkName);
|
|
|
|
PickSet ss(SS_FREE);
|
|
XPoint ptUcs = GlobalFunc::Wcs2Ucs(ptIns);
|
|
GlobalFunc::GetPointPickSet(ptUcs, ss, rbMaskPipe, 50);
|
|
double nAng = g_Option::instance().g_nInsBlkRotate;
|
|
|
|
if(ss.Length() == 1){ //管件插入在管线上
|
|
Entity entPipe = ss[0L];
|
|
BOOL bFlag = FALSE;
|
|
OPENOBJ_BEGIN(entPipe, AcDb::kForRead, CDbPipe, pPipe);
|
|
XCurveSegment seg(pPipe->StartPoint(), pPipe->EndPoint(), 0);
|
|
seg.ProjectToMe(ptIns, ptIns);
|
|
|
|
nAng = ads_angle(seg.EndPoint(), seg.StartPoint());
|
|
XPoint ptPickPipe;
|
|
if(ads_getpoint(ptUcs, _T("\n请点取引出管线端点:"), ptPickPipe) == RTNORM){
|
|
ptPickPipe = GlobalFunc::Ucs2Wcs(ptPickPipe);
|
|
CDbPipe *pNewPipe2 = (CDbPipe *)pPipe->clone();
|
|
dlg.UpdateData(TRUE);
|
|
if (dlg.m_nDimNewPipe == 1 && pPipe->IsDrawLabel())
|
|
{
|
|
pNewPipe2->EnableDrawLabel(FALSE);
|
|
}
|
|
ptPickPipe.z = ptIns.z;
|
|
pNewPipe2->SetPoints(ptIns, ptPickPipe);
|
|
GlobalFunc::AddToCurrentSpace(pNewPipe2, Adesk::kTrue);
|
|
nAng = ads_angle(ptIns, ptPickPipe);
|
|
nAng += PI/2;
|
|
ptIns = ptPickPipe;
|
|
}
|
|
else
|
|
bFlag = TRUE;
|
|
|
|
OPENOBJ_END();
|
|
}
|
|
CDbEquipment *pEquip = new CDbEquipment;
|
|
pEquip->SetBlock2d(recordId);
|
|
pEquip->SetHidePipe(TRUE);
|
|
pEquip->SetLocation(ptIns);
|
|
pEquip->SetDang(dlg.m_nNg);
|
|
pEquip->SetSpare(dlg.m_nBigQ);
|
|
pEquip->SetAngle(nAng);
|
|
pEquip->SetScale(nScale);
|
|
pEquip->SetSysBlock((const TCHAR*)dlg.m_csSysBlk);
|
|
CString dd = LAY_EQUIP_LEAK;
|
|
if(dlg.m_iType == 1 || dlg.m_iType == 2 || dlg.m_iType == 7 || dlg.m_iType == 8 || dlg.m_iType == 9 || dlg.m_iType == 10 || dlg.m_iType == 11) // cet 2013.1.5 modify 增加洗衣机地漏
|
|
pEquip->setLayer(LAY_EQUIP_LEAK);
|
|
else if(dlg.m_iType == 4)
|
|
pEquip->setLayer(LAY_EQUIP_GULLY);
|
|
else
|
|
pEquip->setLayer(LAY_EQ_DIRT);
|
|
if(dlg.m_iType == 1 || dlg.m_iType == 3 || dlg.m_iType == 4 || dlg.m_iType == 5 || dlg.m_iType == 6 || dlg.m_iType == 7 || dlg.m_iType == 8 || dlg.m_iType == 9)
|
|
pEquip->SetNumber(_T("CIRCLE-94"));
|
|
else if(dlg.m_iType == 0){
|
|
if(_tcsicmp(dlg.m_csSysBlk, _T("TWTSYS(00000101)")) == 0 || _tcsicmp(dlg.m_csSysBlk, _T("TWTSYS(00000102)")) == 0)
|
|
pEquip->SetBlock3d(GlobalFunc::GetBlockIdFromString(xsTmp11));
|
|
else if(_tcsicmp(dlg.m_csSysBlk, _T("TWTSYS(00000103)")) == 0)
|
|
pEquip->SetBlock3d(GlobalFunc::GetBlockIdFromString(xsTmp12));
|
|
pEquip->SetNumber(_T("CIRCLE-1"));
|
|
}
|
|
pEquip->setColor(AcCmColor()); //随层
|
|
GlobalFunc::AddToCurrentSpace(pEquip, Adesk::kTrue);
|
|
//TPipePerDocData *pData = GetCurPipeDocData();
|
|
//pData->ApplyUpdates();
|
|
|
|
}
|
|
else if(nRetCode == RTKWORD){
|
|
if(nKeyIndex == 0)
|
|
nScale += 1;
|
|
else if(nKeyIndex == 1 && jig.m_nSacle > 1)
|
|
nScale -= 1;
|
|
else if (nKeyIndex == 3)//替换
|
|
{
|
|
PickSet ss(SS_FREE);
|
|
dlg.SetReplaceEQ(ss);
|
|
ReplaceDrainAccessory(&dlg, nScale, ss);
|
|
}
|
|
else{
|
|
nScale = 1;
|
|
if(dlg.m_iType == 0)
|
|
nScale = g_Option::instance().g_nDrainPtRadius;
|
|
}
|
|
continue;
|
|
}
|
|
else
|
|
break;
|
|
}
|
|
g_Option::instance().g_nInsBlkRotate = 0;
|
|
dlg.DestroyWindow();
|
|
//TPipePerDocData *pData = GetCurPipeDocData();
|
|
//pData->ApplyUpdates();
|
|
}
|
|
|
|
|
|
int CAccessoryDrainDlg::m_iType = 0;
|
|
int CAccessoryDrainDlg::m_nDimNewPipe = 0;
|
|
IMPLEMENT_DYNAMIC(CAccessoryDrainDlg, CDialog)
|
|
|
|
CAccessoryDrainDlg::CAccessoryDrainDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CAccessoryDrainDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CAccessoryDrainDlg)
|
|
m_nNg = 1;
|
|
m_nBigQ = 0.33;
|
|
//}}AFX_DATA_INIT
|
|
m_csSysBlk1 = _T("TWTSYS(00000101)"); //排水点
|
|
m_csSysBlk2 = _T("TWTSYS(00000079)"); //圆地漏
|
|
m_csSysBlk3 = _T("TWTSYS(00000082)"); //方地漏
|
|
m_csSysBlk4 = _T("TWTSYS(00000426)"); //清扫口
|
|
m_csSysBlk5 = _T("TWTSYS(00000080)"); //雨水斗
|
|
m_csSysBlk6 = _T("TWTSYS(00000083)"); //毛发聚集器
|
|
m_csSysBlk7 = _T("TWTSYS(00000084)"); //排水漏斗
|
|
m_csSysBlk8 = _T("TWTSYS(00000310)"); //防爆地漏
|
|
m_csSysBlk9 = _T("TWTSYS(00000325)"); //两用地漏
|
|
m_csSysBlk10 = _T("TWTSYS(00000326)");//多通道地漏
|
|
m_csSysBlk11 = _T("TWTSYS(00000408)");//存水地漏
|
|
m_csSysBlk12 = _T("TWTSYS(00000544)");//洗衣机地漏 cet 2012.1.5 add
|
|
|
|
}
|
|
|
|
void CAccessoryDrainDlg::SetReplaceEQ(PickSet &ss)
|
|
{
|
|
RBList rbMask(RTDXF0, _T("ATS_EQUIPMENT"), 8, _T("*"), NULL);
|
|
int ret = GlobalFunc::SelectEntities(_T("\n请选取图中要被替换的排水附件<退出>:"), ss, rbMask);
|
|
if(ret != RTNORM)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
void CAccessoryDrainDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CAccessoryDrainDlg)
|
|
DDX_Radio(pDX, IDC_RADIO_TYPE1, m_iType);
|
|
DDX_Text(pDX, IDC_EDIT_DANG, m_nNg);
|
|
DDX_Text(pDX, IDC_EDIT_Q, m_nBigQ);
|
|
//}}AFX_DATA_MAP
|
|
DDX_Radio(pDX, IDC_RADIO_DIM, m_nDimNewPipe);
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CAccessoryDrainDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CAccessoryDrainDlg)
|
|
ON_MESSAGE(WM_ACAD_KEEPFOCUS,onAcadKeepFocus)
|
|
ON_WM_PAINT()
|
|
ON_WM_CLOSE()
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE1, OnRadioType1)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE2, OnRadioType2)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE3, OnRadioType3)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE4, OnRadioType4)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE5, OnRadioType5)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE6, OnRadioType6)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE7, OnRadioType7)
|
|
ON_BN_CLICKED(IDC_PREVIEW2, OnPreview2)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE8, OnRadioType8)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE9, OnRadioType9)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE10, OnRadioType10)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE11, OnRadioType11)
|
|
ON_BN_CLICKED(IDC_RADIO_TYPE12, OnRadioType12)
|
|
ON_BN_CLICKED(IDC_BUTTON_DANG, OnButtonDang)
|
|
//}}AFX_MSG_MAP
|
|
ON_BN_CLICKED(IDC_RADIO_DIM, &CAccessoryDrainDlg::OnBnClickedRadioDim)
|
|
ON_BN_CLICKED(IDC_RADIO_NODIM, &CAccessoryDrainDlg::OnBnClickedRadioNodim)
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CAccessoryDrainDlg message handlers
|
|
|
|
BOOL CAccessoryDrainDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
OpenSlide();
|
|
|
|
if(m_iType != 0)
|
|
{
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
// cet 2013.1.5 add
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd != NULL)
|
|
{
|
|
if (m_iType == 0)
|
|
{
|
|
pWnd->ShowWindow(SW_SHOW);
|
|
}
|
|
else
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
}
|
|
|
|
return TRUE; // return TRUE unless you set the focus to a control
|
|
// EXCEPTION: OCX Property Pages should return FALSE
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnPaint()
|
|
{
|
|
CPaintDC dc(this); // device context for painting
|
|
OpenSlide();
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnClose()
|
|
{
|
|
CDialog::OnClose();
|
|
acedPostCommand(_T("\33\33"));
|
|
}
|
|
|
|
LONG_PTR CAccessoryDrainDlg::onAcadKeepFocus(UINT_PTR, LONG_PTR)
|
|
{
|
|
//return FALSE;
|
|
return TRUE;
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OpenSlide()
|
|
{
|
|
UpdateData(TRUE);
|
|
CWnd *pImageBox1 = GetDlgItem(IDC_PREVIEW1);
|
|
CWnd *pImageBox2 = GetDlgItem(IDC_PREVIEW2);
|
|
CString csSldName, csSldName2;
|
|
if(m_iType == 0){
|
|
csSldName = _T("TWTSYS(00000147)"); //排水点
|
|
csSldName2 = m_csSysBlk1;
|
|
}
|
|
else if(m_iType == 1){
|
|
csSldName = _T("TWTSYS(00000141)");//圆地漏
|
|
csSldName2 = m_csSysBlk2;
|
|
}
|
|
else if(m_iType == 2){
|
|
csSldName = _T("TWTSYS(00000137)");//方地漏
|
|
csSldName2 = m_csSysBlk3;
|
|
}
|
|
else if(m_iType == 3){
|
|
csSldName = _T("TWTSYS(00000136)");//清扫口
|
|
csSldName2 = m_csSysBlk4;
|
|
}
|
|
else if(m_iType == 4){
|
|
csSldName = _T("TWTSYS(00000139)");//雨水斗
|
|
csSldName2 = m_csSysBlk5;
|
|
}
|
|
else if(m_iType == 5){
|
|
csSldName = _T("TWTSYS(00000140)");//毛发聚集器
|
|
csSldName2 = m_csSysBlk6;
|
|
}
|
|
else if(m_iType == 6){
|
|
csSldName = _T("TWTSYS(00000138)");//排水漏斗
|
|
csSldName2 = m_csSysBlk7;
|
|
}
|
|
else if(m_iType == 7){
|
|
csSldName = _T("TWTSYS(00000329)");//防爆地漏
|
|
csSldName2 = m_csSysBlk8;
|
|
}
|
|
else if(m_iType == 8){
|
|
csSldName = _T("TWTSYS(00000327)");//两用地漏
|
|
csSldName2 = m_csSysBlk9;
|
|
}
|
|
else if(m_iType == 9){
|
|
csSldName = _T("TWTSYS(00000328)");//多通道地漏
|
|
csSldName2 = m_csSysBlk10;
|
|
}
|
|
else if(m_iType == 10){
|
|
csSldName = _T("TWTSYS(00000141)");//存水地漏
|
|
csSldName2 = m_csSysBlk11;
|
|
}
|
|
else if(m_iType == 11){ // cet 2013.1.5 add
|
|
csSldName = _T("TWTSYS(00000543)");//洗衣机地漏
|
|
csSldName2 = m_csSysBlk12;
|
|
}
|
|
m_csSysBlk = csSldName2;
|
|
// csSldName = g_csDwbPath + csSldName;
|
|
if (pImageBox1)
|
|
GlobalFunc::DrawSlide((const TCHAR*)csSldName, pImageBox1);
|
|
if (pImageBox2)
|
|
GlobalFunc::DrawSlide((const TCHAR*)csSldName2, pImageBox2);
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType1()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 1;
|
|
m_nBigQ = 0.33;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_SHOW);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType2()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType3()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType4()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType5()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType6()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType7()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType8()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
void CAccessoryDrainDlg::OnRadioType9()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType10()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType11()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnRadioType12()
|
|
{
|
|
UpdateData(TRUE);
|
|
m_nNg = 0;
|
|
m_nBigQ = 0;
|
|
UpdateData(FALSE);
|
|
CWnd *pWnd = GetDlgItem(IDC_STATIC_NEXT);
|
|
if (pWnd)
|
|
{
|
|
pWnd->ShowWindow(SW_HIDE);
|
|
}
|
|
OpenSlide();
|
|
GlobalFunc::PostCommand(_T("R "), false);
|
|
}
|
|
|
|
|
|
void CAccessoryDrainDlg::OnPreview2()
|
|
{
|
|
UpdateData();
|
|
if(m_iType != 0)
|
|
return;
|
|
CTemporaryResourceOverride vTemp;
|
|
CSelectBlkDlg dlg;
|
|
dlg.m_csTkName = _T("TWTSYS");
|
|
dlg.m_csType = _T("排水点\\90度");
|
|
CWnd *pWnd = GetDlgItem(IDC_PREVIEW2);
|
|
if (pWnd)
|
|
{
|
|
CRect rect;
|
|
dlg.m_staticSlide.m_csCurRecord = m_csSysBlk1;
|
|
pWnd->GetWindowRect(&rect);
|
|
dlg.m_ptBase = rect.TopLeft();
|
|
if (dlg.DoModal() == IDOK) {
|
|
CString csRet = dlg.m_staticSlide.m_csCurRecord;
|
|
XString xsTKName, xsRocord;
|
|
GlobalFunc::SplitSlbName(csRet, xsTKName, xsRocord);
|
|
csRet.Format(_T("%s(%s)"), dlg.m_csTkName, xsRocord);
|
|
|
|
m_csSysBlk1 = csRet;
|
|
OpenSlide();
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void CAccessoryDrainDlg::OnButtonDang()
|
|
{
|
|
CTemporaryResourceOverride vTemp;
|
|
CSanitaryDangDlg dlg;
|
|
dlg.m_iMode = 1;
|
|
// dlg.m_bMultSel = TRUE;
|
|
if(dlg.DoModal() == IDOK){
|
|
m_nNg = dlg.m_nRet;
|
|
m_nBigQ = dlg.m_nRet2;
|
|
UpdateData(FALSE);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
void CAccessoryDrainDlg::OnBnClickedRadioDim()
|
|
{
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|
|
|
|
void CAccessoryDrainDlg::OnBnClickedRadioNodim()
|
|
{
|
|
acedGetAcadDwgView()->SetFocus();
|
|
}
|