关于建设殡葬网站的报告范文wordpress 工具栏图标
web/
2025/10/4 8:33:47/
文章来源:
关于建设殡葬网站的报告范文,wordpress 工具栏图标,汕头网站建设stqhcx,站长素材网站看图的时候喜欢在图上直接标注意见#xff0c;但是如果还要再把意见一行一行的导出到word里面就很麻烦#xff0c;在网上看了一个审图软件#xff0c;报价要980#xff0c;而且那个审图意见做的太复杂了。
我的需求就是把图上标的单行文字和多行文字直接导出来就行#x…看图的时候喜欢在图上直接标注意见但是如果还要再把意见一行一行的导出到word里面就很麻烦在网上看了一个审图软件报价要980而且那个审图意见做的太复杂了。
我的需求就是把图上标的单行文字和多行文字直接导出来就行因此采用C#写了这个程序。
不多说直接上图上代码。 using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
using System.Xml.Linq;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Geometry;
using System.IO;namespace dcyj
{public class Class1{//审图意见导出内置了默认路径和默认图层避免重复劳动[CommandMethod(stjjdc)]public void BlockInLayerCAD(){Document arcdoc Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;Database arcdb HostApplicationServices.WorkingDatabase;Editor ed arcdoc.Editor;// 创建文本StreamWriter txtWtriter new StreamWriter(Stream.Null);if (File.Exists(E:\\24审图意见\\temple_yjdc.txt)){File.Delete(E:\\24审图意见\\temple_yjdc.txt);}String layerforexp 00000styj;ed.WriteMessage(\n 先把文字都调整到00000图层,文本保持目录为E:\\24审图意见\\temple_yjdc.txt);using (Transaction trans arcdb.TransactionManager.StartTransaction()){ txtWtriter File.AppendText(E:\\24审图意见\\temple_yjdc.txt);txtWtriter.WriteLine(以下意见详见CAD文件批注。);LayerTable lt (LayerTable)trans.GetObject(arcdb.LayerTableId, OpenMode.ForRead);if (!(lt.Has(layerforexp))){ed.WriteMessage(\n 找不图层00000styj请先把文字都调整到00000styj图层);}else{ed.WriteMessage(\n 已找到图层00000styj);BlockTableRecord ltr (BlockTableRecord)trans.GetObject(arcdb.CurrentSpaceId, OpenMode.ForRead);String stryj ;String enttype ;int index_YJ 1;foreach (ObjectId objectid in ltr){Entity ent (Entity)trans.GetObject(objectid, OpenMode.ForRead);enttype ent.GetType().Name;// ed.WriteMessage(\n enttype是: enttype);if (enttype.Equals(MText)ent.Layer.Equals(layerforexp)) {stryj index_YJ(ent as MText).Text.ToString();txtWtriter.WriteLine(stryj);ed.WriteMessage(\n 文字内容是 stryj);index_YJ;}else if (enttype.Equals(DBText) ent.Layer.Equals(layerforexp)){stryj index_YJ (ent as DBText).TextString.ToString();txtWtriter.WriteLine(stryj);ed.WriteMessage(\n 文字内容是 stryj);index_YJ;}}} trans.Commit();txtWtriter.Flush();txtWtriter.Close();}}}
}
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/86691.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!