添加项目文件。
This commit is contained in:
47
HYJigPro/JigCircle.cs
Normal file
47
HYJigPro/JigCircle.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Autodesk.Revit.Attributes;
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
using System;
|
||||
|
||||
namespace HYJig
|
||||
{
|
||||
[Regeneration(0)]
|
||||
[Transaction(TransactionMode.Manual)]
|
||||
public class JigCircle : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData cmdData, ref string message, ElementSet elements)
|
||||
{
|
||||
UIDocument activeUIDocument = cmdData.Application.ActiveUIDocument;
|
||||
ViewAssist.ViewValidating(activeUIDocument.Document, activeUIDocument.ActiveView);
|
||||
XCircleJig xcircleJig = new XCircleJig(activeUIDocument);
|
||||
XYZ xyz = xcircleJig.PickCenterPoint("请确定圆中心点:");
|
||||
Result result;
|
||||
if (xyz == null)
|
||||
{
|
||||
xcircleJig.Dispose();
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
double num = xcircleJig.PickCircleRadius(xyz, "请确定圆上一点:");
|
||||
if (num == 0.0)
|
||||
{
|
||||
xcircleJig.Dispose();
|
||||
result = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Transaction transaction = new Transaction(activeUIDocument.Document);
|
||||
transaction.Start("CreateCurve");
|
||||
Arc arc = Arc.Create(xyz, num, 0.0, 6.2831853071795862, activeUIDocument.ActiveView.RightDirection, activeUIDocument.ActiveView.UpDirection);
|
||||
activeUIDocument.Document.Create.NewDetailCurve(activeUIDocument.ActiveView, arc);
|
||||
transaction.Commit();
|
||||
xcircleJig.Dispose();
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user