添加项目文件。
This commit is contained in:
33
HYJigPro/PickPoint.cs
Normal file
33
HYJigPro/PickPoint.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
using System;
|
||||
|
||||
namespace HYJig
|
||||
{
|
||||
[Regeneration(0)]
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
public class PickPoint : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData cmdData, ref string message, ElementSet elements)
|
||||
{
|
||||
try
|
||||
{
|
||||
UIDocument activeUIDocument = cmdData.Application.ActiveUIDocument;
|
||||
ViewAssist.ViewValidating(activeUIDocument.Document, activeUIDocument.ActiveView);
|
||||
XYZ xyz = activeUIDocument.Selection.PickPoint("请选择第一点:");
|
||||
XYZ xyz2 = activeUIDocument.Selection.PickPoint(xyz, activeUIDocument, "请选择第二点:");
|
||||
Transaction transaction = new Transaction(activeUIDocument.Document);
|
||||
transaction.Start("CreateCurve");
|
||||
Line line = Line.CreateBound(xyz, xyz2);
|
||||
activeUIDocument.Document.Create.NewDetailCurve(activeUIDocument.ActiveView, line);
|
||||
transaction.Commit();
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user