15871770120 发表于 2009-10-8 13:44:00

[求助]自动加载改变线型为fenceline

<p>以下是我的程序,可以执行成功改变线型为fenceline,但是需要在AutoCAD里手动将线型加载为fenceline,只有这样程序才能成功执行。请问如何通过程序实现自动加载线型为fenceline。我是用C#开发,最好用.net实现。<br/>PromptSelectionOptions selectionOp = new PromptSelectionOptions();<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; PromptSelectionResult result = ed.GetSelection(selectionOp);<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; if (result.Status == PromptStatus.OK)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; {<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;SelectionSet set = result.Value;<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;ObjectId[] ID = set.GetObjectIds();<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;foreach (ObjectId id in ID)<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;{<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;Entity ent = (Entity)trans.GetObject(id, OpenMode.ForWrite);<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;ent.Linetype = "FENCELINE1";<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;ed.WriteMessage("操作成功!!");<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;}<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; }<br/>&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; trans.Commit();</p><p>还请各位老大帮忙解决啊,呵呵</p>

雪山飞狐_lzh 发表于 2009-10-8 14:14:00

public void LoadLineTypeFile(<br/>&nbsp;&nbsp;&nbsp; string lineTypeName, <br/>&nbsp;&nbsp;&nbsp; string filename<br/>);<br/>This function loads the linetype specified by lineTypeName from the file specified by filename and stores it in the database on which this method is called. The lineTypeName parameter may contain wild card characters. If wild cards are used, multiple linetypes may be loaded. If filename is not a URL and does not contain a path, then the AutoCAD library search path is searched for the file.<br/>

15871770120 发表于 2009-10-8 14:49:00

老大,谢谢您的指点啊,可是我还是不知道怎样去实现啊,呵呵!

csu_yijie 发表于 2010-12-2 12:07:11

回复 15871770120 的帖子

可以用LoadLineTypeFile()函数自动加载线型文件,不必手动加载
页: [1]
查看完整版本: [求助]自动加载改变线型为fenceline