Files
envi-code/SourceCode/Code2026/tg_shs/shs_utility/Onload.cpp
T
2026-09-28 15:28:50 +08:00

173 lines
4.2 KiB
C++

#include "stdafx.h"
#include "rxregsvc.h"
#include "actrans.h"
int ChPattern();
extern_fun cmdtab[]={
{_T("TChPattern"), ChPattern},
// //{_T("IHiSpace"), HighlightSpace},
// {_T("GetWDState"), GetWDState},
// {_T("SetWDState"), SetWDState},
// {_T("GetDamnu1"), GetDamnu1},
// {_T("SetDamnu1"), SetDamnu1},
//
// {_T("TApplyLayerChange"), ApplyLayerChange}, //给上华建筑二维绘图用
// {_T("TGetLispPath"), GetLispPath},
// {_T("TGetFace"), GetFace},
// {_T("TCircle2Polyline"), Circle2Polyline},
// {_T("TGetThick"), GetLineThick},
//
//
// ///////////////////////////////////////
// {_T("GetBoldLineState"), GetBoldLineState},
// {_T("SetBoldLineState"), SetBoldLineState},
// {_T("GetSolidFillState"), GetSolidFillState},
// {_T("SetSolidFillState"), SetSolidFillState},
// {_T("GetDimChkState"), GetDimChkState},
// {_T("SetDimChkState"), SetDimChkState},
// {_T("GetDimAdjState"), GetDimAdjState},
// {_T("SetDimAdjState"), SetDimAdjState},
// {_T("GetBaselineState"), GetBaselineState},
// {_T("SetBaselineState"), SetBaselineState},
// {_T("SetSpaceUnitState"), SetSpaceUnitState},
// {_T("SetSpaceAreaState"),SetSpaceAreaState},
// {_T("GetSpaceUnitState"),GetSpaceUnitState},
// {_T("GetSpaceAreaState"),GetSpaceAreaState},
//
// {_T("GetABCoord"), GetABCoord},
// {_T("SetABCoord"), SetABCoord},
// {_T("GetDynamicCoord"), GetDynamicCoord},
// {_T("SetDynamicCoord"), SetDynamicCoord},
// {_T("GetCoordPrec2"), GetCoordPrec2},
// {_T("SetCoordPrec2"), SetCoordPrec2},
//
// {_T("Is2Dand3D"), Is2Dand3D},
// {_T("Is2DOnly"), Is2DOnly},
// {_T("Is3DOnly"), Is3DOnly},
//
// {_T("TGetPScale"), GetPScale},
// {_T("TSetPScale"), SetPScale},
// {_T("TMakeBlock"), TMakeBlock},
// {_T("TDocStatus"), TDocStatus},
// {_T("GetPfx"), GetPfx},
//
// {_T("TDragTitle"), DragTitle},
// // Internal calling only
// {_T("TUpdCamera"), UpdCamera},
//
//
// { _T("TInsBlk"), InsertBlock},
// {_T("TIsAcad2002Sc"), IsAcad2002sc},
// {_T("TInitKernal"), InitKernal},
//
// {_T("TRepStat"), RepStatus},
//
//// 统计和楼层组合
// // display.cpp
// {_T("C:TShowAuto"), ShowStd},
// {_T("C:TShow2D"), Show2D},
// {_T("C:TShow3D"), Show3D},
// {_T("C:TLevelLine"), LevelLine},
// {_T("C:TSpaceSwitch"), SpaceSwitch},
// {_T("C:TRevAxno"), RevAxisLabel},
//
//// Debug Only
//#if !defined(NDEBUG)
//// {_T("InitDup"), TestInitDup},
// {_T("ftoa"), TestFtoa},
// //{_T("C:CenSpArea"), CenSpArea},
// {_T("C:Lay"), Lay},
//// {_T("C:DelInitSet"), RemoveInitSetDict},
// {_T("C:TProject"), TestOffset},
// {_T("C:MkErrMsg"), MkErrMsg},
// {_T("C:TestLay"), TestLayer},
// //{_T("C:TestWall"), TestWall},
// //{_T("C:TestExpl"), TestExpl},
//// {_T("C:TSplitPoly"), SplitPoly},
//#endif
};
void PolyBool();
void ConvertT3();
static ArxCommandTable g_cmdTable[]=
{
{_T("TPolyBool"), PolyBool, ACRX_CMD_MODAL|ACRX_CMD_USEPICKSET},
//{_T("TConvertT3"),ConvertT3, ACRX_CMD_MODAL|ACRX_CMD_USEPICKSET},
};
//////////////////////////////////////////////////
// Load the initial information when XLOAD/OPEN/NEW
// 不可以执行ads_command
int OnDwgUnload()
{
return RTNORM;
}
int OnDwgLoaded()
{
for(int i=0;i<ELEMENTS(cmdtab); i++)
ads_defun(cmdtab[i].cmdname,i);
return RTNORM;
}
int OnDoFunc()
{
int nRet=RTNORM;
int cindex;
XPushVar<int> cmdecho(_T("CMDECHO"), 0);
XPushVar<int> blipmode(_T("BLIPMODE"), 0);
cindex = ads_getfuncode();
if (cindex >= 0 && cindex < ELEMENTS(cmdtab)) {
if(cmdtab[cindex].cmdname[1]==_T(':')) {
{
//XPushUndo vTemp;
AcTransaction *pTrans = actrTransactionManager->startTransaction();
try {
(*cmdtab[cindex].cmdfunc)();
} catch(...) {
}
ads_retvoid();
actrTransactionManager->endTransaction();
}
} else {
(*cmdtab[cindex].cmdfunc)();
}
nRet = RTNORM;
}
else nRet=RTERROR;
return nRet;
}
//在应用程序加载上需要做的动作
void OnLoadApp()
{
TchAddCommand(_T("shs_UTILITY"), g_cmdTable, ELEMENTS(g_cmdTable));
}
//在应用程序卸载时需要做的动作
void OnUnloadApp()
{
acedRegCmds->removeGroup(_T("shs_UTILITY"));
}