2026-10-04 00:04:20 +08:00
// AccessoryDrainDlg.cpp : implementation file
2026-09-28 15:28:50 +08:00
//
#include "stdafx.h"
#include <DbEquipment.h>
#include <PipeWireMonitor.h>
#include "AccessoryDrainDlg.h"
#include "InsBlockDlg.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 ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000147" ), xsTmp1 ) != RTNORM ) //排水点
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000141" ), xsTmp2 ) != RTNORM ) //圆地漏
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000137" ), xsTmp3 ) != RTNORM ) //方地漏
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000136" ), xsTmp4 ) != RTNORM ) //清扫口
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000139" ), xsTmp5 ) != RTNORM ) //雨水斗
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000140" ), xsTmp6 ) != RTNORM ) //毛发聚集器
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000138" ), xsTmp7 ) != RTNORM ) //排水漏斗
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000329" ), xsTmp8 ) != RTNORM ) //防爆地漏
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000327" ), xsTmp9 ) != RTNORM ) //两用地漏
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000328" ), xsTmp10 ) != RTNORM ) //多通道地漏
2026-09-28 15:28:50 +08:00
return ;
if ( g_bBlk3D ){
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000362" ), xsTmp11 ) != RTNORM ) //S存水弯
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000363" ), xsTmp12 ) != RTNORM ) //P存水弯
2026-09-28 15:28:50 +08:00
return ;
}
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000543" ), xsTmp13 ) != RTNORM ) //洗衣机地漏 cet 2013.1.5 add
2026-09-28 15:28:50 +08:00
return ;
AcDbObjectId recordId1 = GetBlockIdFromString ( xsTmp1 );
AcDbObjectId recordId2 = GetBlockIdFromString ( xsTmp2 );
AcDbObjectId recordId3 = GetBlockIdFromString ( xsTmp3 );
AcDbObjectId recordId4 = GetBlockIdFromString ( xsTmp4 );
AcDbObjectId recordId5 = GetBlockIdFromString ( xsTmp5 );
AcDbObjectId recordId6 = GetBlockIdFromString ( xsTmp6 );
AcDbObjectId recordId7 = GetBlockIdFromString ( xsTmp7 );
AcDbObjectId recordId8 = GetBlockIdFromString ( xsTmp8 );
AcDbObjectId recordId9 = GetBlockIdFromString ( xsTmp9 );
AcDbObjectId recordId10 = GetBlockIdFromString ( xsTmp10 );
AcDbObjectId recordId11 = GetBlockIdFromString ( xsTmp11 );
AcDbObjectId recordId12 = GetBlockIdFromString ( xsTmp12 );
AcDbObjectId recordId13 = GetBlockIdFromString ( xsTmp13 ); // cet 2013.1.5 add
pDlg -> UpdateData ();
if ( pDlg -> m_iType == 0 )
g_csInsBlkName = xsTmp1 ;
else if ( pDlg -> m_iType == 1 )
g_csInsBlkName = xsTmp2 ;
else if ( pDlg -> m_iType == 2 )
g_csInsBlkName = xsTmp3 ;
else if ( pDlg -> m_iType == 3 )
g_csInsBlkName = xsTmp4 ;
else if ( pDlg -> m_iType == 4 )
g_csInsBlkName = xsTmp5 ;
else if ( pDlg -> m_iType == 5 )
g_csInsBlkName = xsTmp6 ;
else if ( pDlg -> m_iType == 6 )
g_csInsBlkName = xsTmp7 ;
else if ( pDlg -> m_iType == 7 )
g_csInsBlkName = xsTmp8 ;
else if ( pDlg -> m_iType == 8 )
g_csInsBlkName = xsTmp9 ;
else if ( pDlg -> m_iType == 9 )
g_csInsBlkName = xsTmp10 ;
else if ( pDlg -> m_iType == 10 )
g_csInsBlkName = xsTmp2 ;
else if ( pDlg -> m_iType == 11 ) // cet 2013.1.5 add
g_csInsBlkName = xsTmp13 ;
AcDbObjectId recordId = GetBlkIdByName ( g_csInsBlkName );
AcDbObjectId idRef ;
long len = ss . Length ();
for ( long i = 0 ; i < len ; i ++ )
{
Entity ent = ss [ i ];
OPENOBJ_BEGIN ( ent , AcDb :: kForWrite , TDbEquipment , 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 );
CString dd = LAY_EQUIP_LEAK ;
2026-10-04 00:04:20 +08:00
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 增加洗衣机地漏
2026-09-28 15:28:50 +08:00
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 ( GetBlockIdFromString ( xsTmp11 ));
else if ( _tcsicmp ( pDlg -> m_csSysBlk , _T ( "TWTSYS(00000103)" )) == 0 )
pEquip -> SetBlock3d ( GetBlockIdFromString ( xsTmp12 ));
pEquip -> SetNumber ( _T ( "CIRCLE-1" ));
}
OPENOBJ_END ();
}
}
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
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000147" ), xsTmp1 ) != RTNORM ) //排水点
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000141" ), xsTmp2 ) != RTNORM ) //圆地漏
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000137" ), xsTmp3 ) != RTNORM ) //方地漏
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000136" ), xsTmp4 ) != RTNORM ) //清扫口
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000139" ), xsTmp5 ) != RTNORM ) //雨水斗
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000140" ), xsTmp6 ) != RTNORM ) //毛发聚集器
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000138" ), xsTmp7 ) != RTNORM ) //排水漏斗
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000329" ), xsTmp8 ) != RTNORM ) //防爆地漏
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000327" ), xsTmp9 ) != RTNORM ) //两用地漏
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000328" ), xsTmp10 ) != RTNORM ) //多通道地漏
2026-09-28 15:28:50 +08:00
return ;
if ( g_bBlk3D ){
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000362" ), xsTmp11 ) != RTNORM ) //S存水弯
2026-09-28 15:28:50 +08:00
return ;
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000363" ), xsTmp12 ) != RTNORM ) //P存水弯
2026-09-28 15:28:50 +08:00
return ;
}
2026-10-04 00:04:20 +08:00
if ( LoadDwbBlock ( csDwb , _T ( "00000543" ), xsTmp13 ) != RTNORM ) //洗衣机地漏 cet 2013.1.5 add
2026-09-28 15:28:50 +08:00
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 ();
}
XPoint ptIns ;
InitLayer ( LAY_EQ_DIRT );
InitLayer ( LAY_EQUIP_LEAK );
InitLayer ( LAY_EQUIP_GULLY );
2026-10-04 00:04:20 +08:00
RBList rbMaskPipe ( RTDXF0 , _T ( "ATS_PIPE" ), 8 , GetLayerNames ( _T ( "管" )), NULL );
2026-09-28 15:28:50 +08:00
g_nInsBlkRotate = 0 ;
double nScale = 1 ;
if ( dlg . m_iType == 0 )
nScale = g_nDrainPtRadius ;
while ( 1 ){
dlg . UpdateData ();
if ( dlg . m_iType == 0 )
g_csInsBlkName = xsTmp1 ;
else if ( dlg . m_iType == 1 )
g_csInsBlkName = xsTmp2 ;
else if ( dlg . m_iType == 2 )
g_csInsBlkName = xsTmp3 ;
else if ( dlg . m_iType == 3 )
g_csInsBlkName = xsTmp4 ;
else if ( dlg . m_iType == 4 )
g_csInsBlkName = xsTmp5 ;
else if ( dlg . m_iType == 5 )
g_csInsBlkName = xsTmp6 ;
else if ( dlg . m_iType == 6 )
g_csInsBlkName = xsTmp7 ;
else if ( dlg . m_iType == 7 )
g_csInsBlkName = xsTmp8 ;
else if ( dlg . m_iType == 8 )
g_csInsBlkName = xsTmp9 ;
else if ( dlg . m_iType == 9 )
g_csInsBlkName = xsTmp10 ;
else if ( dlg . m_iType == 10 )
g_csInsBlkName = xsTmp2 ;
else if ( dlg . m_iType == 11 ) // cet 2013.1.5 add
g_csInsBlkName = xsTmp13 ;
TBlockEdJig jig ( g_csInsBlkName , ptIns , nScale );
2026-10-04 00:04:20 +08:00
// jig.SetPrompt(_T("\n请指定附件在管线上的插入点[放大(E)/缩小(D)]<退出>:"));
2026-09-28 15:28:50 +08:00
// jig.SetKeyword(_T("E D R"));
2026-10-04 00:04:20 +08:00
jig . SetPrompt ( _T ( " \n 请指定附件在管线上的插入点[放大(E)/缩小(D)/替换(S)]<退出>:" ));
2026-09-28 15:28:50 +08:00
jig . SetKeyword ( _T ( "E D R S" ));
int nKeyIndex = 0 ;
int nRetCode = jig . DoIt ( & nKeyIndex );
if ( nRetCode == RTNORM ){
ptIns = jig . GetPickPoint ();
AcDbObjectId recordId = GetBlockIdFromString ( g_csInsBlkName );
PickSet ss ( SS_FREE );
XPoint ptUcs = Wcs2Ucs ( ptIns );
GetPointPickSet ( ptUcs , ss , rbMaskPipe , 50 );
double nAng = g_nInsBlkRotate ;
2026-10-04 00:04:20 +08:00
if ( ss . Length () == 1 ){ //管件插入在管线上
2026-09-28 15:28:50 +08:00
Entity entPipe = ss [ 0L ];
BOOL bFlag = FALSE ;
OPENOBJ_BEGIN ( entPipe , AcDb :: kForRead , TDbPipe , pPipe );
XCurveSegment seg ( pPipe -> StartPoint (), pPipe -> EndPoint (), 0 );
seg . ProjectToMe ( ptIns , ptIns );
nAng = ads_angle ( seg . EndPoint (), seg . StartPoint ());
XPoint ptPickPipe ;
2026-10-04 00:04:20 +08:00
if ( ads_getpoint ( ptUcs , _T ( " \n 请点取引出管线端点:" ), ptPickPipe ) == RTNORM ){
2026-09-28 15:28:50 +08:00
ptPickPipe = Ucs2Wcs ( ptPickPipe );
TDbPipe * pNewPipe2 = ( TDbPipe * ) pPipe -> clone ();
dlg . UpdateData ( TRUE );
if ( dlg . m_nDimNewPipe == 1 && pPipe -> IsDrawLabel ())
{
pNewPipe2 -> EnableDrawLabel ( FALSE );
}
ptPickPipe . z = ptIns . z ;
pNewPipe2 -> SetPoints ( ptIns , ptPickPipe );
AddToCurrentSpace ( pNewPipe2 , Adesk :: kTrue );
nAng = ads_angle ( ptIns , ptPickPipe );
nAng += PI / 2 ;
ptIns = ptPickPipe ;
}
else
bFlag = TRUE ;
OPENOBJ_END ();
}
TDbEquipment * pEquip = new TDbEquipment ;
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 ;
2026-10-04 00:04:20 +08:00
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 增加洗衣机地漏
2026-09-28 15:28:50 +08:00
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 ( GetBlockIdFromString ( xsTmp11 ));
else if ( _tcsicmp ( dlg . m_csSysBlk , _T ( "TWTSYS(00000103)" )) == 0 )
pEquip -> SetBlock3d ( GetBlockIdFromString ( xsTmp12 ));
pEquip -> SetNumber ( _T ( "CIRCLE-1" ));
}
2026-10-04 00:04:20 +08:00
pEquip -> setColor ( AcCmColor ()); //随层
2026-09-28 15:28:50 +08:00
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 ;
2026-10-04 00:04:20 +08:00
else if ( nKeyIndex == 3 ) //替换
2026-09-28 15:28:50 +08:00
{
PickSet ss ( SS_FREE );
dlg . SetReplaceEQ ( ss );
ReplaceDrainAccessory ( & dlg , nScale , ss );
}
else {
nScale = 1 ;
if ( dlg . m_iType == 0 )
nScale = g_nDrainPtRadius ;
}
continue ;
}
else
break ;
}
g_nInsBlkRotate = 0 ;
dlg . DestroyWindow ();
TPipePerDocData * pData = GetCurPipeDocData ();
pData -> ApplyUpdates ();
}
int CAccessoryDrainDlg :: m_iType = 0 ;
int CAccessoryDrainDlg :: m_nDimNewPipe = 0 ;
IMPLEMENT_DYNAMIC ( CAccessoryDrainDlg , CModelessDialog )
CAccessoryDrainDlg :: CAccessoryDrainDlg ( CWnd * pParent /*=NULL*/ )
: CModelessDialog ( CAccessoryDrainDlg :: IDD , pParent )
{
//{{AFX_DATA_INIT(CAccessoryDrainDlg)
m_nNg = 1 ;
m_nBigQ = 0.33 ;
//}}AFX_DATA_INIT
2026-10-04 00:04:20 +08:00
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
2026-09-28 15:28:50 +08:00
}
void CAccessoryDrainDlg :: SetReplaceEQ ( PickSet & ss )
{
RBList rbMask ( RTDXF0 , _T ( "ATS_EQUIPMENT" ), 8 , _T ( "*" ), NULL );
2026-10-04 00:04:20 +08:00
int ret = SelectEntities ( _T ( " \n 请选取图中要被替换的排水附件<退出>:" ), ss , rbMask );
2026-09-28 15:28:50 +08:00
if ( ret != RTNORM )
{
return ;
}
}
void CAccessoryDrainDlg :: DoDataExchange ( CDataExchange * pDX )
{
CModelessDialog :: 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 , CModelessDialog )
//{{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 ()
{
CModelessDialog :: 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 ()
{
CModelessDialog :: 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 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000147)" ); //排水点
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk1 ;
}
else if ( m_iType == 1 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000141)" ); //圆地漏
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk2 ;
}
else if ( m_iType == 2 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000137)" ); //方地漏
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk3 ;
}
else if ( m_iType == 3 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000136)" ); //清扫口
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk4 ;
}
else if ( m_iType == 4 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000139)" ); //雨水斗
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk5 ;
}
else if ( m_iType == 5 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000140)" ); //毛发聚集器
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk6 ;
}
else if ( m_iType == 6 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000138)" ); //排水漏斗
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk7 ;
}
else if ( m_iType == 7 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000329)" ); //防爆地漏
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk8 ;
}
else if ( m_iType == 8 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000327)" ); //两用地漏
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk9 ;
}
else if ( m_iType == 9 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000328)" ); //多通道地漏
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk10 ;
}
else if ( m_iType == 10 ){
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000141)" ); //存水地漏
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk11 ;
}
else if ( m_iType == 11 ){ // cet 2013.1.5 add
2026-10-04 00:04:20 +08:00
csSldName = _T ( "TWTSYS(00000543)" ); //洗衣机地漏
2026-09-28 15:28:50 +08:00
csSldName2 = m_csSysBlk12 ;
}
m_csSysBlk = csSldName2 ;
// csSldName = g_csDwbPath + csSldName;
DrawSlide (( const TCHAR * ) csSldName , pImageBox1 );
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 );
pWnd -> ShowWindow ( SW_SHOW );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType2 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType3 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType4 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType5 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType6 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType7 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType8 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType9 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType10 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType11 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnRadioType12 ()
{
UpdateData ( TRUE );
m_nNg = 0 ;
m_nBigQ = 0 ;
UpdateData ( FALSE );
CWnd * pWnd = GetDlgItem ( IDC_STATIC_NEXT );
pWnd -> ShowWindow ( SW_HIDE );
OpenSlide ();
PostCommand ( _T ( "R " ), false );
}
void CAccessoryDrainDlg :: OnPreview2 ()
{
UpdateData ();
if ( m_iType != 0 )
return ;
CTemporaryResourceOverride vTemp ;
CSelectBlkDlg dlg ;
dlg . m_csTkName = _T ( "TWTSYS" );
2026-10-04 00:04:20 +08:00
dlg . m_csType = _T ( "排水点 \\ 90度" );
2026-09-28 15:28:50 +08:00
CWnd * pWnd = GetDlgItem ( IDC_PREVIEW2 );
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 ;
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 ();
}