赞
踩
Command;
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Document revitDoc = commandData.Application.ActiveUIDocument.Document; //取得文档 Autodesk.Revit.ApplicationServices.Application revitApp = commandData.Application.Application; //取得应用程序 UIDocument uiDoc = commandData.Application.ActiveUIDocument; //取得当前活动文档 //新建一个窗口 Window1 window1 = new Window1(); if (window1.ShowDialog() == true) { //窗口打开并停留,只有点击按键之后,窗口关闭并返回true } //通过按键来选择一条 while (!window1.Done) { //选择平曲线 if (window1.FlatCurve) { //因为要对原有模型线进行一个删除是对文件进行一个删除,故要创建一个事件 using(Transaction transaction = new Transaction(uiDoc.Document)) { transaction.Start("删除平曲线"); Selection sel = uiDoc.Selection; Reference ref1 = sel.PickObject(ObjectType.Element, "选择一条模型线作为平曲线"); Element elem = revitDoc.GetElement(ref1); ModelLine modelLine = elem as ModelLine; //做一个判断,判断其是否为ModelNurbSpline if (modelLine == null) { ModelNurbSpline modelNurbSpline = elem as ModelNurbSpline; FlatModelLine = modelNurbSpline.GeometryCurve; } else { FlatModelLine = modelLine.GeometryCurve; } //1、清除平曲线 2、重置window1.FlatCurve uiDoc.Document.Delete(elem.Id)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。