明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1740|回复: 4

关于sengcommand

[复制链接]
发表于 2009-8-20 14:37:00 | 显示全部楼层 |阅读模式

            Polyline offsetBox = cutBox.GetOffsetCurves(0.2)[0] as Polyline;
            if (offsetBox.Area < cutBox.Area)
            {
                offsetBox = cutBox.GetOffsetCurves(-0.2)[0] as Polyline;
            }
            Point3d[] p = new Point3d[offsetBox.NumberOfVertices];
            for (int i = 0; i < offsetBox.NumberOfVertices; i++)
            {
                p=new Point3d(offsetBox.GetPoint3dAt(i).X, offsetBox.GetPoint3dAt(i).Y, 0);
            }

            offsetBox.Dispose();
            //裁剪
            acdDoc.SendCommand("TRIM\r");
            acdDoc.SendCommand(cutBox.ObjectId.ToString() + "\r\r");
            for (int i = p.GetLowerBound(0); i <= p.GetUpperBound(0); i++)
            {
                Point3d p1 = p;
                Point3d p2 = new Point3d();
                if (i == p.GetUpperBound(0))
                {
                    p2 = p[0];
                }
                else
                {
                    p2 = p[i + 1];
                }
                acdDoc.SendCommand("f\r");
                acdDoc.SendCommand(p1.X.ToString()+","+p1.Y.ToString() + "\r");
                acdDoc.SendCommand(p2.X.ToString()+","+p2.Y.ToString() + "\r\r");
                //CommandLine.Command("TRIM", cutBox.ObjectId, "", "F", p1, p2, "", "");
            }
            acdDoc.SendCommand("\r");
这段代码中发送坐标会让CAD死机,同样的数据也这样把坐标手工输入就没问题,为什么会这样?

发表于 2009-8-20 15:40:00 | 显示全部楼层

能用代码实现就尽量不要用SendCommand

看看置顶的曲线贴

 楼主| 发表于 2009-8-22 17:42:00 | 显示全部楼层
纠正,经过几天的跟踪调试,发现不是发送坐标引起的,是cutBox.ObjectID.Tostring()这句闹的,谁知道怎么实现向命令行发送实体?
发表于 2009-8-22 18:54:00 | 显示全部楼层
使用曲线类的GetSplitCurves方法可以满足你的要求,不推荐用SendCommand方法
发表于 2009-8-26 10:17:00 | 显示全部楼层
看高手出招
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-29 09:57 , Processed in 0.180886 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表