#include "stdafx.h" #include "AcDbObjectPtr.h" #include "PickEntSet.h" #include "EdJigEx.h" //#include "DbMultiViewInsert.h" #include "resource.h" //#include "InsertBlockDlg.h" #include "imgdef.h" // AcDbRasterImageDef and reactors, #include "imgent.h" #include "actrans.h" #include "GePoly2D.h" #pragma region TSymbEdJig // 转换成ADS代码 int TSymbEdJig::GetRetCode(int retCode, int *kwordId) const { int ret = retCode; if (ret == AcEdJig::kCancel) ret = RTCAN; else if (ret == AcEdJig::kNull) ret = RTNONE; else if (ret <= 0) ret = RTNORM; else { if (kwordId) *kwordId = ret - 1; ret = RTKWORD; } return ret; } // 开始执行拖动 int TSymbEdJig::DoIt(int *keyIndex) { int nRetCode = 0; acedGetAcadDwgView()->SetFocus(); //屏幕菜单点取时, 命令焦点没有在图形窗口 setDispPrompt(m_sPrompt); if (!!m_sKeyword && keyIndex) { INITGET_BEG(-1, m_sKeyword); try { nRetCode = drag(); } catch (...) { nRetCode = AcEdJig::kCancel; } INITGET_END(); } else { try { nRetCode = drag(); } catch (...) { nRetCode = AcEdJig::kCancel; } } nRetCode = GetRetCode(nRetCode, keyIndex); return nRetCode; } AcEdJig::DragStatus TSymbEdJig::GetPoint(XPoint &pt) { return acquirePoint(pt); } // 反馈 AcEdJig::DragStatus TSymbEdJig::sampler() { DragStatus stat; setUserInputControls((UserInputControls) (AcEdJig::kAccept3dCoordinates | AcEdJig::kNullResponseAccepted)); if (!!m_sKeyword) setKeywordList(m_sKeyword); else setKeywordList(NULL); XPoint ptTemp; stat = GetPoint(ptTemp); if (stat == AcEdJig::kNormal) { if (IsPosChanged(ptTemp)) { m_ptResult = ptTemp; } else return AcEdJig::kNoChange; } return stat; } BOOL TSymbEdJig::IsPosChanged(XPoint ptNew) const { return (ptNew.Distance(m_ptResult) > g_Option::instance()._DIST_SNAP); } #pragma endregion