// TchInitSet2Dlg.cpp : implementation file // #include "stdafx.h" #include "resource.h" #include "TchInitSet2Dlg.h" #include "rxregsvc.h" //add by whl #if (ADS>15) //#include "ADStatusPane.h" #endif//ADS>15 #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif TMaterialGrid::TMaterialGrid() { SetRowFixLength(); SetRowPosFix(); SetColFixLength(); SetColPosFix(); AppendCol(_T("材料名称"),72); AppendCol(_T("标准填充图案")); AppendCol(_T("详图填充图案")); AppendCol(_T("详图填充方式"),90); AppendCol(_T("填充颜色"),53); AppendCol(_T("标准线宽"),53); AppendCol(_T("详图线宽"),50); GetCol(0).SetReadOnly(); GetCol(0).SetBackColor(GetSysColor(COLOR_3DFACE)); GetCol(1).SetRightButton(); GetCol(2).SetRightButton(); GetCol(3).SetComboSel(); //GetCol(3).SetReadOnly();//以后开放 GetCol(4).SetRightButton(); } //BEGIN_MESSAGE_MAP(TMaterialGrid, WDGrid) //{{AFX_MSG_MAP(CTchInitSet2Dlg) //ON_MESSAGE(TARCH_SETTING_MSG_UPDATA,OnReUpdataDlg) //}}AFX_MSG_MAP //ON_BN_CLICKED(IDC_BOLD_LINE, CTchInitSet2Dlg::OnBnClickedBoldLine) //ON_BN_CLICKED(IDC_FILLMODE, CTchInitSet2Dlg::OnBnClickedFillmode) //ON_CBN_SELCHANGE(IDC_DETAIL_SCALE, CTchInitSet2Dlg::OnCbnSelchangeDetailScale) //ON_LBN_SELCHANGE(IDC_GRID, CTchInitSet2Dlg::OnLbnSelchangeGrid) //ON_WM_LBUTTONDOWN() //END_MESSAGE_MAP() bool TMaterialGrid::OnCellButtonTip(long row,long col,CString&res)const { if (col==4) { res=_T("选择颜色"); return true; } else if (col==1||col==2) { res=_T("选择填充图案"); return true; } return false; } void TMaterialGrid::OnBeforeRefresh(WDGridCell&cell) { if (cell.GetColIndex()==4) { CDC&dc=GetDC(); COLORREF color=acedGetRGB(cell.GetText()); dc.SetBkColor(color); dc.SetTextColor((COLORREF)(-1*color)); dc.SetBkMode(TRANSPARENT); } else WDGrid::OnBeforeRefresh(cell); } bool TMaterialGrid::OnCellButtonDown(WDGridCell&cell,CString&res) { if (cell.GetColIndex()==1) { if (!AT_loaded(_T("tch_blklib"))) { int nRet=acrxLoadModule(_T("tch_blklib.arx"), Adesk::kTrue, true); if (!nRet) return false; } RBList rbCmd=ads_buildlist(RTSTR, _T("ITUAN"),RTSTR,(const TCHAR*)(cell.GetText()),NULL); resbuf *rbRes=NULL; if (ads_invoke(rbCmd, &rbRes)==RTNORM && rbRes) { if (rbRes && rbRes->restype==RTSTR) res=rbRes->resval.rstring; ads_relrb(rbRes); AutoCloseCell(100); return true; } } else if (cell.GetColIndex()==2) { if (_tcscmp(cell.GetRow()[3].GetText(),_T("普通填充"))==0) { if (!AT_loaded(_T("tch_blklib"))) { int nRet=acrxLoadModule(_T("tch_blklib.arx"), Adesk::kTrue, true); if (!nRet) return false; } RBList rbCmd=ads_buildlist(RTSTR, _T("ITUAN"),RTSTR,(const TCHAR*)(cell.GetText()),NULL); resbuf *rbRes=NULL; if (ads_invoke(rbCmd, &rbRes)==RTNORM && rbRes) { if (rbRes && rbRes->restype==RTSTR) res=rbRes->resval.rstring; ads_relrb(rbRes); AutoCloseCell(100); return true; } } else//线图案填充 { if (!AT_loaded(_T("tch_blklib"))) { int nRet=acrxLoadModule(_T("tch_blklib.arx"), Adesk::kTrue, true); if (!nRet) return false; } XString sLibFile; if (!FindFile(_T("LinePat.tk"),sLibFile)) return false; XString sTemp,sBlockName=(const TCHAR*)(cell.GetText()); sTemp<restype==RTSTR) { res=rbRes->resval.rstring; long left=res.ReverseFind(_T('(')); res=res.Right(res.GetLength()-left-1); res=res.Left(res.GetLength()-1); } ads_relrb(rbRes); AutoCloseCell(100); return true; } } } else if (cell.GetColIndex() == 4) { cell.Select(); int colorIndex = _ttoi(cell.GetText()); if ( Adesk::kTrue == acedSetColorDialog(colorIndex, TRUE, 0) ) { res.Format(_T("%d"),colorIndex); AutoCloseCell(100); return true; } else cell.Refresh(); } return false; } void TMaterialGrid::OnCellComboString(WDGridCell&cell,CComboBox&combo) { if (cell.GetColIndex()==1) { XString sFile; if (FindFile(_T("acad.pat"), sFile)) { CStdioFile file(sFile,CFile::modeRead); CString buf; TCHAR sItem[256]; while(file.ReadString(buf)) if (buf[0]==_T('*')) { buf.Delete(0); CT_strnth(buf,1,sItem); combo.AddString(sItem); } } } else if (cell.GetColIndex()==2) { if (_tcscmp(cell.GetRow()[3].GetText(),_T("普通填充"))==0) { XString sFile; if (FindFile(_T("acad.pat"), sFile)) { CStdioFile file(sFile,CFile::modeRead); CString buf; TCHAR sItem[256]; while(file.ReadString(buf)) if (buf[0]==_T('*')) { buf.Delete(0); CT_strnth(buf,2,sItem); if (_tcsicmp(_T("Tangent"),sItem)==0) { CT_strnth(buf,1,sItem); combo.AddString(sItem); } } } } else { XString sFullDwbFile; if (ads_findfile(_T("LinePat.dwb"), sFullDwbFile)!=RTNORM) return; XStringList lstPat; // [2010-3-16 14:22 wubo] 移植到新Geo库 // XDrawingLib(sFullDwbFile, ios::binary|ios::in).GetAll(lstPat); XDrawingLib(sFullDwbFile, _ios::binary | _ios::in).GetAll(lstPat); for(long i=0;iUpdatePreview(); pDlg->GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION); } } } void TMaterialGrid::OnDataChanged() { WDGrid::OnDataChanged(); Save(); if (IsValidRow(GetCurRowIndex())) { CTchInitSet2Dlg *pDlg=(CTchInitSet2Dlg*)GetParent(); if (pDlg!=NULL) { pDlg->UpdatePreview(); pDlg->GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION); } } } void TMaterialGrid::Save() { m_pLstPatterns->Reset(); for(long i=0;iAppend(new TMaterialPattern(GetCell(i,0), GetCell(i,1),GetCell(i,2),GetCell(i,5),GetCell(i,6),bLineHatch,_ttoi(GetCell(i,4)))); } } void TMaterialGrid::Read(DList &lstPatterns) { m_pLstPatterns=&lstPatterns; SetRowNum(lstPatterns.Length()); for(long i=0;im_sName); GetCell(i,1).SetText(pMat->m_sHatch1); GetCell(i,2).SetText(pMat->m_sHatch2); GetCell(i,3).SetText(pMat->m_bLineHatch?_T("线图案填充"):_T("普通填充")); GetCell(i,4).SetText(XString(_T("%d"),pMat->m_nColor)); GetCell(i,5).SetText(XString(_T("%.2f"),pMat->m_nBold1)); GetCell(i,6).SetText(XString(_T("%.2f"),pMat->m_nBold2)); } for(i=4;i<8;i++) GetCell(i,3).SetReadOnly(); } ///////////////////////////////////////////////////////////////////////////// // CTchInitSet2Dlg property page static CTchInitSet2Dlg* g_pInitSet2Dlg=NULL; CTchInitSet2Dlg::CTchInitSet2Dlg(CWnd* pParent) : CAcUiTabChildDialog(pParent),m_ctrlPreview(0),m_dbPreview(true, true), m_ctrlPreviewDetail(0),m_dbPreviewDetail(true, true) { //{{AFX_DATA_INIT(CTchInitSet2Dlg) m_bBoldMode = FALSE; m_bFillMode = FALSE; m_csDetailScale = _T(""); //}}AFX_DATA_INIT m_bBoldMode = DocGetIsLineWeight(); m_csDetailScale = (const TCHAR *)Dist2Str(g_nDetailScale); m_bFillMode = DocGetIsSolidFill(); TDbConfig temp; TDbConfig *p = GetDwgGlobal(AcDb::kForRead); XDbObject vTemp(p); if (!p) p=&temp; m_lstPatterns.Append(new TMaterialPattern(WALLMATE_Divider, p->GetHatchDivider(FALSE), p->GetHatchDivider(TRUE), p->GetBoldDivider(FALSE), p->GetBoldDivider(TRUE),p->IsDividerLineHatch(),p->GetDividerColor())); m_lstPatterns.Append(new TMaterialPattern(_T("填充墙"), p->GetHatchFill(FALSE), p->GetHatchFill(TRUE), p->GetBoldFill(FALSE), p->GetBoldFill(TRUE),p->IsFillLineHatch(),p->GetFillColor())); m_lstPatterns.Append(new TMaterialPattern(WALLMATE_Fill1, p->GetHatchFill1(FALSE), p->GetHatchFill1(TRUE), p->GetBoldFill1(FALSE), p->GetBoldFill1(TRUE),p->IsFill1LineHatch(),p->GetFill1Color())); m_lstPatterns.Append(new TMaterialPattern(WALLMATE_Fill2, p->GetHatchFill2(FALSE), p->GetHatchFill2(TRUE), p->GetBoldFill2(FALSE), p->GetBoldFill2(TRUE),p->IsFill2LineHatch(),p->GetFill2Color())); m_lstPatterns.Append(new TMaterialPattern(_T("砖墙柱"), p->GetHatchBrick(FALSE), p->GetHatchBrick(TRUE), p->GetBoldBrick(FALSE), p->GetBoldBrick(TRUE),p->IsBrickLineHatch(),p->GetBrickColor())); m_lstPatterns.Append(new TMaterialPattern(_T("石墙柱"), p->GetHatchRocket(FALSE), p->GetHatchRocket(TRUE), p->GetBoldRocket(FALSE), p->GetBoldRocket(TRUE),p->IsRocketLineHatch(),p->GetRocketColor())); m_lstPatterns.Append(new TMaterialPattern(_T("钢筋混凝土"), p->GetHatchConcrete(FALSE), p->GetHatchConcrete(TRUE), p->GetBoldConcrete(FALSE), p->GetBoldConcrete(TRUE),p->IsConcreteLineHatch(),p->GetConcreteColor())); m_lstPatterns.Append(new TMaterialPattern(_T("钢柱"), p->GetHatchSteel(FALSE), p->GetHatchSteel(TRUE), p->GetBoldSteel(FALSE), p->GetBoldSteel(TRUE),p->IsSteelLineHatch(),p->GetSteelColor())); } CTchInitSet2Dlg::~CTchInitSet2Dlg() { } /////////////////////////////////////////////////// // 配置表格界面 void CTchInitSet2Dlg::DoDataExchange(CDataExchange* pDX) { CAcUiTabChildDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CTchInitSet2Dlg) DDX_Check(pDX, IDC_BOLD_LINE, m_bBoldMode); DDX_Check(pDX, IDC_FILLMODE, m_bFillMode); DDX_CBString(pDX, IDC_DETAIL_SCALE, m_csDetailScale); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CTchInitSet2Dlg, CAcUiTabChildDialog) //{{AFX_MSG_MAP(CTchInitSet2Dlg) ON_MESSAGE(TARCH_SETTING_MSG_UPDATA,OnReUpdataDlg) //}}AFX_MSG_MAP ON_BN_CLICKED(IDC_BOLD_LINE, CTchInitSet2Dlg::OnBnClickedBoldLine) ON_BN_CLICKED(IDC_FILLMODE, CTchInitSet2Dlg::OnBnClickedFillmode) ON_CBN_SELCHANGE(IDC_DETAIL_SCALE, CTchInitSet2Dlg::OnCbnSelchangeDetailScale) ON_LBN_SELCHANGE(IDC_GRID, CTchInitSet2Dlg::OnLbnSelchangeGrid) ON_WM_SIZE() END_MESSAGE_MAP() void CTchInitSet2Dlg::OnSize(UINT nType, int cx, int cy) { CDialog::OnSize(nType, cx, cy); if (nType==SIZE_MINIMIZED) return; } LRESULT CTchInitSet2Dlg::OnReUpdataDlg(WPARAM w,LPARAM l) { RetDefault(); //OnInitDialog(); //m_matGrid.Create(this,IDC_GRID); m_matGrid.Read(m_lstPatterns); m_matGrid.FitLastCol(); if (!m_ctrlPreview.SubclassDlgItem(IDC_NORMAL_HATCH, this)) return 0; if (!m_ctrlPreviewDetail.SubclassDlgItem(IDC_DETAIL_HATCH,this)) return 0; return 0; } void CTchInitSet2Dlg::CtrlPreview(CGsPreviewCtrl &ctrlPreview,AcDbDatabase &dbPreview,bool bDetail) { long nCurRow=m_matGrid.GetCurRowIndex(); if (!m_matGrid.IsValidRow(nCurRow)) return; XPushMemVar tempDb(g_pCurrentDb,&dbPreview);//启动加粗填充 TDbConfig *p = GetDwgGlobal(AcDb::kForWrite,&dbPreview); if (p!=NULL) { p->SetLineWeight(TRUE); p->SetSolidFill(TRUE); TMaterialPattern *pMater=m_lstPatterns[0]; p->SetDividerLineHatch(pMater->m_bLineHatch); p->SetHatchDivider(pMater->m_sHatch1, FALSE); p->SetHatchDivider(pMater->m_sHatch2, TRUE); p->SetBoldDivider(pMater->m_nBold1, FALSE); p->SetBoldDivider(pMater->m_nBold2, TRUE); p->SetDividerColor(pMater->m_nColor); pMater = m_lstPatterns[1]; p->SetFillLineHatch(pMater->m_bLineHatch); p->SetHatchFill(pMater->m_sHatch1, FALSE); p->SetHatchFill(pMater->m_sHatch2, TRUE); p->SetBoldFill(pMater->m_nBold1, FALSE); p->SetBoldFill(pMater->m_nBold2, TRUE); p->SetFillColor(pMater->m_nColor); pMater = m_lstPatterns[2]; p->SetFill1LineHatch(pMater->m_bLineHatch); p->SetHatchFill1(pMater->m_sHatch1, FALSE); p->SetHatchFill1(pMater->m_sHatch2, TRUE); p->SetBoldFill1(pMater->m_nBold1, FALSE); p->SetBoldFill1(pMater->m_nBold2, TRUE); p->SetFill1Color(pMater->m_nColor); pMater = m_lstPatterns[3]; p->SetFill2LineHatch(pMater->m_bLineHatch); p->SetHatchFill2(pMater->m_sHatch1, FALSE); p->SetHatchFill2(pMater->m_sHatch2, TRUE); p->SetBoldFill2(pMater->m_nBold1, FALSE); p->SetBoldFill2(pMater->m_nBold2, TRUE); p->SetFill2Color(pMater->m_nColor); pMater=m_lstPatterns[4]; p->SetBrickLineHatch(pMater->m_bLineHatch); p->SetHatchBrick(pMater->m_sHatch1, FALSE); p->SetHatchBrick(pMater->m_sHatch2, TRUE); p->SetBoldBrick(pMater->m_nBold1, FALSE); p->SetBoldBrick(pMater->m_nBold2, TRUE); p->SetBrickColor(pMater->m_nColor); pMater=m_lstPatterns[5]; p->SetRocketLineHatch(pMater->m_bLineHatch); p->SetHatchRocket(pMater->m_sHatch1, FALSE); p->SetHatchRocket(pMater->m_sHatch2, TRUE); p->SetBoldRocket(pMater->m_nBold1, FALSE); p->SetBoldRocket(pMater->m_nBold2, TRUE); p->SetRocketColor(pMater->m_nColor); pMater=m_lstPatterns[6]; p->SetConcreteLineHatch(pMater->m_bLineHatch); p->SetHatchConcrete(pMater->m_sHatch1, FALSE); p->SetHatchConcrete(pMater->m_sHatch2, TRUE); p->SetBoldConcrete(pMater->m_nBold1, FALSE); p->SetBoldConcrete(pMater->m_nBold2, TRUE); p->SetConcreteColor(pMater->m_nColor); pMater=m_lstPatterns[7]; p->SetSteelLineHatch(pMater->m_bLineHatch); p->SetHatchSteel(pMater->m_sHatch1, FALSE); p->SetHatchSteel(pMater->m_sHatch2, TRUE); p->SetBoldSteel(pMater->m_nBold1, FALSE); p->SetBoldSteel(pMater->m_nBold2, TRUE); p->SetSteelColor(pMater->m_nColor); p->close(); } AcDbBlockTable *pBlockTab = NULL; dbPreview.getSymbolTable(pBlockTab, AcDb::kForWrite); if (pBlockTab==NULL) return; AcDbBlockTableRecord *pMspace = new AcDbBlockTableRecord; pMspace->setName(_T("*U")); pBlockTab->add(pMspace); pBlockTab->close(); if (pMspace==NULL) return; //--------------------------- TDbWall *pWall=new TDbWall(XPoint(0,0),XPoint(1800,0)); pWall->SetWidth(0, 130); pWall->SetWidth(1, 130); pWall->SetPScale(bDetail?50:100); XPoly2D polyWall(1); pWall->GetOutlinePoly(0,polyWall); TDbColumn *pColumn=new TDbColumn; pColumn->SetOutlinePoly(polyWall); pColumn->SetPScale(bDetail?50:100); CString str=m_matGrid.GetCell(nCurRow,0).GetText(); bool bColumn=false; if (str==WALLMATE_Divider) pWall->SetStyle(TWallData::kDivider); else if (str==WALLMATE_Fill) pWall->SetStyle(TWallData::kFill); else if (str==WALLMATE_Fill1) pWall->SetStyle(TWallData::kFill1); else if (str==WALLMATE_Fill2) pWall->SetStyle(TWallData::kFill2); else if (str==("砖墙柱")) pWall->SetStyle(TWallData::kBrick); else if (str==("石墙柱")) pWall->SetStyle(TWallData::kRocket); else if (str==("钢筋混凝土")) pWall->SetStyle(TWallData::kConcrete); else { pColumn->SetMaterial(TColumnData::kSteel); bColumn=true; } pWall->setColorIndex(1); pWall->setLayer(InitLayer(LAY_WALL,&dbPreview)); pWall->SetLayerHatch2d(InitLayer(LAY_HATCH,&dbPreview)); pColumn->setColorIndex(1); pColumn->setLayer(InitLayer(LAY_WALL,&dbPreview)); pColumn->SetLayerHatch2d(InitLayer(LAY_HATCH,&dbPreview)); AcDbExtents aext; if (bColumn) pColumn->getGeomExtents(aext); else pWall->getGeomExtents(aext);//得到扩展 XPoint ptMax,ptMin; XPoint ptCenter; double length,width; ptMax=aext.maxPoint(); ptMin=aext.minPoint(); ptCenter.x=(ptMin.x+ptMax.x)/2; ptCenter.y=(ptMin.y+ptMax.y)/2; ptCenter.z = (ptMax.z + ptMin.z) / 2; length=(ptMax.x-ptMin.x)*1.022; width=(ptMax.y-ptMin.y)*1.1; double height=ptMax.z-ptMin.z; //包络范围 double x,y,z; x=ptMax.x-ptMin.x; y=ptMax.y-ptMin.y; z=ptMax.z-ptMin.z; if (bColumn) pMspace->appendAcDbEntity(pColumn); else pMspace->appendAcDbEntity(pWall); AcDbVoidPtrArray entSet; XExplodeStream dc(entSet); if (bColumn) { delete pWall; XPushMemVar vTemp(XExplodeStream::m_bFullExplode, TRUE); dc.SetPropertiesFrom(pColumn); pColumn->ExplodeOrDraw2d(dc);//之前墙要已经加到dbPreview中。 pColumn->erase();//墙体分解后就不需要了,删除墙   pColumn->close(); } else { delete pColumn; XPushMemVar vTemp(XExplodeStream::m_bFullExplode, TRUE); dc.SetPropertiesFrom(pWall); pWall->ExplodeOrDraw2d(dc);//之前墙要已经加到dbPreview中。 pWall->erase();//墙体分解后就不需要了,删除墙   pWall->close(); } extern GEOAPI double g_nAcadVer; if (g_nAcadVer>16.99&&g_nAcadVer<17.11)//2007,2008 { for(long i=entSet.length()-1;i>=0;i--) { AcDbEntity *pEnt = (AcDbEntity*)entSet[i]; pMspace->appendAcDbEntity(pEnt); pEnt->close(); } } else { for(long i=0;iappendAcDbEntity(pEnt); pEnt->close(); } } ctrlPreview.clearAll(); ctrlPreview.init(true); AcGePoint3d position(ptCenter.x,ptCenter.y,ptMax.z+1000); ctrlPreview.view()->setView(position, ptCenter,AcGeVector3d(0.0,1.0,0.0),length,width); //ctrlPreview.view()->setMode(AcGsView::k2DOptimized); ctrlPreview.view()->add(pMspace,ctrlPreview.model()); ctrlPreview.Invalidate(); pMspace->close(); } void CTchInitSet2Dlg::UpdatePreview()//modified by fxj 081215 { CtrlPreview(m_ctrlPreview,m_dbPreview,false); CtrlPreview(m_ctrlPreviewDetail,m_dbPreviewDetail,true); } ///////////////////////////////////////////////////////////////////////////// // CTchInitSet2Dlg message handlers BOOL CTchInitSet2Dlg::DestroyWindow() { //不知为何没有调用 m_ctrlPreview.clearAll(); return CAcUiTabChildDialog::DestroyWindow(); } // 非常重要的清除 void CTchInitSet2Dlg::PostNcDestroy() { // TODO: Add your specialized code here and/or call the base class m_ctrlPreview.clearAll(); CAcUiTabChildDialog::PostNcDestroy(); delete g_pInitSet2Dlg; g_pInitSet2Dlg = NULL; } BOOL CTchInitSet2Dlg::OnInitDialog() { CAcUiTabChildDialog::OnInitDialog(); // TODO: Add extra initialization here m_matGrid.Create(this,IDC_GRID); m_matGrid.Read(m_lstPatterns); m_matGrid.FitLastCol(); if (!m_ctrlPreview.SubclassDlgItem(IDC_NORMAL_HATCH, this)) return FALSE; if (!m_ctrlPreviewDetail.SubclassDlgItem(IDC_DETAIL_HATCH,this)) return FALSE; return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CTchInitSet2Dlg::OnMainDialogOK() { static bool bIn=false; if (bIn)//有时点击过快会重入!<2007 return; bIn=true; CAcUiTabChildDialog::OnMainDialogOK(); UpdateGlobal(); PickSet ss(SS_FREE); if (GetEntByDxf(ss, _T("TCH_WALL,TCH_COLUMN,TCH_WALLPATCH"), 1)==Acad::eOk) { BOOL bOld=DocGetIsDwgBegin(); DocSetIsDwgBegin(FALSE); long lCount = ss.Length(); for(long i=0L; irecordGraphicsModified(); //add by whl on 050412 pEnt->downgradeOpen(); pEnt->draw(); } OPENOBJ_END(); } DocSetIsDwgBegin(bOld); } bIn=false; } void CTchInitSet2Dlg::OnOK() { CAcUiTabChildDialog::OnOK(); UpdateGlobal(); } void CTchInitSet2Dlg::UpdateGlobal() { UpdateData(TRUE); m_matGrid.Save(); TDbConfig *p = GetDwgGlobal(AcDb::kForWrite); XDbObject vTemp(p); if (p) { TMaterialPattern *pMater=m_lstPatterns[0]; p->SetDividerLineHatch(pMater->m_bLineHatch); p->SetHatchDivider(pMater->m_sHatch1, FALSE); p->SetHatchDivider(pMater->m_sHatch2, TRUE); p->SetBoldDivider(pMater->m_nBold1, FALSE); p->SetBoldDivider(pMater->m_nBold2, TRUE); p->SetDividerColor(pMater->m_nColor); pMater = m_lstPatterns[1]; p->SetFillLineHatch(pMater->m_bLineHatch); p->SetHatchFill(pMater->m_sHatch1, FALSE); p->SetHatchFill(pMater->m_sHatch2, TRUE); p->SetBoldFill(pMater->m_nBold1, FALSE); p->SetBoldFill(pMater->m_nBold2, TRUE); p->SetFillColor(pMater->m_nColor); pMater = m_lstPatterns[2]; p->SetFill1LineHatch(pMater->m_bLineHatch); p->SetHatchFill1(pMater->m_sHatch1, FALSE); p->SetHatchFill1(pMater->m_sHatch2, TRUE); p->SetBoldFill1(pMater->m_nBold1, FALSE); p->SetBoldFill1(pMater->m_nBold2, TRUE); p->SetFill1Color(pMater->m_nColor); pMater = m_lstPatterns[3]; p->SetFill2LineHatch(pMater->m_bLineHatch); p->SetHatchFill2(pMater->m_sHatch1, FALSE); p->SetHatchFill2(pMater->m_sHatch2, TRUE); p->SetBoldFill2(pMater->m_nBold1, FALSE); p->SetBoldFill2(pMater->m_nBold2, TRUE); p->SetFill2Color(pMater->m_nColor); pMater=m_lstPatterns[4]; p->SetBrickLineHatch(pMater->m_bLineHatch); p->SetHatchBrick(pMater->m_sHatch1, FALSE); p->SetHatchBrick(pMater->m_sHatch2, TRUE); p->SetBoldBrick(pMater->m_nBold1, FALSE); p->SetBoldBrick(pMater->m_nBold2, TRUE); p->SetBrickColor(pMater->m_nColor); pMater=m_lstPatterns[5]; p->SetRocketLineHatch(pMater->m_bLineHatch); p->SetHatchRocket(pMater->m_sHatch1, FALSE); p->SetHatchRocket(pMater->m_sHatch2, TRUE); p->SetBoldRocket(pMater->m_nBold1, FALSE); p->SetBoldRocket(pMater->m_nBold2, TRUE); p->SetRocketColor(pMater->m_nColor); pMater=m_lstPatterns[6]; p->SetConcreteLineHatch(pMater->m_bLineHatch); p->SetHatchConcrete(pMater->m_sHatch1, FALSE); p->SetHatchConcrete(pMater->m_sHatch2, TRUE); p->SetBoldConcrete(pMater->m_nBold1, FALSE); p->SetBoldConcrete(pMater->m_nBold2, TRUE); p->SetConcreteColor(pMater->m_nColor); pMater=m_lstPatterns[7]; p->SetSteelLineHatch(pMater->m_bLineHatch); p->SetHatchSteel(pMater->m_sHatch1, FALSE); p->SetHatchSteel(pMater->m_sHatch2, TRUE); p->SetBoldSteel(pMater->m_nBold1, FALSE); p->SetBoldSteel(pMater->m_nBold2, TRUE); p->SetSteelColor(pMater->m_nColor); p->SetLineWeight(m_bBoldMode); p->SetSolidFill(m_bFillMode); double nScale=_tstof(m_csDetailScale); if (nScale>1.0) p->SetDetailScale(nScale); } vTemp.Close(); //add by whl #if (ADS>15) //extern void TINIT_IMPEXP UpdateStatusBar(); // UpdateStatusBar(); #endif//ADS>15 } void CTchInitSet2Dlg::RetDefault() { m_bBoldMode = FALSE; m_bFillMode = FALSE; m_csDetailScale = _T(""); //}}AFX_DATA_INIT m_bBoldMode = DocGetIsLineWeight(); m_csDetailScale = (const TCHAR *)Dist2Str(g_nDetailScale); m_bFillMode = DocGetIsSolidFill(); UpdateData(FALSE); TDbConfig temp; TDbConfig *p = GetDwgGlobal(AcDb::kForRead); XDbObject vTemp(p); if (!p) p=&temp; m_lstPatterns.Reset(); m_lstPatterns.Append(new TMaterialPattern(WALLMATE_Divider, p->GetHatchDivider(FALSE), p->GetHatchDivider(TRUE), p->GetBoldDivider(FALSE), p->GetBoldDivider(TRUE),p->IsDividerLineHatch(),p->GetDividerColor())); m_lstPatterns.Append(new TMaterialPattern(WALLMATE_Fill, p->GetHatchFill(FALSE), p->GetHatchFill(TRUE), p->GetBoldFill(FALSE), p->GetBoldFill(TRUE),p->IsFillLineHatch(),p->GetFillColor())); m_lstPatterns.Append(new TMaterialPattern(WALLMATE_Fill1, p->GetHatchFill1(FALSE), p->GetHatchFill1(TRUE), p->GetBoldFill1(FALSE), p->GetBoldFill1(TRUE),p->IsFill1LineHatch(),p->GetFill1Color())); m_lstPatterns.Append(new TMaterialPattern(WALLMATE_Fill2, p->GetHatchFill2(FALSE), p->GetHatchFill2(TRUE), p->GetBoldFill2(FALSE), p->GetBoldFill2(TRUE),p->IsFill2LineHatch(),p->GetFill2Color())); m_lstPatterns.Append(new TMaterialPattern(_T("砖墙柱"), p->GetHatchBrick(FALSE), p->GetHatchBrick(TRUE), p->GetBoldBrick(FALSE), p->GetBoldBrick(TRUE),p->IsBrickLineHatch(),p->GetBrickColor())); m_lstPatterns.Append(new TMaterialPattern(_T("石墙柱"), p->GetHatchRocket(FALSE), p->GetHatchRocket(TRUE), p->GetBoldRocket(FALSE), p->GetBoldRocket(TRUE),p->IsRocketLineHatch(),p->GetRocketColor())); m_lstPatterns.Append(new TMaterialPattern(_T("钢筋混凝土"), p->GetHatchConcrete(FALSE), p->GetHatchConcrete(TRUE), p->GetBoldConcrete(FALSE), p->GetBoldConcrete(TRUE),p->IsConcreteLineHatch(),p->GetConcreteColor())); m_lstPatterns.Append(new TMaterialPattern(_T("钢柱"), p->GetHatchSteel(FALSE), p->GetHatchSteel(TRUE), p->GetBoldSteel(FALSE), p->GetBoldSteel(TRUE),p->IsSteelLineHatch(),p->GetSteelColor())); m_matGrid.Clear(); m_matGrid.Read(m_lstPatterns); UpdatePreview(); } void CTchInitSet2Dlg::OnBnClickedBoldLine() { GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION); } void CTchInitSet2Dlg::OnBnClickedFillmode() { GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION); } void CTchInitSet2Dlg::OnCbnSelchangeDetailScale() { GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION); } void CTchInitSet2Dlg::OnLbnSelchangeGrid() { GetParent()->SendMessage(TARCH_SETTING_MSG_BUTTONSTATION); }