`
923723914
  • 浏览: 640273 次
文章分类
社区版块
存档分类
最新评论

Revit编程把对象加入到选择集中

 
阅读更多


这段时间在公司的内部工作十分紧张,导致些博客的时间几乎没有。接到这个问题:

怎么在用Api生成模型线或其他新生成的图元之后,选择刚生成的图元,并在revit文件中显示?


答:

Revit对象生成后,你可以把获得的对象加入到选择集中。

Selection.Elements.Add(Element elem)


比如这段代码是生成一根模型线线,然后把线加入到选择集中。命令结束后,该线已经加入到当前选择集中。

                        	Document doc = ;  //get the document
				Selection sel = // get the current selection UIDocument.Selection;
				
				Transaction trans = new Transaction(doc);
				trans.Start("createLineAddSelection");
				Line line = doc.Application.Create.NewLineBound(new XYZ(0,0,0),new XYZ(10,10,0));
				ModelCurve curve = doc.Create.NewModelCurve(line,doc.ActiveView.SketchPlane);
				sel.Elements.Add(curve);
				trans.Commit();				



转载请复制以下信息:
原文链接: http://blog.csdn.net/joexiongjin/article/details/9494645
作者: 叶雄进 , Autodesk ADN

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics