www.mxdraw.com
|
图纸剪切
static BOOL ExApp_CutDwg(IN DOUBLE dX1, IN DOUBLE IN dY1, IN DOUBLE dX2, IN DOUBLE IN dY2, IN LPCTSTR pszFileName, IN DOUBLE dPdfPaperWidth = 297, IN DOUBLE dPdfPaperHeight = 210);
参数 |
说明 |
IN DOUBLE dX1 |
保存范围的左下角位置X值 |
IN DOUBLE IN dY1 |
保存范围的左下角位置Y值 |
IN DOUBLE dX2 |
保存范围的右上角位置X值 |
IN DOUBLE IN dY2 |
保存范围的右上角位置Y值 |
IN DOUBLE dPdfPaperWidth = 297 |
转pdf时,图纸宽度,默认297 |
IN DOUBLE dPdfPaperHeight = 210 |
转pdf时,图纸高度,默认210 |
sFile |
保存的文件名 |
成功返回true通过pRet->AtLong(1)得到。
例如: VB代码
Set mxUtility = New MxDrawXLib.MxDrawUtility Dim getPt As MxDrawXLib.MxDrawPoint Set getPt = mxUtility.GetPoint(, Chr(13) + Chr(10) + "输入矩形框左下角点:") If (getPt Is Nothing) Then Exit Sub End If Set param = New MxDrawXLib.MxDrawResbuf param.AddDouble getPt.x, -10 param.AddDouble getPt.y, -10 Set retParam = MxDrawX1.CallEx("Mx_GetCorner", param) If retParam.AtString(0) = "Ok" Then Set param2 = New MxDrawXLib.MxDrawResbuf param2.AddDouble retParam.AtDouble(1) param2.AddDouble retParam.AtDouble(2) param2.AddDouble getPt.x param2.AddDouble getPt.y param2.AddString "c:11111.dwg" MxDrawX1.CallEx "ExApp_CutDwg", param2 End If
例如: C#代码
private void CutDwgFun() { MxDrawUtility mxUtility = new MxDrawUtility(); MxDrawPoint pt = (MxDrawPoint)(mxUtility.GetPoint(null,"n 输入剪切矩形框左下角点:")); if (pt == null) { MessageBox.Show("用户取消.."); return; } MxDrawResbuf param = new MxDrawResbuf(); param.AddDouble(pt.x); param.AddDouble(pt.y); MxDrawResbuf retParam = (MxDrawResbuf)axMxDrawX1.CallEx("Mx_GetCorner", param); if(retParam.AtString(0) == "Ok") { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "dwg 文件(*.dwg)|*.dwg"; if (sfd.ShowDialog() != DialogResult.OK) { return; } MxDrawResbuf param2 = new MxDrawResbuf(); param2.AddDouble(retParam.AtDouble(1)); param2.AddDouble(retParam.AtDouble(2)); param2.AddDouble(pt.x); param2.AddDouble(pt.y); param2.AddString(sfd.FileName); MxDrawResbuf ret; ret = (MxDrawResbuf)axMxDrawX1.CallEx("ExApp_CutDwg", param2); if(ret.AtString(0) == "Ok") { MessageBox.Show("剪切成功"); } else { MessageBox.Show("剪切失败"); } } }
例如: 剪切图纸,转成pdf,并指定pdf图纸的宽高.
MxDrawResbuf param2 = new MxDrawResbuf(); param2.AddDouble(retParam.AtDouble(1)); param2.AddDouble(retParam.AtDouble(2)); param2.AddDouble(pt.x); param2.AddDouble(pt.y); // 转pdf param2.AddString("I:\111.pdf"); // 转pdf时,图纸宽度 param2.AddDouble(500); param2.AddDouble(1000); MxDrawResbuf ret; ret = (MxDrawResbuf)axMxDrawX1.CallEx("ExApp_CutDwg", param2);