添加项目文件。
This commit is contained in:
57
HYJigPro/JigArc.cs
Normal file
57
HYJigPro/JigArc.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace HYJig
|
||||
{
|
||||
[Regeneration(0)]
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
public class JigArc : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData cmdData, ref string message, ElementSet elements)
|
||||
{
|
||||
UIDocument activeUIDocument = cmdData.Application.ActiveUIDocument;
|
||||
ViewAssist.ViewValidating(activeUIDocument.Document, activeUIDocument.ActiveView);
|
||||
XArcJig xarcJig = new XArcJig(activeUIDocument);
|
||||
XYZ xyz = xarcJig.PickCenterPoint("请确定圆弧中心点:");
|
||||
Result result;
|
||||
if (xyz == null)
|
||||
{
|
||||
xarcJig.Dispose();
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
XYZ xyz2 = xarcJig.PickStartPoint(xyz, "请确定圆弧起点:");
|
||||
if (xyz2 == null)
|
||||
{
|
||||
xarcJig.Dispose();
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
XYZ xyz3 = xarcJig.PickEndPoint(xyz, xyz2, "请确定圆弧终点:");
|
||||
if (xyz3 == null)
|
||||
{
|
||||
xarcJig.Dispose();
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Transaction transaction = new Transaction(activeUIDocument.Document);
|
||||
transaction.Start("CreateCurve");
|
||||
List<Curve> list = xarcJig.CreateCurves();
|
||||
activeUIDocument.Document.Create.NewDetailCurve(activeUIDocument.ActiveView, list[0]);
|
||||
transaction.Commit();
|
||||
xarcJig.Dispose();
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user