[AppleScript] 纯文本查看 复制代码 /*
* 批量圆球
*/
using System;
using System.Collections.Generic;
using Rhino;
using Rhino.Commands;
using Rhino.Geometry;
using Rhino.Input;
using Rhino.Input.Custom;
//
//创建批量圆球
namespace MyRhinoPlugIn
{
[System.Runtime.InteropServices.Guid("d44a4efa-be5d-495f-979c-e353d53be1a1"),
Rhino.Commands.CommandStyle(Style.ScriptRunner)]
public class C_MultipleSphere : Command
{
public C_MultipleSphere()
{
// Rhino only creates one instance of each command class defined in a
// plug-in, so it is safe to store a refence in a static property.
Instance = this;
}
///<summary>The only instance of this command.</summary>
public static C_MultipleSphere Instance
{
get;
private set;
}
///<returns>The command name as it appears on the Rhino command line.</returns>
public override string EnglishName
{
get { return "C_MultipleSphere"; }
}
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
Rhino.DocObjects.ObjRef[] obj;
double num = 0;
Result re;
re = RhinoGet.GetMultipleObjects("请选择放置圆球位置点", true, Rhino.DocObjects.ObjectType.Point, out obj);
if (re == Result.Cancel)
return Result.Success;
re = RhinoGet.GetNumber("请输入圆球半径", true, ref num, 0, 100);
if (re == Result.Cancel)
return Result.Success;
if (obj == null || num == 0)
{
RhinoApp.WriteLine("输入参数不正确请查证");
return Result.Success;
}
else
{
for (int i = 0; i < obj.Length; i++)
{
Rhino.DocObjects.ObjRef iobj = obj[i];
Point p = iobj.Point();
doc.Objects.AddSphere(new Sphere(new Point3d(p.Location), num));
}
}
doc.Views.Redraw();
return Result.Success;
}
}
}
|