1118 lines
28 KiB
C++
1118 lines
28 KiB
C++
#include "stdafx.h"
|
|
#include "StdArx.h"
|
|
#include "FZHLDlg.h"
|
|
#include "dbobjptr.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
#ifndef KTData_DB
|
|
#define KTData_DB _T("\\Plumbing.db")
|
|
#endif
|
|
|
|
DLLIMPEXP CString IDCreate();
|
|
|
|
extern CAcExtensionModule Pool3dCmdDll;
|
|
|
|
int g_nBeanNo = 1;
|
|
|
|
IMPLEMENT_DYNAMIC(CFZHLDlg, CDialog)
|
|
|
|
CFZHLDlg::CFZHLDlg(CWnd *pParent /*=NULL*/)
|
|
: CDialog(CFZHLDlg::IDD, pParent)
|
|
, m_dStartEl(0.0)
|
|
, m_dEndEl(0.0)
|
|
, m_sMaterial(_T("钢筋混凝土"))
|
|
, m_sNo(_T("BE-001"))
|
|
, m_bNOSetDefault(TRUE)
|
|
, m_sHatch(HATCH_DEFAULT)
|
|
, m_sModel(_T(""))
|
|
, m_bAddHatch(TRUE)
|
|
, m_bInplace(false)
|
|
, m_nSteel(0)
|
|
{
|
|
m_dXOffset = 0.0;
|
|
m_dYOffset = 0.0;
|
|
m_nShape = 0;
|
|
m_dXSize = 500;
|
|
m_dYSize = 500;
|
|
m_sA = _T("");
|
|
m_sB = _T("");
|
|
m_sC = _T("");
|
|
m_sD = _T("");
|
|
m_sBlockName = _T("_FZH.DWG");
|
|
m_pDb = NULL;
|
|
g_nBeanNo++;
|
|
m_sNo.Format(_T("BE-%d"),g_nBeanNo);
|
|
if (m_bNOSetDefault)
|
|
m_sNo = IDCreate();
|
|
|
|
m_iInsertType = 2;
|
|
m_dH = 0.0;
|
|
|
|
GET_CACHE(CFZHLDlg
|
|
, %d%f%f%f%s%s%s%s%s%s%f%f%s%s%d%f
|
|
, &m_nShape
|
|
, &m_dXOffset
|
|
, &m_dYOffset
|
|
, &m_dStartEl
|
|
, &m_sA
|
|
, &m_sB
|
|
, &m_sC
|
|
, &m_sD
|
|
, &m_sMaterial
|
|
, &m_sNo
|
|
, &m_dXSize
|
|
, &m_dYSize
|
|
, &m_sHatch
|
|
, &m_sModel
|
|
, &m_nSteel
|
|
, &m_dEndEl);
|
|
}
|
|
|
|
CFZHLDlg::~CFZHLDlg()
|
|
{
|
|
}
|
|
|
|
void CFZHLDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
DDX_Control(pDX, IDC_CMBSTEEL, m_wndComSteel);
|
|
DDX_Control(pDX, IDC_CMB_YSIZE, m_wndComboYSize);
|
|
DDX_Control(pDX, IDC_CMB_XSIZE, m_wndComboXSize);
|
|
DDX_Control(pDX, IDC_CMB_SHAPE, m_wndComboShape);
|
|
|
|
DDX_CBIndex(pDX, IDC_CMB_SHAPE, m_nShape);
|
|
DDX_Text(pDX, IDC_EDT_XOFFSET, m_dXOffset);
|
|
DDX_Text(pDX, IDC_EDT_YOFFSET, m_dYOffset);
|
|
DDX_Text(pDX, IDC_EDIT1, m_dStartEl);
|
|
DDX_Text(pDX, IDC_EDIT_END_ELE, m_dEndEl);
|
|
DDX_Text(pDX, IDC_EDITA, m_sA);
|
|
DDX_Text(pDX, IDC_EDITB, m_sB);
|
|
DDX_Text(pDX, IDC_EDITC, m_sC);
|
|
DDX_Text(pDX, IDC_EDITD, m_sD);
|
|
DDX_Text(pDX, IDC_EDIT2, m_sMaterial);
|
|
DDX_Text(pDX, IDC_EDIT6, m_sNo);
|
|
DDX_Check(pDX, IDC_CHECK1, m_bNOSetDefault);
|
|
DDX_Control(pDX, IDC_BTN_FILL, m_wndBtHatch);
|
|
DDX_Check(pDX, IDC_CHECK_HATCH, m_bAddHatch);
|
|
DDX_Text(pDX, IDC_BTN_FILL, m_sHatch);
|
|
DDX_CBString(pDX, IDC_CMBSTEEL, m_sModel);
|
|
DDX_CBIndex(pDX, IDC_CMBSTEEL, m_nSteel);
|
|
}
|
|
|
|
BEGIN_MESSAGE_MAP(CFZHLDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CFZHLDlg)
|
|
ON_CBN_SELCHANGE(IDC_CMB_SHAPE, OnSelchangeCmbShape)
|
|
ON_CBN_SELCHANGE(IDC_CMBSTEEL, OnSelchangeCmbsteel)
|
|
//}}AFX_MSG_MAP
|
|
ON_BN_CLICKED(IDOK, &CFZHLDlg::OnBnClickedOk)
|
|
ON_WM_DESTROY()
|
|
ON_BN_CLICKED(IDC_CHECK1, &CFZHLDlg::OnBnClickedCheck1)
|
|
ON_BN_CLICKED(IDC_BTN_FILL, &CFZHLDlg::OnBnClickedBtnFill)
|
|
ON_BN_CLICKED(IDC_CHECK_HATCH, &CFZHLDlg::OnBnClickedCheckHatch)
|
|
END_MESSAGE_MAP()
|
|
|
|
BOOL CFZHLDlg::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
CString path = FilePath::GetSysDir() + KTData_DB;
|
|
if (!m_dbSQLite.InitADOServer(path))
|
|
{
|
|
AfxMessageBox(CString(_T("数据库初始化失败,请检查 sys")) + KTData_DB + _T("文件是否存在."));
|
|
return FALSE;
|
|
}
|
|
|
|
CString sXSize;
|
|
if (!m_bInplace)
|
|
{
|
|
sXSize.Format(_T("%d"), (int)m_dXSize);
|
|
int nCursel = m_wndComboXSize.FindString(0, sXSize);
|
|
if (nCursel != -1)
|
|
{
|
|
m_wndComboXSize.SetCurSel(nCursel);
|
|
}
|
|
else
|
|
{
|
|
m_wndComboXSize.SetWindowText(sXSize);
|
|
}
|
|
|
|
sXSize.Format(_T("%d"), (int)m_dYSize);
|
|
nCursel = m_wndComboYSize.FindString(0, sXSize);
|
|
if (nCursel != -1)
|
|
{
|
|
m_wndComboYSize.SetCurSel(nCursel);
|
|
}
|
|
else
|
|
{
|
|
m_wndComboYSize.SetWindowText(sXSize);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
sXSize.Format(_T("%d"), (int)m_dXSize);
|
|
m_wndComboXSize.SetWindowText(sXSize);
|
|
sXSize.Format(_T("%d"), (int)m_dYSize);
|
|
m_wndComboYSize.SetWindowText(sXSize);
|
|
}
|
|
|
|
if (!m_wndPreview.SubclassDlgItem(IDC_STC_PICTURE,this))
|
|
return FALSE;
|
|
|
|
|
|
// 工字钢或槽钢,备份
|
|
CString sA;
|
|
CString sB;
|
|
CString sC;
|
|
CString sD;
|
|
int nSteel;
|
|
if (m_nShape == 3 || m_nShape == 4)
|
|
{
|
|
sA = m_sA;
|
|
sB = m_sB;
|
|
sC = m_sC;
|
|
sD = m_sD;
|
|
nSteel = m_nSteel;
|
|
}
|
|
|
|
OnSelchangeCmbShape();
|
|
|
|
if (m_nShape == 3 || m_nShape == 4)
|
|
{
|
|
m_sA = sA;
|
|
m_sB = sB;
|
|
m_sC = sC;
|
|
m_sD = sD;
|
|
if (nSteel < m_wndComSteel.GetCount() && nSteel >= 0)
|
|
m_nSteel = nSteel;
|
|
}
|
|
|
|
#ifndef ZWCAD
|
|
#if ARX < 20
|
|
m_wndPreview.mpView->setMode(AcGsView::k2DOptimized);
|
|
#else
|
|
AcGiVisualStyle style;
|
|
style.setType(AcGiVisualStyle::k2DWireframe);
|
|
m_wndPreview.mpView->setVisualStyle(style);
|
|
#endif
|
|
#else
|
|
#if defined(R24)
|
|
m_wndPreview.mpView->setMode(AcGsView::k2DOptimized);
|
|
#else
|
|
AcGiVisualStyle style;
|
|
style.setType(AcGiVisualStyle::k2DWireframe);
|
|
m_wndPreview.mpView->setVisualStyle(style);
|
|
#endif
|
|
#endif
|
|
|
|
if (m_bNOSetDefault)
|
|
{
|
|
GetDlgItem(IDC_EDIT6)->EnableWindow(FALSE);
|
|
}
|
|
|
|
m_wndBtHatch.EnableWindow(m_bAddHatch);
|
|
if (m_bInplace)
|
|
{
|
|
m_wndComboShape.EnableWindow(FALSE);
|
|
}
|
|
UpdateData(FALSE);
|
|
return TRUE;
|
|
}
|
|
|
|
void CFZHLDlg::GetColumnParam(ColumnParam& ColParam) const
|
|
{
|
|
::memset(&ColParam, 0, sizeof(ColumnParam));
|
|
ColParam.m_dXExtend = m_dXOffset;
|
|
ColParam.m_dYExtend = m_dYOffset;
|
|
ColParam.m_iInsertType = 0;
|
|
ColParam.m_dXScale = m_dXSize;
|
|
ColParam.m_dYScale = m_dYSize;
|
|
ColParam.m_nShape = m_nShape;
|
|
_tcscpy(ColParam.m_sBlockName,m_sBlockName);
|
|
ColParam.m_idRec = m_idStellCol;
|
|
ColParam.m_nShape = m_nShape;
|
|
ColParam.m_dRotAngle = 0.0;//no
|
|
ColParam.m_dH = 0.0;//no
|
|
ColParam.m_dBomEl = m_dStartEl;
|
|
ColParam.m_dEndEl = m_dEndEl;
|
|
_tcscpy(ColParam.m_sMaterial,m_sMaterial);
|
|
_tcscpy(ColParam.m_szNo,m_sNo);
|
|
|
|
if (m_nShape == 1 || m_nShape == 2) // 圆形,正六边
|
|
{
|
|
// 不然会变形
|
|
ColParam.m_dYScale = ColParam.m_dXScale;
|
|
}
|
|
else if (m_nShape == 3 || m_nShape == 4) // 工字,槽钢
|
|
{
|
|
|
|
ColParam.m_dYScale = ColParam.m_dXScale = 1;
|
|
}
|
|
|
|
ColParam.m_dSizes[0] = _ttof(m_sA);
|
|
ColParam.m_dSizes[1] = _ttof(m_sB);
|
|
ColParam.m_dSizes[2] = _ttof(m_sC);
|
|
ColParam.m_dSizes[3] = _ttof(m_sD);
|
|
ColParam.bPtPos = false;
|
|
ColParam.ptPos.set(0,0,0);
|
|
|
|
_tcscpy(ColParam.m_sHatch, m_sHatch);
|
|
_tcscpy(ColParam.m_sModel, m_sModel);
|
|
|
|
if (m_bNOSetDefault)
|
|
{
|
|
CWnd *pWnd = GetDlgItem(IDC_EDIT6);
|
|
if (pWnd)
|
|
pWnd->EnableWindow(FALSE);
|
|
}
|
|
}
|
|
|
|
void CFZHLDlg::OnOK()
|
|
{
|
|
UpdateData();
|
|
|
|
CString sXScale,sYScale,sAngle;
|
|
m_wndComboXSize.GetWindowText(sXScale);
|
|
m_wndComboYSize.GetWindowText(sYScale);
|
|
|
|
m_dYSize = _ttof(sYScale);
|
|
m_dXSize = _ttof(sXScale);
|
|
|
|
if (m_nShape == 3)//工字钢
|
|
{
|
|
m_dYSize = 1.0;
|
|
m_dXSize = 1.0;
|
|
m_idStellCol = CreateIStellBlock();
|
|
}
|
|
|
|
if (m_nShape == 4)//槽钢
|
|
{
|
|
m_dYSize = 1.0;
|
|
m_dXSize = 1.0;
|
|
m_idStellCol = CreateOStellBlock();
|
|
}
|
|
|
|
if (m_nShape == 5)//梯形
|
|
{
|
|
m_idStellCol = CreateTrapezoidBlock();
|
|
m_dYSize = 1.0;
|
|
m_dXSize = 1.0;
|
|
}
|
|
|
|
if (m_idCol.isValid())
|
|
{
|
|
UpdateColData();
|
|
}
|
|
|
|
SET_CACHE(CFZHLDlg
|
|
, %d%f%f%f%s%s%s%s%s%s%f%f%s%s%d%f
|
|
, m_nShape
|
|
, m_dXOffset
|
|
, m_dYOffset
|
|
, m_dStartEl
|
|
, m_sA
|
|
, m_sB
|
|
, m_sC
|
|
, m_sD
|
|
, m_sMaterial
|
|
, m_sNo
|
|
, m_dXSize
|
|
, m_dYSize
|
|
, m_sHatch
|
|
, m_sModel
|
|
, m_nSteel
|
|
, m_dEndEl);
|
|
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
AcDbObjectId CFZHLDlg::CreateIStellBlock()
|
|
{
|
|
double dA = _ttof(m_sA);
|
|
double dB = _ttof(m_sB);
|
|
double dC = _ttof(m_sC);
|
|
double dD = _ttof(m_sD);
|
|
|
|
AcGePoint3d ptGe[12],ptGeT;
|
|
ptGeT.set(0,0,0);
|
|
|
|
ptGeT.y += dA / 2.0;
|
|
ptGeT.x -= dB / 2.0;
|
|
ptGe[0] = ptGeT;
|
|
ptGe[1] = ptGe[0] + dB * AcGeVector3d::kXAxis;
|
|
ptGe[2] = ptGe[1] - dC * AcGeVector3d::kYAxis;
|
|
ptGe[3] = ptGe[2] - (dB - dD) / 2.0 * AcGeVector3d::kXAxis;
|
|
ptGe[4] = ptGe[3] - (dA - 2.0 * dC) * AcGeVector3d::kYAxis;
|
|
ptGe[5] = ptGe[4] + (dB - dD) / 2.0 * AcGeVector3d::kXAxis;
|
|
ptGe[6] = ptGe[5] - dC * AcGeVector3d::kYAxis;
|
|
ptGe[7] = ptGe[6] - dB * AcGeVector3d::kXAxis;
|
|
ptGe[8] = ptGe[7] + dC * AcGeVector3d::kYAxis;
|
|
ptGe[9] = ptGe[8] + (dB - dD) / 2.0 * AcGeVector3d::kXAxis;
|
|
ptGe[10] = ptGe[9] + (dA - 2.0 * dC) * AcGeVector3d::kYAxis;
|
|
ptGe[11] = ptGe[10] - (dB - dD) / 2.0 * AcGeVector3d::kXAxis;
|
|
|
|
AcDbBlockTableRecord* pRec = new AcDbBlockTableRecord;
|
|
pRec->setOrigin(AcGePoint3d::kOrigin);
|
|
pRec->setName(_T("*U"));
|
|
AcDbPolyline* pPl = new AcDbPolyline;
|
|
for (int i = 0;i < 12;i++)
|
|
{
|
|
pPl->addVertexAt(i,ptGe[i].convert2d(AcGePlane::kXYPlane));
|
|
}
|
|
pPl->setClosed(Adesk::kTrue);
|
|
pRec->appendAcDbEntity(pPl);
|
|
pPl->close();
|
|
|
|
AcDbBlockTable* pTable = NULL;
|
|
acdbCurDwg()->getBlockTable(pTable,AcDb::kForWrite);
|
|
|
|
if (pTable != NULL)
|
|
{
|
|
pTable->add(m_idStellCol,pRec);
|
|
pRec->close();
|
|
pTable->close();
|
|
}
|
|
return m_idStellCol;
|
|
}
|
|
|
|
AcDbObjectId CFZHLDlg::CreateOStellBlock()
|
|
{
|
|
AcGePoint3d ptGe[8],ptGeT;
|
|
ptGeT.set(0,0,0);
|
|
|
|
double dA = _ttof(m_sA);
|
|
double dB = _ttof(m_sB);
|
|
double dC = _ttof(m_sC);
|
|
double dD = _ttof(m_sD);
|
|
|
|
//ptGeT.x += dB / 2.0;
|
|
ptGeT.y += (dA - 2 * dC) / 2.0;
|
|
ptGe[0] = ptGeT;
|
|
ptGe[1] = ptGe[0] + dC * AcGeVector3d::kYAxis;
|
|
ptGe[2] = ptGe[1] + dB * AcGeVector3d::kXAxis;
|
|
ptGe[3] = ptGe[2] - dA * AcGeVector3d::kYAxis;
|
|
ptGe[4] = ptGe[3] - dB * AcGeVector3d::kXAxis;
|
|
ptGe[5] = ptGe[4] + dC * AcGeVector3d::kYAxis;
|
|
ptGe[6] = ptGe[5] + (dB - dD) * AcGeVector3d::kXAxis;
|
|
ptGe[7] = ptGe[6] + (dA - 2.0 * dC) * AcGeVector3d::kYAxis;
|
|
|
|
AcDbBlockTableRecord* pRec = new AcDbBlockTableRecord;
|
|
pRec->setOrigin(AcGePoint3d::kOrigin);
|
|
pRec->setName(_T("*U"));
|
|
|
|
//TEST
|
|
//AcDbPolyline* pPl = new AcDbPolyline;
|
|
//for (int i = 0;i < 8;i++)
|
|
//{
|
|
// pPl->addVertexAt(i,ptGe[i].convert2d(AcGePlane::kXYPlane));
|
|
//}
|
|
//pPl->setClosed(Adesk::kTrue);
|
|
//CoreTools::AddToModelSpace(pPl);
|
|
//pPl->close();
|
|
|
|
//特殊预埋线
|
|
ptGeT = ptGe[2];
|
|
AcDbLine* pLine1 = new AcDbLine(ptGe[2],ptGeT.mirror(AcGePlane::kYZPlane));
|
|
pLine1->setVisibility(AcDb::kInvisible);
|
|
pRec->appendAcDbEntity(pLine1);
|
|
pLine1->close();
|
|
|
|
ptGeT = ptGe[3];
|
|
pLine1 = new AcDbLine(ptGe[3],ptGeT.mirror(AcGePlane::kYZPlane));
|
|
pLine1->setVisibility(AcDb::kInvisible);
|
|
pRec->appendAcDbEntity(pLine1);
|
|
pLine1->close();
|
|
|
|
//左对齐 槽钢
|
|
AcDbPolyline* pPl2 = new AcDbPolyline;
|
|
for (int i = 0;i < 8;i++)
|
|
{
|
|
ptGe[i].mirror(AcGePlane::kYZPlane);
|
|
pPl2->addVertexAt(i,ptGe[i].convert2d(AcGePlane::kXYPlane));
|
|
}
|
|
pPl2->setClosed(Adesk::kTrue);
|
|
pRec->appendAcDbEntity(pPl2);
|
|
pPl2->close();
|
|
|
|
AcDbBlockTable* pTable = NULL;
|
|
acdbCurDwg()->getBlockTable(pTable,AcDb::kForWrite);
|
|
|
|
if (pTable != NULL)
|
|
{
|
|
pTable->add(m_idStellCol,pRec);
|
|
pRec->close();
|
|
pTable->close();
|
|
}
|
|
return m_idStellCol;
|
|
}
|
|
|
|
AcDbObjectId CFZHLDlg::CreateTrapezoidBlock()
|
|
{
|
|
AcGePoint3d ptGe[8],ptGeT;
|
|
ptGeT.set(0,0,0);
|
|
|
|
double dH = _ttof(m_sA);
|
|
double dTW = m_dXSize;
|
|
double dtw = m_dYSize;
|
|
|
|
ptGeT.y += dH * 0.5;
|
|
ptGe[0] = ptGeT;
|
|
ptGe[0].x -= dTW * 0.5;
|
|
|
|
ptGe[1] = ptGeT;
|
|
ptGe[1].x += dTW * 0.5;
|
|
|
|
ptGeT.y -= dH;
|
|
ptGe[2] = ptGeT;
|
|
ptGe[2].x += dtw * 0.5;
|
|
|
|
ptGe[3] = ptGe[2];
|
|
ptGe[3].x -= dtw;
|
|
|
|
ptGe[4] = ptGe[0];
|
|
|
|
/*for (int i = 0; i < 5; i++)
|
|
{
|
|
ptGe[i].x += m_dXOffset;
|
|
ptGe[i].y += m_dYOffset;
|
|
}*/
|
|
|
|
AcDbBlockTableRecord* pRec = new AcDbBlockTableRecord;
|
|
pRec->setOrigin(AcGePoint3d::kOrigin);
|
|
pRec->setName(_T("*U"));
|
|
AcDbPolyline* pPl = new AcDbPolyline;
|
|
for (int i = 0;i < 5;i++)
|
|
{
|
|
pPl->addVertexAt(i,ptGe[i].convert2d(AcGePlane::kXYPlane));
|
|
}
|
|
pPl->setClosed(Adesk::kTrue);
|
|
pRec->appendAcDbEntity(pPl);
|
|
pPl->close();
|
|
|
|
AcDbBlockTable* pTable = NULL;
|
|
acdbCurDwg()->getBlockTable(pTable,AcDb::kForWrite);
|
|
|
|
if (pTable != NULL)
|
|
{
|
|
pTable->add(m_idStellCol,pRec);
|
|
pRec->close();
|
|
pTable->close();
|
|
}
|
|
return m_idStellCol;
|
|
}
|
|
|
|
void CFZHLDlg::OnSelchangeCmbShape()
|
|
{
|
|
if (!m_bInplace)
|
|
UpdateData();
|
|
|
|
if (m_nShape >= 0 && m_nShape <= 2)
|
|
{
|
|
GetDlgItem(IDC_STEELTYPE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_CMBSTEEL)->ShowWindow(SW_HIDE);
|
|
|
|
GetDlgItem(IDC_A)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_B)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_C)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_D)->ShowWindow(SW_HIDE);
|
|
|
|
GetDlgItem(IDC_EDITA)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_EDITB)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_EDITC)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_EDITD)->ShowWindow(SW_HIDE);
|
|
}
|
|
|
|
if (m_nShape == 0) //矩形
|
|
{
|
|
m_sBlockName = _T("_FZH.DWG");
|
|
|
|
GetDlgItem(IDC_STC_XSIZE)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_STC_YSIZE)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_STC_XSIZE)->SetWindowText(_T("横向:"));
|
|
GetDlgItem(IDC_STC_YSIZE)->SetWindowText(_T("纵向:"));
|
|
|
|
GetDlgItem(IDC_STC_DIAMETER)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_EDGESIZE)->ShowWindow(SW_HIDE);
|
|
m_wndComboXSize.ShowWindow(SW_SHOW);
|
|
m_wndComboYSize.ShowWindow(SW_SHOW);
|
|
}
|
|
else if (m_nShape == 1) //圆形
|
|
{
|
|
m_sBlockName = _T("_YZH.DWG");
|
|
GetDlgItem(IDC_STC_XSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_YSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_DIAMETER)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_STC_EDGESIZE)->ShowWindow(SW_HIDE);
|
|
m_wndComboXSize.ShowWindow(SW_SHOW);
|
|
m_wndComboYSize.ShowWindow(SW_HIDE);
|
|
}
|
|
else if(m_nShape == 2) // 正六边形
|
|
{
|
|
m_sBlockName = _T("_DBXZH6.DWG");
|
|
GetDlgItem(IDC_STC_XSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_YSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_DIAMETER)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_EDGESIZE)->ShowWindow(SW_SHOW);
|
|
m_wndComboXSize.ShowWindow(SW_SHOW);
|
|
m_wndComboYSize.ShowWindow(SW_HIDE);
|
|
}
|
|
else if (m_nShape == 3)// 工字形
|
|
{
|
|
m_sBlockName = _T("_ZZH.dwg");
|
|
GetDlgItem(IDC_STC_XSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_YSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_DIAMETER)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_EDGESIZE)->ShowWindow(SW_HIDE);
|
|
m_wndComboXSize.ShowWindow(SW_HIDE);
|
|
m_wndComboYSize.ShowWindow(SW_HIDE);
|
|
|
|
GetDlgItem(IDC_STEELTYPE)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_CMBSTEEL)->ShowWindow(SW_SHOW);
|
|
|
|
GetDlgItem(IDC_A)->SetWindowText(_T("A:"));
|
|
GetDlgItem(IDC_A)->ShowWindow(SW_SHOW);
|
|
|
|
GetDlgItem(IDC_B)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_C)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_D)->ShowWindow(SW_SHOW);
|
|
|
|
GetDlgItem(IDC_EDITA)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_EDITB)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_EDITC)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_EDITD)->ShowWindow(SW_SHOW);
|
|
|
|
//加载数据
|
|
CString sSQL = _T("select [型钢型号] from AecSteeldata where [型钢类型]='工字钢' order by A DESC");
|
|
|
|
CStringArray arValues;
|
|
m_dbSQLite.GetSelData(sSQL,arValues);
|
|
|
|
m_wndComSteel.ResetContent();
|
|
for (int i = 0;i < arValues.GetSize();i++)
|
|
{
|
|
m_wndComSteel.AddString(arValues.GetAt(i));
|
|
}
|
|
if (!m_bInplace)
|
|
{
|
|
m_wndComSteel.SetCurSel(0);
|
|
OnSelchangeCmbsteel();
|
|
}
|
|
}
|
|
else if (m_nShape == 4) // 槽钢
|
|
{
|
|
m_sBlockName = _T("_OZH.dwg");
|
|
GetDlgItem(IDC_STC_XSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_YSIZE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_DIAMETER)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_EDGESIZE)->ShowWindow(SW_HIDE);
|
|
m_wndComboXSize.ShowWindow(SW_HIDE);
|
|
m_wndComboYSize.ShowWindow(SW_HIDE);
|
|
|
|
GetDlgItem(IDC_STEELTYPE)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_CMBSTEEL)->ShowWindow(SW_SHOW);
|
|
|
|
GetDlgItem(IDC_A)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_A)->SetWindowText(_T("A:"));
|
|
|
|
GetDlgItem(IDC_B)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_C)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_D)->ShowWindow(SW_SHOW);
|
|
|
|
GetDlgItem(IDC_EDITA)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_EDITB)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_EDITC)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_EDITD)->ShowWindow(SW_SHOW);
|
|
|
|
//加载数据
|
|
CString sSQL = _T("select [型钢型号] from AecSteeldata where [型钢类型]='槽钢' order by A DESC");
|
|
|
|
CStringArray arValues;
|
|
m_dbSQLite.GetSelData(sSQL,arValues);
|
|
|
|
m_wndComSteel.ResetContent();
|
|
for (int i = 0;i < arValues.GetSize();i++)
|
|
{
|
|
m_wndComSteel.AddString(arValues.GetAt(i));
|
|
}
|
|
if (!m_bInplace)
|
|
{
|
|
m_wndComSteel.SetCurSel(0);
|
|
OnSelchangeCmbsteel();
|
|
}
|
|
}
|
|
else if (m_nShape == 5)//梯形
|
|
{
|
|
m_sBlockName = _T("_TXZH.dwg");
|
|
|
|
GetDlgItem(IDC_STEELTYPE)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_CMBSTEEL)->ShowWindow(SW_HIDE);
|
|
|
|
GetDlgItem(IDC_A)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_A)->SetWindowText(_T("高度:"));
|
|
GetDlgItem(IDC_EDITA)->ShowWindow(SW_SHOW);
|
|
|
|
GetDlgItem(IDC_B)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_C)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_D)->ShowWindow(SW_HIDE);
|
|
|
|
GetDlgItem(IDC_EDITB)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_EDITC)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_EDITD)->ShowWindow(SW_HIDE);
|
|
|
|
//梯形
|
|
if (m_sA.IsEmpty())
|
|
m_sA = _T("500");
|
|
|
|
GetDlgItem(IDC_STC_XSIZE)->ShowWindow(SW_SHOW);
|
|
GetDlgItem(IDC_STC_YSIZE)->ShowWindow(SW_SHOW);
|
|
|
|
GetDlgItem(IDC_STC_XSIZE)->SetWindowText(_T("顶宽:"));
|
|
GetDlgItem(IDC_STC_YSIZE)->SetWindowText(_T("底宽:"));
|
|
|
|
GetDlgItem(IDC_STC_DIAMETER)->ShowWindow(SW_HIDE);
|
|
GetDlgItem(IDC_STC_EDGESIZE)->ShowWindow(SW_HIDE);
|
|
m_wndComboXSize.ShowWindow(SW_SHOW);
|
|
m_wndComboYSize.ShowWindow(SW_SHOW);
|
|
}
|
|
|
|
UpdateData(FALSE);
|
|
|
|
PreviewColumn();
|
|
}
|
|
|
|
void CFZHLDlg::PreviewColumn()
|
|
{
|
|
CString sPath;
|
|
sPath = FilePath::GetSysDir();
|
|
sPath.Replace(_T("\\sys"),_T("\\Support"));
|
|
CString sDwgFile = sPath + _T("\\Cells\\") + m_sBlockName;
|
|
|
|
if (m_pDb != NULL)
|
|
delete m_pDb;
|
|
|
|
m_pDb = new AcDbDatabase(Adesk::kFalse);
|
|
Acad::ErrorStatus es = m_pDb->readDwgFile(sDwgFile);
|
|
if (es != Acad::eOk)
|
|
{
|
|
AfxMessageBox(CString(_T("打开文件失败 \"")) + sDwgFile + _T("\""));
|
|
delete m_pDb;
|
|
m_pDb = NULL;
|
|
return;
|
|
}
|
|
|
|
m_wndPreview.clearAll();
|
|
|
|
// now initialise the drawing control
|
|
InitDrawingControl(m_pDb);
|
|
Invalidate();
|
|
RedrawWindow();
|
|
}
|
|
|
|
Acad::ErrorStatus CFZHLDlg::InitDrawingControl (AcDbDatabase *pDb, const TCHAR *space)
|
|
{
|
|
// have we got a valid drawing
|
|
if (pDb == NULL)
|
|
return Acad::eNullBlockName;
|
|
|
|
AcDbBlockTableRecordPointer spaceRec(space, pDb, AcDb::kForRead);
|
|
// if ok
|
|
if (spaceRec.openStatus() == Acad::eOk)
|
|
{
|
|
// initialize the preview control
|
|
m_wndPreview.init(true);
|
|
// set the view to the *Active* AutoCAD view
|
|
|
|
AcGeMatrix3d xform;
|
|
SetViewTo(m_wndPreview.mpView, pDb, xform);
|
|
// tell the view to display this space
|
|
m_wndPreview.view()->add(spaceRec.object(), m_wndPreview.model());
|
|
}
|
|
return spaceRec.openStatus();
|
|
}
|
|
|
|
bool CFZHLDlg::GetActiveViewPortInfo (AcDbDatabase *pDb, ads_real &height, ads_real &width, AcGePoint3d &target, AcGeVector3d &viewDir, ads_real &viewTwist, bool getViewCenter)
|
|
{
|
|
// if not ok
|
|
if (pDb == NULL)
|
|
return false;
|
|
|
|
//以下{}导致崩溃
|
|
//{
|
|
// get the current working database as a backup
|
|
//AcDbDatabase *workingDataBase = acdbHostApplicationServices()->workingDatabase();
|
|
// now set the working database
|
|
//acdbHostApplicationServices()->setWorkingDatabase(pDb);
|
|
|
|
// make sure the active view port is uptodate
|
|
//acedVports2VportTableRecords();
|
|
//}
|
|
|
|
// open the view port records
|
|
AcDbViewportTable *pVTable = NULL;
|
|
Acad::ErrorStatus es = pDb->getViewportTable (pVTable, AcDb::kForRead);
|
|
// if we opened them ok
|
|
if (es == Acad::eOk)
|
|
{
|
|
AcDbViewportTableRecord *pViewPortRec = NULL;
|
|
es = pVTable->getAt (_T("*Active"), pViewPortRec, AcDb::kForRead);
|
|
if (es == Acad::eOk)
|
|
{
|
|
// get the height of the view
|
|
height = pViewPortRec->height ();
|
|
// get the width
|
|
width = pViewPortRec->width ();
|
|
// if the user wants the center of the viewport used
|
|
if (getViewCenter == true)
|
|
{
|
|
struct resbuf rb;
|
|
memset (&rb, 0, sizeof (struct resbuf));
|
|
// get the system var VIEWCTR
|
|
acedGetVar (_T("VIEWCTR"), &rb);
|
|
// set that as the target
|
|
target = AcGePoint3d (rb.resval.rpoint[X], rb.resval.rpoint[Y], rb.resval.rpoint[Z]);
|
|
}
|
|
// we want the viewports camera target setting
|
|
else
|
|
{
|
|
// get the target of the view
|
|
target = pViewPortRec->target ();
|
|
}
|
|
|
|
// get the view direction
|
|
viewDir = pViewPortRec->viewDirection ();
|
|
// get the view twist of the viewport
|
|
viewTwist = pViewPortRec->viewTwist ();
|
|
}
|
|
// close after use
|
|
pVTable->close ();
|
|
pViewPortRec->close();
|
|
}
|
|
|
|
//以下导致崩溃
|
|
// now restore the original working database
|
|
//acdbHostApplicationServices()->setWorkingDatabase(workingDataBase);
|
|
|
|
return (true);
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// set the passed AcGsView to the *Active* AutoCAD AcDbDatabase view
|
|
void CFZHLDlg::SetViewTo(AcGsView *pView, AcDbDatabase *pDb, AcGeMatrix3d& viewMat)
|
|
{
|
|
// we are going to set the view to the current view of the drawing
|
|
// The overall approach is to calculate the extents of the database in the coordinate system of the view
|
|
// Calculate the extents in WCS
|
|
AcGePoint3d extMax = pDb->extmax();
|
|
AcGePoint3d extMin = pDb->extmin();
|
|
|
|
// get the view port information - see parameter list
|
|
ads_real height = 0.0, width = 0.0, viewTwist = 0.0;
|
|
AcGePoint3d targetView;
|
|
AcGeVector3d viewDir;
|
|
GetActiveViewPortInfo (pDb, height, width, targetView, viewDir, viewTwist, true);
|
|
|
|
// we are only interested in the directions of the view, not the sizes, so we normalise.
|
|
viewDir = viewDir.normal();
|
|
|
|
//**********************************************
|
|
// Our view coordinate space consists of z direction
|
|
// get a perp vector off the z direction
|
|
// Make sure its normalised
|
|
AcGeVector3d viewXDir = viewDir.perpVector ().normal();
|
|
// correct the x angle by applying the twist
|
|
viewXDir = viewXDir.rotateBy (viewTwist, -viewDir);
|
|
// now we can work out y, this is of course perp to the x and z directions. No need to normalise this,
|
|
// as we know that x and z are of unit length, and perpendicular, so their cross product must be on unit length
|
|
AcGeVector3d viewYDir = viewDir.crossProduct (viewXDir);
|
|
|
|
// find a nice point around which to transform the view. We'll use the same point as the center of the view.
|
|
AcGePoint3d boxCenter = extMin + 0.5 * ( extMax - extMin );
|
|
|
|
//**********************************************
|
|
// create a transform from WCS to View space
|
|
// this represents the transformation from WCS to the view space. (Actually not quite since
|
|
// we are keeping the fixed point as the center of the box for convenience )
|
|
viewMat = AcGeMatrix3d::alignCoordSys (boxCenter, AcGeVector3d::kXAxis, AcGeVector3d::kYAxis, AcGeVector3d::kZAxis,
|
|
boxCenter, viewXDir, viewYDir, viewDir).inverse();
|
|
|
|
AcDbExtents wcsExtents(extMin, extMax);
|
|
// now we have the view Extents
|
|
AcDbExtents viewExtents = wcsExtents;
|
|
// transforms the extents in WCS->view space
|
|
viewExtents.transformBy (viewMat);
|
|
|
|
//**********************************************
|
|
// get the extents of the AutoCAD view
|
|
double xMax = fabs(viewExtents.maxPoint ().x - viewExtents.minPoint ().x);
|
|
double yMax = fabs(viewExtents.maxPoint ().y - viewExtents.minPoint ().y);
|
|
|
|
//**********************************************
|
|
// setup the view
|
|
AcGePoint3d eye = boxCenter + viewDir;
|
|
|
|
// upvector
|
|
pView->setView(eye, boxCenter, viewYDir, xMax, yMax);
|
|
// update the gsView
|
|
if (pView != NULL)
|
|
{
|
|
pView->invalidate();
|
|
pView->update();
|
|
}
|
|
}
|
|
|
|
void CFZHLDlg::OnSelchangeCmbsteel()
|
|
{
|
|
UpdateData();
|
|
//加载数据
|
|
int nCursel = m_wndComSteel.GetCurSel();
|
|
if (nCursel != -1)
|
|
{
|
|
CString sText,sSQL;
|
|
m_wndComSteel.GetLBText(nCursel,sText);
|
|
if (m_nShape == 3)
|
|
{
|
|
sSQL.Format(_T("select A,B,C,D from AecSteeldata where [型钢类型]='工字钢' and [型钢型号]='%s'"),sText);
|
|
}
|
|
else if (m_nShape == 4)
|
|
{
|
|
sSQL.Format(_T("select A,B,C,D from AecSteeldata where [型钢类型]='槽钢' and [型钢型号]='%s'"),sText);
|
|
}
|
|
CStringArray arValues;
|
|
m_dbSQLite.GetSelData(sSQL,arValues);
|
|
|
|
if (arValues.GetSize() == 4)
|
|
{
|
|
m_sA = arValues.GetAt(0);
|
|
m_sB = arValues.GetAt(1);
|
|
m_sC = arValues.GetAt(2);
|
|
m_sD = arValues.GetAt(3);
|
|
UpdateData(FALSE);
|
|
}
|
|
}
|
|
}
|
|
|
|
void CFZHLDlg::GetXYSizeFromReg(AcDbRegion *pReg)
|
|
{
|
|
if (pReg != NULL)
|
|
{
|
|
AcDbVoidPtrArray arCurPtrs;
|
|
pReg->explode(arCurPtrs);
|
|
|
|
//double dTW = m_dXSize;
|
|
//double dtw = m_dYSize;
|
|
|
|
/*
|
|
+-------+ dTW
|
|
|
|
|
|
+-----+ dtw
|
|
*/
|
|
//最高Y m_dXSize
|
|
//最低y m_dYSize;
|
|
AcGeVector3d vt;
|
|
AcDbCurve *pCrv = NULL;
|
|
for (int i = 0;i < arCurPtrs.length();i++)
|
|
{
|
|
pCrv = (AcDbCurve *)arCurPtrs.at(i);
|
|
AcDbLine *pLn = AcDbLine::cast(pCrv);
|
|
if (pLn != NULL)
|
|
{
|
|
vt = pLn->endPoint() - pLn->startPoint();
|
|
if (vt.isParallelTo(AcGeVector3d::kXAxis))
|
|
{
|
|
if (pLn->endPoint().y > 0)
|
|
{
|
|
m_dXSize = pLn->endPoint().distanceTo(pLn->startPoint());
|
|
}
|
|
else
|
|
{
|
|
m_dYSize = pLn->endPoint().distanceTo(pLn->startPoint());
|
|
}
|
|
}
|
|
}
|
|
delete pCrv;
|
|
}
|
|
}
|
|
}
|
|
|
|
void CFZHLDlg::SetFromCol(const AcDbObjectId& id)
|
|
{
|
|
m_idCol = id;
|
|
|
|
AcAxDocLock lock;
|
|
AcDbEntity* pEnt = NULL;
|
|
if ( Acad::eOk == acdbOpenAcDbEntity(pEnt,id,AcDb::kForRead))
|
|
{
|
|
AecDbBeam* pCol = AecDbBeam::cast(pEnt);
|
|
if (pCol != NULL)
|
|
{
|
|
ColumnParam data;
|
|
memset(&data,0,sizeof(ColumnParam));
|
|
|
|
pCol->GetBeamData(data);
|
|
pCol->GetSpecialtyData(AcDb::kForRead)->GetAt(KEY_NO,m_sNo);
|
|
m_sModel = data.m_sModel;
|
|
m_sHatch = data.m_sHatch;
|
|
if (m_sHatch == HATCH_NO_NEED)
|
|
m_bAddHatch = FALSE;
|
|
else
|
|
m_bAddHatch = TRUE;
|
|
|
|
m_sBlockName = data.m_sBlockName;
|
|
|
|
m_sA.Format(_T("%g"),data.m_dSizes[0]);
|
|
m_sB.Format(_T("%g"),data.m_dSizes[1]);
|
|
m_sC.Format(_T("%g"),data.m_dSizes[2]);
|
|
m_sD.Format(_T("%g"),data.m_dSizes[3]);
|
|
|
|
m_dXOffset = data.m_dXExtend;
|
|
m_dYOffset = data.m_dYExtend;
|
|
|
|
m_dXSize = data.m_dXScale;
|
|
m_dYSize = data.m_dYScale;
|
|
m_nShape = data.m_nShape;
|
|
|
|
if (m_nShape == 5)
|
|
{
|
|
AcDbRegion* pReg = pCol->GetSection();
|
|
if (pReg != NULL)
|
|
{
|
|
GetXYSizeFromReg(pReg);
|
|
delete pReg;
|
|
}
|
|
}
|
|
|
|
m_dStartEl = data.m_dBomEl;
|
|
m_dEndEl = data.m_dEndEl;
|
|
m_dH = data.m_dH;
|
|
m_sMaterial = data.m_sMaterial;
|
|
m_bInplace = true;
|
|
}
|
|
pEnt->close();
|
|
}
|
|
}
|
|
|
|
extern "C" AcDbRegion *GetColumnRegion(const ColumnParam &ColParam);
|
|
void CFZHLDlg::UpdateColData()
|
|
{
|
|
AcAxDocLock lock;
|
|
AcDbEntity* pEnt = NULL;
|
|
if ( Acad::eOk == acdbOpenAcDbEntity(pEnt,m_idCol,AcDb::kForWrite))
|
|
{
|
|
AecDbBeam* pCol = AecDbBeam::cast(pEnt);
|
|
if (pCol != NULL)
|
|
{
|
|
pCol->GetSpecialtyData()->SetAt(KEY_NO,m_sNo);
|
|
ColumnParam ColParam;
|
|
GetColumnParam(ColParam);
|
|
|
|
AcDbRegion* pRegAll = GetColumnRegion(ColParam);
|
|
if (pRegAll != NULL)
|
|
{
|
|
pCol->SetSection(pRegAll,AcGePoint3d::kOrigin);
|
|
DELETE_PTR(pRegAll);
|
|
}
|
|
|
|
AcDbRegion *pReg = pCol->GetSection();
|
|
if (pReg)
|
|
{
|
|
AcDbExtents ext;
|
|
pReg->getGeomExtents(ext);
|
|
double dH = ext.maxPoint().y - ext.minPoint().y;
|
|
|
|
ColParam.m_dBomEl -= dH * .5;
|
|
ColParam.m_dEndEl -= dH * .5;
|
|
|
|
pCol->SetTopEl(ColParam.m_dBomEl);
|
|
pCol->SetEndEl(ColParam.m_dEndEl);
|
|
|
|
DELETE_PTR(pReg);
|
|
}
|
|
|
|
pCol->GetSpecialtyData()->SetAt(KEY_NO,ColParam.m_szNo);
|
|
pCol->GetSpecialtyData()->SetAt(KEY_MATERIAL,ColParam.m_sMaterial);
|
|
pCol->GetSpecialtyData()->SetAt(KEY_SHAPE,ColParam.m_nShape);
|
|
pCol->GetSpecialtyData()->SetAt(KEY_BLOCKNAME,ColParam.m_sBlockName);
|
|
|
|
pCol->GetSpecialtyData()->SetAt(KEY_SIZE1, ColParam.m_dSizes[0]);
|
|
pCol->GetSpecialtyData()->SetAt(KEY_SIZE2, ColParam.m_dSizes[1]);
|
|
pCol->GetSpecialtyData()->SetAt(KEY_SIZE3, ColParam.m_dSizes[2]);
|
|
pCol->GetSpecialtyData()->SetAt(KEY_SIZE4, ColParam.m_dSizes[3]);
|
|
|
|
pCol->GetSpecialtyData()->SetAt(KEY_XS, ColParam.m_dXScale);
|
|
pCol->GetSpecialtyData()->SetAt(KEY_YS, ColParam.m_dYScale);
|
|
pCol->GetSpecialtyData()->SetAt(KEY_SECTION_HATCH, ColParam.m_sHatch);
|
|
pCol->GetSpecialtyData()->SetAt(AecDbColumn::KEY_COL_MODEL, ColParam.m_sModel);
|
|
|
|
}
|
|
pEnt->close();
|
|
}
|
|
}
|
|
|
|
void CFZHLDlg::OnBnClickedOk()
|
|
{
|
|
// TODO: 在此添加控件通知处理程序代码
|
|
OnOK();
|
|
}
|
|
|
|
void CFZHLDlg::OnDestroy()
|
|
{
|
|
CDialog::OnDestroy();
|
|
|
|
m_wndPreview.clearAll();
|
|
if (m_pDb != NULL)
|
|
delete m_pDb;
|
|
m_pDb = NULL;
|
|
}
|
|
|
|
void CFZHLDlg::OnBnClickedCheck1()
|
|
{
|
|
UpdateData();
|
|
|
|
if (m_bNOSetDefault)
|
|
{
|
|
GetDlgItem(IDC_EDIT6)->EnableWindow(FALSE);
|
|
}
|
|
else
|
|
{
|
|
GetDlgItem(IDC_EDIT6)->EnableWindow(TRUE);
|
|
}
|
|
}
|
|
|
|
extern bool __cdecl acedHatchPalletteDialog(wchar_t const* , bool , wchar_t *&);
|
|
void CFZHLDlg::OnBnClickedBtnFill()
|
|
{
|
|
UpdateData();
|
|
TCHAR *psz = new TCHAR[1024];
|
|
::memset(psz, 0, sizeof(TCHAR) * 1024);
|
|
|
|
CString sHatch(m_sMaterial);
|
|
if (!m_sHatch.IsEmpty())
|
|
sHatch = m_sHatch;
|
|
|
|
if (acedHatchPalletteDialog(sHatch, false, psz))
|
|
{
|
|
m_sHatch = psz;
|
|
m_wndBtHatch.SetWindowText(m_sHatch);
|
|
}
|
|
|
|
delete[] psz;
|
|
}
|
|
|
|
|
|
void CFZHLDlg::OnBnClickedCheckHatch()
|
|
{
|
|
UpdateData();
|
|
m_wndBtHatch.EnableWindow(m_bAddHatch);
|
|
if (!m_bAddHatch)
|
|
m_sHatch = HATCH_NO_NEED;
|
|
else
|
|
m_sHatch = HATCH_DEFAULT;
|
|
|
|
UpdateData(FALSE);
|
|
}
|