659 lines
19 KiB
C++
659 lines
19 KiB
C++
// tch_pipewire.cpp : Defines the initialization routines for the DLL.
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include <afxdllx.h>
|
|
#include <rxregsvc.h>
|
|
#include "PipewireMonitor.h"
|
|
//#include "cregobj.h"
|
|
//#include "aecutil.h"
|
|
#include "DbDuct.h"
|
|
#include "TDbDuctNode.h"
|
|
|
|
double g_dPointToOriginLimitDist = 1e+6; // cet 2017.3.8 add 实体距离原点的距离是否过远的距离
|
|
BOOL g_bIsCustomizeVer = FALSE; //2011-10-11 SR ADD
|
|
#if ADS > 15
|
|
extern TLayerPane g_LayerPane; //2011-10-11 sr add
|
|
#endif
|
|
|
|
// cet 2012.2.7 modify 新增user3-user8
|
|
// CString g_csPipeDim[29] = { _T("J"), _T("RJ"), _T("RH"), _T("W"), _T("F"), _T("Y"), _T("Z"), _T("X"),
|
|
// _T("ZP"), _T("N"), _T("ZY"), _T("YW"), _T("YF"), _T("YY"), _T("T"), _T("SJ"),
|
|
// _T("XJ"), _T("J"), _T("J"), _T("RJ"), _T("RJ"), _T("RH"), _T("RH"), _T("X"),
|
|
// _T("X"), _T("ZP"), _T("ZP"), _T("Z"), _T("Z"), };// TWT水管
|
|
CString g_csPipeDim[35] = { _T("J"), _T("RJ"), _T("RH"), _T("W"), _T("F"), _T("Y"), _T("Z"), _T("X"),
|
|
_T("ZP"), _T("N"), _T("ZY"), _T("YW"), _T("YF"), _T("YY"), _T("T"), _T("SJ"),
|
|
_T("XJ"), _T("J"), _T("J"), _T("RJ"), _T("RJ"), _T("RH"), _T("RH"), _T("X"),
|
|
_T("X"), _T("ZP"), _T("ZP"), _T("Z"), _T("Z"), _T("XH"), _T("MH"), _T("Z"),
|
|
_T("YL"), _T("T"), _T("SJ")};
|
|
|
|
|
|
// sg add
|
|
CString g_csThvacPipeDim[14] = {_T("RG"), _T("RH"), _T("RZ"), _T("RT"), // THvac采暖管线
|
|
_T("CG"), _T("CH"), _T("HG"), _T("HH"),_T("MG"), // THvac空调水管管线
|
|
_T("MH"), _T("QG"), _T("QH"), _T("NG"),_T("AT")};
|
|
CString g_csThvacDuctDim[6] = {"SA", "RA", "FA", "VA", "SPD", "PSA"}; // THvac空调风管管线
|
|
|
|
//std::map<TPipeSys::SysType, CString> g_mapPipeSysName; // 管道系统名称 cet 2011.12.7 add
|
|
|
|
// 从文件中读取管道系统名称 cet 2011.12.7 add
|
|
// BOOL GetLayerReMark(const TCHAR *szLayer, CString &sRemark)
|
|
// {
|
|
// sRemark.Empty();
|
|
// XString fullFile;
|
|
// if(FindFile(_T("LAYERDEF.DAT"), fullFile))
|
|
// {
|
|
// FILE *fp=fopen(_AS(fullFile), "r");
|
|
// if(!fp)
|
|
// return FALSE;
|
|
// while(!feof(fp))
|
|
// {
|
|
// char sBuf[256]="";
|
|
// TCHAR eName[256]=_T(""),sTemp[256]=_T("");
|
|
// fgets(sBuf, 255, fp);
|
|
// if(sBuf[0])
|
|
// {
|
|
// CT_strnth(TString(sBuf), 2, eName);
|
|
// }
|
|
//
|
|
// if (_tcscmp(eName, szLayer) == 0)
|
|
// {
|
|
// CT_strnth(TString(sBuf), 5, sTemp);
|
|
// sRemark = sTemp;
|
|
// break;
|
|
// }
|
|
// }
|
|
// fclose(fp);
|
|
// }
|
|
// else
|
|
// return FALSE;
|
|
//
|
|
// return TRUE;
|
|
// }
|
|
|
|
// 初始化管道系统名称 cet 2011.12.7 add
|
|
// void InitPipeSysName()
|
|
// {
|
|
// // 默认信息
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kCoagulate, CString(_T("凝结"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kDrink, CString(_T("直饮"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kPressDirt, CString(_T("压力污水"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kPressUseless, CString(_T("压力废水"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kPressRain, CString(_T("压力雨水"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kCivilFeed, CString(_T("用户1管线"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kCycleFeed, CString(_T("用户2管线"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kUser3, CString(_T("用户3管线"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kUser4, CString(_T("用户4管线"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kUser5, CString(_T("用户5管线"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kUser6, CString(_T("用户6管线"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kUser7, CString(_T("用户7管线"))));
|
|
// g_mapPipeSysName.insert(std::make_pair(TPipeSys::kUser8, CString(_T("用户8管线"))));
|
|
//
|
|
// CString sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_COAGULATE, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kCoagulate] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_DRINK, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kDrink] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_PRESSDIRT, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kPressDirt] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_PRESSUSELESS, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kPressUseless] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_PRESSRAIN, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kPressRain] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_USER1, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kCivilFeed] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_USER2, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kCycleFeed] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_USER3, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kUser3] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_USER4, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kUser4] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_USER5, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kUser5] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_USER6, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kUser6] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_USER7, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kUser7] = sTemp;
|
|
// if(GetLayerReMark(LAY_PIPE_USER8, sTemp) && !sTemp.IsEmpty())
|
|
// g_mapPipeSysName[TPipeSys::kUser8] = sTemp;
|
|
// }
|
|
|
|
#ifdef RECORD_CMD_TIME
|
|
// cet 2012.4.23 add 统计命令执行次数
|
|
std::map<CString,int> g_mapCmdTime;
|
|
// 将命令执行次数记录在mapCmdTime
|
|
void RecordCmdTime(const CString &sCmd)
|
|
{
|
|
CString sTemp = sCmd;
|
|
sTemp.MakeLower();
|
|
std::map<CString, int>::iterator itMap;
|
|
itMap = g_mapCmdTime.find(sTemp);
|
|
if (itMap != g_mapCmdTime.end())
|
|
{
|
|
(*itMap).second++;
|
|
}
|
|
else
|
|
{
|
|
g_mapCmdTime.insert(std::make_pair(sTemp, 1));
|
|
}
|
|
}
|
|
// 将mapCmdTime中数据记录到dbf中
|
|
void SaveCmdTime()
|
|
{
|
|
CodeBase db;
|
|
XString fullFile;
|
|
if(!FindFile(_T("cmdtime.dbf"), fullFile))
|
|
{
|
|
acutPrintf(_T("读取cmdtime.dbf文件错误!"));
|
|
return;
|
|
}
|
|
XDbfTable *pTable = db.Open(fullFile);
|
|
if(!pTable)
|
|
{
|
|
return;
|
|
}
|
|
|
|
// 更新已有命令执行次数
|
|
CString sCmd, sTime;
|
|
int nCmdTime = 0;
|
|
std::map<CString, int>::iterator itMap;
|
|
std::map<CString, int> mapUpdateCmd;
|
|
for(pTable->MoveFirst(); !pTable->IsEOF(); pTable->MoveNext())
|
|
{
|
|
GET_FIELD(pTable, _T("Command"), sCmd);
|
|
sCmd.MakeLower();
|
|
itMap = g_mapCmdTime.find(sCmd);
|
|
if (itMap != g_mapCmdTime.end()) //找到记录时修改记录
|
|
{
|
|
GET_FIELD(pTable, _T("Time"), sTime);
|
|
nCmdTime = _ttoi(sTime) + itMap->second;
|
|
sTime.Format(_T("%d"), nCmdTime);
|
|
SET_FIELD(pTable, _T("Time"), (const TCHAR*)sTime);
|
|
mapUpdateCmd.insert(*itMap);
|
|
}
|
|
}
|
|
|
|
std::map<CString, int> mapNewCmd;
|
|
std::map<CString, int>::iterator itFind;
|
|
for (itMap = g_mapCmdTime.begin(); itMap != g_mapCmdTime.end(); itMap++)
|
|
{
|
|
itFind = mapUpdateCmd.find(itMap->first);
|
|
if (itFind == mapUpdateCmd.end())
|
|
{
|
|
mapNewCmd.insert(*itMap);
|
|
}
|
|
}
|
|
|
|
// 添加新命令
|
|
CTime date;
|
|
date = CTime::GetCurrentTime();
|
|
CString sDate = date.Format(_T("%Y.%m.%d"));
|
|
for (itMap = mapNewCmd.begin(); itMap != mapNewCmd.end(); itMap++)
|
|
{
|
|
pTable->AppendBegin();
|
|
SET_FIELD(pTable, _T("Command"), (const TCHAR*)(*itMap).first);
|
|
sTime.Format(_T("%d"), (*itMap).second);
|
|
SET_FIELD(pTable, _T("Time"), (const TCHAR*)sTime);
|
|
SET_FIELD(pTable, _T("Startdate"), (const TCHAR*)sDate);
|
|
pTable->AppendEnd();
|
|
}
|
|
}
|
|
#endif
|
|
|
|
//MY_RES_HERE;
|
|
|
|
extern "C" AcRx::AppRetCode
|
|
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt);
|
|
|
|
|
|
///////////////////////////////////////////////////
|
|
// External module
|
|
extern void InitDbPipeSys(BOOL bTrue);
|
|
|
|
// Modify and Add following 3 lines
|
|
|
|
/* sr del 2010-4-19
|
|
static AFX_EXTENSION_MODULE tch_pipewireDLL = { NULL, NULL };
|
|
extern "C" {
|
|
HINSTANCE _hdllInstance;
|
|
}
|
|
extern "C" int APIENTRY
|
|
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
|
{
|
|
_hdllInstance = hInstance;
|
|
|
|
return 1; // ok
|
|
}
|
|
|
|
|
|
|
|
extern "C" BOOL APIENTRY //name modified
|
|
InitModule(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)//name modified
|
|
{
|
|
if (dwReason == DLL_PROCESS_ATTACH) {
|
|
// Extension DLL one-time initialization
|
|
if (!AfxInitExtensionModule(tch_pipewireDLL, hInstance))
|
|
return 0;
|
|
CTemporaryResourceOverride::SetDefaultResource(_hdllInstance);
|
|
// Insert this DLL into the resource chain
|
|
new CDynLinkLibrary(tch_pipewireDLL);
|
|
|
|
}
|
|
else if (dwReason == DLL_PROCESS_DETACH)
|
|
{
|
|
AfxTermExtensionModule(tch_pipewireDLL);
|
|
}
|
|
return 1; // ok
|
|
}
|
|
*/
|
|
|
|
HINSTANCE _hdllInstance = NULL ;
|
|
|
|
AC_IMPLEMENT_EXTENSION_MODULE(arxmfcDLL);
|
|
extern void InitAol(const TCHAR *szAppName);
|
|
|
|
extern "C"
|
|
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
|
{
|
|
if (dwReason == DLL_PROCESS_ATTACH)
|
|
{
|
|
_hdllInstance = hInstance;
|
|
arxmfcDLL.AttachInstance(hInstance);
|
|
// Insert this DLL into the resource chain
|
|
// new CDynLinkLibrary(arxmfcDLL);
|
|
//Init for AOL
|
|
InitAol(TCHXD);
|
|
InitGeLib();
|
|
//InitAcUiDLL();
|
|
}
|
|
else if (dwReason == DLL_PROCESS_DETACH)
|
|
{
|
|
arxmfcDLL.DetachInstance();
|
|
}
|
|
return TRUE;
|
|
}
|
|
|
|
int OnDwgUnload();
|
|
int OnDwgLoaded();
|
|
int OnDoFunc();
|
|
void OnLoadApp();
|
|
void OnUnloadApp();
|
|
void InitAppDocGlobals(BOOL bTrue);
|
|
void InitDbPipe(BOOL bTrue);
|
|
void InitDbRadiator(BOOL bTrue);
|
|
void InitDbPipeFitting(BOOL bTrue);
|
|
void InitDbPipeValve(BOOL bTrue);
|
|
void InitDbPsConfig(BOOL bTrue);
|
|
void InitDbPsConfig();
|
|
void InitDbEquipment(BOOL bTrue);
|
|
void InitHDbEquipment(BOOL bTrue);
|
|
void InitDbLabel(BOOL bTrue);
|
|
void InitDbPieMultDim(BOOL bTrue);
|
|
void InitDbFloorPipe(BOOL bTrue);
|
|
void InitDbCircleText(BOOL bTrue);
|
|
void IniTDbDoubleLinePipe(BOOL bTrue);
|
|
void InitDbFlangeFitting(BOOL bTrue);
|
|
void InitDbWell(BOOL bTrue);
|
|
void InitDbPump(BOOL bTrue);
|
|
void InitDbVerticalSection(BOOL bTrue);
|
|
void InitDbWaterTank(BOOL bTrue);
|
|
void InitDbWellDim(BOOL bTrue);
|
|
void InitDbLowVoltSys(BOOL bTrue);
|
|
void InitDbTrenchFitting(BOOL bTrue);
|
|
|
|
// sg add
|
|
void InitDbDuct(BOOL bTrue);
|
|
void InitDbDuctElbow(BOOL bTrue);
|
|
void InitDbDuctTapered(BOOL bTrue);
|
|
void InitDbDuct3Corner(BOOL bTrue);
|
|
void InitDbDuct4Corner(BOOL bTrue);
|
|
void InitDbDuctNode(BOOL bTrue);
|
|
|
|
void InitTDbFanCoil(BOOL bTrue);
|
|
void InitTDbAirLets(BOOL bTrue);
|
|
void InitTDbFan(BOOL bTrue);
|
|
void InitTDbWaterAllot(BOOL bTrue);
|
|
|
|
void InitHVDbSpace(BOOL bTrue);
|
|
void InitDbIDDot(BOOL bTrue);
|
|
void InitDbIDProcessLine(BOOL bTrue);
|
|
void InitDbIDEntity(BOOL bTrue);
|
|
void InitDbWireDimNew(BOOL bTrue);
|
|
void InitDbEquipDimNew(BOOL bTrue);
|
|
void InitDbStake(BOOL bTrue);
|
|
void InitDbVPipeDim(BOOL bTrue);
|
|
void IniTDbVerticalSectionFeed(BOOL bTrue);
|
|
void IniTDbPipeCanal(BOOL bTrue);
|
|
//void IniTDbFloorRect_Old(BOOL bTrue);
|
|
void InitDbDoubleLinePipeReducer(BOOL bTrue);
|
|
void InitDbPool(BOOL bTrue);
|
|
void InitTDbCableTrench(BOOL bTrue);
|
|
void InitDbMTextNew(BOOL bTrue);
|
|
void InitDbConfluenceArea(BOOL bTrue);
|
|
void InitDbFireExtinguisher(BOOL bTrue);
|
|
|
|
void InitGroupIdConfig(BOOL bTrue); // cet 2014.9.17 add
|
|
|
|
extern "C" AcRx::AppRetCode
|
|
acrxEntryPoint(AcRx::AppMsgCode msg, void* pkt)
|
|
{
|
|
switch (msg) {
|
|
case AcRx::kInitAppMsg:
|
|
acrxUnlockApplication(pkt); // Server程序必须锁住,不让卸载
|
|
acrxDynamicLinker->registerAppMDIAware(pkt);
|
|
TPipeCmdReactor::Attach();
|
|
OnLoadApp();
|
|
break;
|
|
case AcRx::kLoadDwgMsg:
|
|
OnDwgLoaded();
|
|
break;
|
|
case AcRx::kInvkSubrMsg:
|
|
OnDoFunc();
|
|
break;
|
|
case AcRx::kSaveMsg:
|
|
break;
|
|
case AcRx::kUnloadDwgMsg:
|
|
OnDwgUnload();
|
|
break;
|
|
case AcRx::kUnloadAppMsg:
|
|
#ifdef RECORD_CMD_TIME
|
|
SaveCmdTime(); // cet 2012.4.23 add
|
|
#endif
|
|
OnUnloadApp();
|
|
//TPipeCmdReactor::Detach();
|
|
break;
|
|
}
|
|
return AcRx::kRetOK;
|
|
}
|
|
|
|
|
|
///////////////////////
|
|
//在应用程序加载上需要做的动作
|
|
void OnLoadApp()
|
|
{
|
|
XString sTchIni;
|
|
CString csTitle;
|
|
if(FindFile(_T("tch.ini"), sTchIni)) {
|
|
INI_struct *inis=NULL;
|
|
if(CT_get_INIs(sTchIni, _T("Product"), &inis)) {
|
|
|
|
TCHAR *cName=CT_get_INI2(inis, _T("Title"));
|
|
if(cName)
|
|
csTitle=cName;
|
|
}
|
|
CT_free_INIs(inis);
|
|
if(csTitle.Find(_T("专版")) > -1)
|
|
g_bIsCustomizeVer = TRUE;
|
|
}
|
|
#if(ADS>15)
|
|
if(g_bIsCustomizeVer)
|
|
g_LayerPane.Init(true);
|
|
#endif // ADS>15
|
|
|
|
InitGroupIdConfig(TRUE); // cet 2014.9.17 add
|
|
InitDbConfluenceArea(TRUE);
|
|
InitDbMTextNew(TRUE);
|
|
IniTDbVerticalSectionFeed(TRUE);
|
|
InitDbVPipeDim(TRUE);
|
|
InitDbStake(TRUE);
|
|
InitDbEquipDimNew(TRUE);
|
|
InitDbWireDimNew(TRUE);
|
|
InitDbPsConfig(TRUE);
|
|
InitDbPipeSys(TRUE);
|
|
InitAppDocGlobals(TRUE);
|
|
InitDbFloorPipe(TRUE);
|
|
InitDbCircleText(TRUE);
|
|
InitDbPieMultDim(TRUE);
|
|
InitDbPipe(TRUE);
|
|
InitDbRadiator(TRUE);
|
|
InitDbPipeFitting(TRUE);
|
|
InitDbPipeValve(TRUE);
|
|
InitDbEquipment(TRUE);
|
|
InitDbFireExtinguisher(TRUE);// zxl 2014.01.21 add 卸载时子类应该在父类前卸载
|
|
InitHDbEquipment(TRUE);
|
|
InitDbPool(TRUE);
|
|
InitTDbWaterAllot(TRUE);
|
|
InitTDbFan(TRUE);
|
|
InitTDbAirLets(TRUE);
|
|
InitTDbFanCoil(TRUE); // sg add
|
|
InitDbLabel(TRUE);
|
|
InitDbDuct(TRUE);
|
|
InitDbDuctNode(TRUE); // sg add
|
|
IniTDbPipeCanal(TRUE);
|
|
InitTDbCableTrench(TRUE);
|
|
InitDbTrenchFitting(TRUE);
|
|
InitDbFlangeFitting(TRUE);
|
|
IniTDbDoubleLinePipe(TRUE);
|
|
InitDbDoubleLinePipeReducer(TRUE);
|
|
InitDbPump(TRUE);
|
|
InitDbVerticalSection(TRUE);
|
|
InitDbWaterTank(TRUE);
|
|
InitDbWellDim(TRUE);
|
|
InitDbWell(TRUE);
|
|
InitDbLowVoltSys(TRUE);
|
|
InitDbIDEntity(TRUE);
|
|
InitDbIDProcessLine(TRUE);
|
|
InitDbIDDot(TRUE);
|
|
InitHVDbSpace(TRUE); // sg add
|
|
|
|
// // cet 2011.12.6 add 初始化管道系统名
|
|
// InitPipeSysName();
|
|
}
|
|
|
|
|
|
///////////////////////
|
|
// 应用程序(即将)卸载
|
|
void OnUnloadApp()
|
|
{
|
|
InitHVDbSpace(FALSE); // sg add
|
|
InitDbIDDot(FALSE);
|
|
InitDbIDProcessLine(FALSE);
|
|
InitDbIDEntity(FALSE);
|
|
|
|
InitDbLowVoltSys(FALSE);
|
|
InitDbWell(FALSE);
|
|
InitDbWellDim(FALSE);
|
|
InitDbWaterTank(FALSE);
|
|
InitDbVerticalSection(FALSE);
|
|
InitDbPump(FALSE);
|
|
InitDbDoubleLinePipeReducer(FALSE);
|
|
IniTDbDoubleLinePipe(FALSE);
|
|
InitDbFlangeFitting(FALSE);
|
|
InitDbTrenchFitting(FALSE);
|
|
InitTDbCableTrench(FALSE);
|
|
IniTDbPipeCanal(FALSE);
|
|
|
|
InitDbDuctNode(FALSE); // sg add
|
|
InitDbDuct(FALSE);
|
|
|
|
InitDbLabel(FALSE);
|
|
|
|
InitTDbFanCoil(FALSE); // sg add
|
|
InitTDbAirLets(FALSE);
|
|
InitTDbFan(FALSE);
|
|
InitTDbWaterAllot(FALSE);
|
|
|
|
InitDbPool(FALSE);
|
|
InitHDbEquipment(FALSE);
|
|
InitDbFireExtinguisher(FALSE);// zxl 2014.01.21 add 卸载时子类应该在父类前卸载
|
|
InitDbEquipment(FALSE);
|
|
InitDbPipeValve(FALSE);
|
|
InitDbPipeFitting(FALSE);
|
|
InitDbRadiator(FALSE);
|
|
InitDbPipe(FALSE);
|
|
InitDbPieMultDim(FALSE);
|
|
InitDbCircleText(FALSE);
|
|
InitDbFloorPipe(FALSE);
|
|
InitAppDocGlobals(FALSE);
|
|
InitDbPipeSys(FALSE);
|
|
InitDbPsConfig(FALSE);
|
|
InitDbWireDimNew(FALSE);
|
|
InitDbEquipDimNew(FALSE);
|
|
InitDbStake(FALSE);
|
|
InitDbVPipeDim(FALSE);
|
|
IniTDbVerticalSectionFeed(FALSE);
|
|
// IniTDbFloorRect_Old(FALSE);
|
|
InitDbMTextNew(FALSE);
|
|
InitDbConfluenceArea(FALSE);
|
|
|
|
InitGroupIdConfig(FALSE); // cet 2014.9.17 add
|
|
|
|
#if(ADS>15)
|
|
if(g_bIsCustomizeVer)
|
|
g_LayerPane.Init(false);
|
|
#endif // ADS>15
|
|
|
|
}
|
|
|
|
void DealDuctDWG()
|
|
{
|
|
PickSet ssAll(SS_FREE);
|
|
RBList rbMask(RTDXF0, _T("ATS_VENTPIPE"), NULL);
|
|
ssAll.Get(_T("X"), NULL, NULL, rbMask);
|
|
|
|
long lLen = ssAll.Length();
|
|
for (long i=0; i<lLen; i++)
|
|
{
|
|
Entity ent = ssAll[i];
|
|
OPENOBJ_BEGIN(ent, AcDb::kForRead, TDbDuct, pDuct);
|
|
if (pDuct != NULL)
|
|
{
|
|
if (fabs(pDuct->m_dVer-7.6) < 1.0E-5)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
BOOL bFlag(TRUE);
|
|
double dFlDist(100), dFlThick(50);
|
|
AcDbObjectId idS = pDuct->GetNode(0);
|
|
OPENOBJ_BEGIN(idS, AcDb::kForRead, TDbDuctNode, pNode);
|
|
if ((pNode!=NULL) && (!pNode->Is(_T("Stem"))))
|
|
{
|
|
bFlag = FALSE;
|
|
dFlDist = pNode->GetFlangeDis();
|
|
dFlThick = pNode->GetFlangeThick();
|
|
}
|
|
OPENOBJ_END();
|
|
|
|
if (bFlag)
|
|
{
|
|
AcDbObjectId idE = pDuct->GetNode(1);
|
|
OPENOBJ_BEGIN(idE, AcDb::kForRead, TDbDuctNode, pNode);
|
|
if ((pNode!=NULL) && (!pNode->Is(_T("Stem"))))
|
|
{
|
|
bFlag = TRUE;
|
|
dFlDist = pNode->GetFlangeDis();
|
|
dFlThick = pNode->GetFlangeThick();
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
|
|
if (pDuct->upgradeOpen() == Acad::eOk)
|
|
{
|
|
pDuct->SetFlChuTou(dFlDist);
|
|
pDuct->SetFlThick(dFlThick);
|
|
pDuct->downgradeOpen();
|
|
}
|
|
}
|
|
OPENOBJ_END();
|
|
}
|
|
}
|
|
|
|
|
|
///////////////////////
|
|
// DWG已经加载
|
|
int OnDwgLoaded()
|
|
{
|
|
// sr modify
|
|
// if (g_nProductId==8 || g_nProductId==6) // 只有给排水和暖通才写全局变量
|
|
// InitDbPsConfig(); // 初始化全局变量
|
|
|
|
// sg add
|
|
if (g_nProductId == 14) // TWT
|
|
{
|
|
CRegProperty regProp(GetRegLocation(), _T("TWTConfig"));
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
regProp.GetValue(_T("Pipe1Dim"), g_csPipeDim[0]);
|
|
regProp.GetValue(_T("Pipe2Dim"), g_csPipeDim[1]);
|
|
regProp.GetValue(_T("Pipe3Dim"), g_csPipeDim[2]);
|
|
regProp.GetValue(_T("Pipe4Dim"), g_csPipeDim[3]);
|
|
regProp.GetValue(_T("Pipe5Dim"), g_csPipeDim[4]);
|
|
regProp.GetValue(_T("Pipe6Dim"), g_csPipeDim[5]);
|
|
regProp.GetValue(_T("Pipe7Dim"), g_csPipeDim[6]);
|
|
regProp.GetValue(_T("Pipe8Dim"), g_csPipeDim[7]);
|
|
regProp.GetValue(_T("Pipe9Dim"), g_csPipeDim[8]);
|
|
regProp.GetValue(_T("Pipe10Dim"), g_csPipeDim[9]);
|
|
regProp.GetValue(_T("Pipe11Dim"), g_csPipeDim[10]);
|
|
regProp.GetValue(_T("Pipe12Dim"), g_csPipeDim[11]);
|
|
regProp.GetValue(_T("Pipe13Dim"), g_csPipeDim[12]);
|
|
regProp.GetValue(_T("Pipe14Dim"), g_csPipeDim[13]);
|
|
regProp.GetValue(_T("Pipe15Dim"), g_csPipeDim[14]);
|
|
regProp.GetValue(_T("Pipe16Dim"), g_csPipeDim[15]);
|
|
regProp.GetValue(_T("Pipe17Dim"), g_csPipeDim[16]);
|
|
regProp.GetValue(_T("Pipe18Dim"), g_csPipeDim[17]);
|
|
regProp.GetValue(_T("Pipe19Dim"), g_csPipeDim[18]);
|
|
regProp.GetValue(_T("Pipe20Dim"), g_csPipeDim[19]);
|
|
regProp.GetValue(_T("Pipe21Dim"), g_csPipeDim[20]);
|
|
regProp.GetValue(_T("Pipe22Dim"), g_csPipeDim[21]);
|
|
regProp.GetValue(_T("Pipe23Dim"), g_csPipeDim[22]);
|
|
regProp.GetValue(_T("Pipe24Dim"), g_csPipeDim[23]);
|
|
regProp.GetValue(_T("Pipe25Dim"), g_csPipeDim[24]);
|
|
regProp.GetValue(_T("Pipe26Dim"), g_csPipeDim[25]);
|
|
regProp.GetValue(_T("Pipe27Dim"), g_csPipeDim[26]);
|
|
regProp.GetValue(_T("Pipe28Dim"), g_csPipeDim[27]);
|
|
regProp.GetValue(_T("Pipe29Dim"), g_csPipeDim[28]);
|
|
|
|
}
|
|
else // THvac
|
|
{
|
|
CRegProperty regProp(GetRegLocation(), _T("THvacConfig"));
|
|
regProp.SetTopRootKey(HKEY_CURRENT_USER);
|
|
regProp.GetValue(_T("ThPipe1Dim"), g_csThvacPipeDim[0]);
|
|
regProp.GetValue(_T("ThPipe2Dim"), g_csThvacPipeDim[1]);
|
|
regProp.GetValue(_T("ThPipe3Dim"), g_csThvacPipeDim[2]);
|
|
regProp.GetValue(_T("ThPipe4Dim"), g_csThvacPipeDim[3]);
|
|
|
|
regProp.GetValue(_T("ThAcPipe1"), g_csThvacPipeDim[4]);
|
|
regProp.GetValue(_T("ThAcPipe2"), g_csThvacPipeDim[5]);
|
|
regProp.GetValue(_T("ThAcPipe3"), g_csThvacPipeDim[6]);
|
|
regProp.GetValue(_T("ThAcPipe4"), g_csThvacPipeDim[7]);
|
|
regProp.GetValue(_T("ThAcPipe5"), g_csThvacPipeDim[8]);
|
|
regProp.GetValue(_T("ThAcPipe6"), g_csThvacPipeDim[9]);
|
|
regProp.GetValue(_T("ThAcPipe7"), g_csThvacPipeDim[10]);
|
|
regProp.GetValue(_T("ThAcPipe8"), g_csThvacPipeDim[11]);
|
|
regProp.GetValue(_T("ThAcPipe9"), g_csThvacPipeDim[12]);
|
|
regProp.GetValue(_T("ThAcPipe10"), g_csThvacPipeDim[13]);
|
|
|
|
regProp.GetValue(_T("ThDuct1Dim"), g_csThvacDuctDim[0]);
|
|
regProp.GetValue(_T("ThDuct2Dim"), g_csThvacDuctDim[1]);
|
|
regProp.GetValue(_T("ThDuct3Dim"), g_csThvacDuctDim[2]);
|
|
regProp.GetValue(_T("ThDuct4Dim"), g_csThvacDuctDim[3]);
|
|
regProp.GetValue(_T("ThDuct5Dim"), g_csThvacDuctDim[4]);
|
|
regProp.GetValue(_T("ThDuct6Dim"), g_csThvacDuctDim[5]);
|
|
|
|
DealDuctDWG();
|
|
}
|
|
|
|
TPipeDbReactor::Attach();
|
|
return RTNORM;
|
|
}
|
|
|
|
int OnDwgUnload()
|
|
{
|
|
TPipeDbReactor::Detach();
|
|
return RTNORM;
|
|
}
|
|
|
|
|
|
///////////////////////
|
|
// 函数调用
|
|
int OnDoFunc()
|
|
{
|
|
int cindex(0);
|
|
XPushVar<int> cmdecho(_T("CMDECHO"), 0);
|
|
XPushVar<int> osmode(_T("OSMODE"), 0);
|
|
XPushVar<int> blipmode(_T("BLIPMODE"), 0);
|
|
cindex = ads_getfuncode();
|
|
// ...
|
|
return RTNORM;
|
|
} |