myzw

有群友遇到下面问题:

想不出问题出在哪里,

于是自己写了测试代码,

使用样例文件中的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);

}

}

 

测试结果

}

分类:

技术点:

相关文章:

  • 2021-12-03
  • 2021-06-20
  • 2022-01-26
  • 2021-05-20
  • 2021-06-28
  • 2021-06-05
  • 2022-02-28
  • 2021-08-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-07-04
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2021-10-31
相关资源
相似解决方案