欢迎来到我的博客
Civil 3D开发与应用,欢迎加入QQ群:484124761
AutoCAD开发,欢迎加入QQ群:193522571

创建道路曲面

有群友遇到下面问题:

想不出问题出在哪里,

于是自己写了测试代码,

使用样例文件中的Corridor-3b.dwg进行测试,

(Civil 3d 2018简体中文版)

(C:\Program Files\Autodesk\AutoCAD 2018\C3D\Help\Civil Tutorials\Drawings)

并没有发现问题。

有兴趣的朋友可以测试一下:

[CommandMethod("MyGroup", "Tt103", CommandFlags.Modal)]

public void TestCommand3() // This method can have any name

{

Document doc = Application.DocumentManager.CurrentDocument;

Editor ed = doc.Editor;

CivilDocument cDoc = CivilApplication.ActiveDocument;

PromptEntityOptions peo = new PromptEntityOptions("\n拾取道路");

peo.SetRejectMessage("\n选择道路");

peo.AddAllowedClass(typeof(Corridor), true);

PromptEntityResult per = ed.GetEntity(peo);

if (per.Status == PromptStatus.OK)

{

try

{

using (Transaction tr = doc.TransactionManager.StartTransaction())

{

Corridor cor = per.ObjectId.GetObject(OpenMode.ForWrite) as Corridor;

CorridorSurface cs = cor.CorridorSurfaces.Add("Test");

cs.AddLinkCode("顶部", false);

tr.Commit();

}

}

catch (System.Exception ex)

{

ed.WriteMessage(ex.Message);

}

}

 

测试结果

}

posted @   david96007  阅读(740)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示