#include "StdAfx.h" #include "DrawLandScapeDlg.h" #include "LandScapeStyle.h" #include "GlwGlobalVariable.h" #include "UndergroundRampDlg.h" void LandScapeDraw() { CDrawLandScapeDlg dlg(acedGetAcadFrame()); { CAcModuleResourceOverride vTemp; dlg.Create(dlg.IDD, acedGetAcadFrame()); } dlg.ShowWindow(SW_SHOW); acedGetAcadDwgView()->SetFocus(); BOOL bRet = TRUE; if(!GET_GLOBAL_VARIABLE(CLandScapeStyle)) SET_GLOBAL_VARIABLE(CLandScapeStyle, new CLandScapeStyle); CLandScapeStyle* pLandScape = GET_GLOBAL_VARIABLE(CLandScapeStyle); while (1) { dlg.UpdateData(); pLandScape->SetDlgData(_AS_MM(dlg.GetRoadWidth()), dlg.GetRoadWidthMM(), dlg.GetWidthPercent(), dlg.GetGap(), dlg.GetLandScapeId(), dlg.GetRoadLineState(), dlg.GetAutoAdjustState(), dlg.GetBlockWidth(), dlg.GetBlockLen(), dlg.GetUnitRealWidth(), dlg.GetIsUnitPercent()); int eType = dlg.GetDrawType(); dlg.m_bExit = TRUE; switch (eType) { case 1: { bRet = pLandScape->dynamicDraw();//动态绘制 } break; case 2: { bRet = pLandScape->selectPath();//选择路径 break; } default: break; } if (!bRet && dlg.m_bExit) //命令结束 { break; } } if (IsWindow(dlg.m_hWnd)) { dlg.DestroyWindow(); } } // 插入块函数 AcDbObjectId InsertBlock(CString &csBlkName) { AcApDocument *pDoc = acDocManager->curDocument(); AcDbObjectId blockId; // 找到sys路径下的dwg文件 CString szFileName = _T("总图.TKW"), sLibFile = g_sDwbPath; sLibFile = sLibFile.Left(sLibFile.GetLength() - 5) + _T("\\DWB\\") + szFileName; XString xsBlkName; szFileName = (const TCHAR *)(XPathParser(csBlkName).m_sFileName); sLibFile = g_sDwbPath; CString csPath = sLibFile.Left(sLibFile.GetLength() - 5) + _T("\\DWB\\"); csPath += szFileName; // 锁定文档 acDocManager->lockDocument(pDoc); int nRet = LoadDwbBlock(csPath, xsBlkName); if (nRet == RTNORM) { blockId = InitBlock(xsBlkName); } acDocManager->unlockDocument(pDoc); return blockId; } void UnGroundRamp() { CUndergroundRampDlg dlg; dlg.DoModal(); }