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