获取应用、文档及当前视图信息
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIApplication uiapp = commandData.Application;
Application app = uiapp.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Document doc = uidoc.Document;
View view = commandData.View;
LanguageType lt = app.Language;
ProductType pt = app.Product;
string s = "Application = " + app.VersionName
+ "\r\nLanguage = " + lt.ToString()
+ "\r\nProduct = " + pt.ToString()
+ "\r\nVersion = " + app.VersionNumber
+ "\r\nDocument path = " + doc.PathName // empty if not yet saved
+ "\r\nDocument title = " + doc.Title
+ "\r\nView name = " + view.Name;
TaskDialog.Show("In",s);
return Result.Succeeded;
}
根据点集合连线
List<XYZ> corners = new List<XYZ>(4);
corners.Add(XYZ.Zero);
corners.Add(new XYZ(5, 0, 0));
corners.Add(new XYZ(5, 10, 0));
corners.Add(new XYZ(0, 10, 0));
for (int i = 0; i < 4; ++i)
{
Line line = Line.CreateBound(corners[i], corners[3 == i ? 0 : i + 1]);
}