关于autocad的二次开发!!

will_chen891010 will_chen891010 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
[CommandMethod("cre")]
public void cre()
{
int i,j;
MText mt = new MText();

TypedValue[] ty = new TypedValue[] { new TypedValue((int)DxfCode.Text,mt) };
SelectionFilter sel = new SelectionFilter(ty);
SelectionFilter fil = new SelectionFilter(ty);
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
PromptSelectionOptions re = new PromptSelectionOptions();
PromptSelectionResult su = ed.GetSelection(re );
if (su.Status != PromptStatus.OK)
{
return;
}
Autodesk.AutoCAD.EditorInput.SelectionSet SS = su.Value;
ObjectId[] idArray;
idArray = SS.GetObjectIds();
i = idArray.Length;
StreamWriter strw = File.CreateText("d:\\temp\\Mmmmtest.txt");
strw.WriteLine(i.ToString());


for (j = 0; j <= i - 1; j++)
{
//try
//{
if (idArray[j].GetObject(OpenMode.ForRead).GetType() is MText)
{


mt = (MText)idArray[j].GetObject(OpenMode.ForRead);
strw.WriteLine(mt.Contents.ToString());
}
else
{
continue;
}





}
strw.Close();


}
这编译都通过了,是关于autocad的二次开发的,目的是将text读取到txt文件中!!但是一再cad中用连autocad都直接挂了!!!说出现致命错误!高手救救火啊!!
...全文

相关推荐

评论 5
收藏 已收藏
分享
返回顶部
will_chen891010
C# 111,129 成员 642,539 内容