Click or drag to resize

InstanceDefinitionTableAdd Method (String, String, Point3d, IEnumerableGeometryBase)

Adds an instance definition to the instance definition table.

Namespace:  Rhino.DocObjects.Tables
Assembly:  RhinoCommon (in RhinoCommon.dll)
Syntax
public int Add(
	string name,
	string description,
	Point3d basePoint,
	IEnumerable<GeometryBase> geometry
)

Parameters

name
Type: SystemString
The definition name.
description
Type: SystemString
The definition description.
basePoint
Type: Rhino.GeometryPoint3d
A base point.
geometry
Type: System.Collections.GenericIEnumerableGeometryBase
An array, a list or any enumerable set of geometry.

Return Value

Type: Int32
>=0 index of instance definition in the instance definition table. -1 on failure.
Examples
C#
using System;

using Rhino;
using Rhino.Geometry;

partial class Examples
{
  public static Rhino.Commands.Result AddNestedBlock(RhinoDoc doc)
  {
    var circle = new Circle(Point3d.Origin, 5);
    Curve[] curveList = { new ArcCurve(circle) };
    var circleIndex = doc.InstanceDefinitions.Add("Circle", "Circle with radius of 5", Point3d.Origin, curveList);
    var transform = Transform.Identity;
    var irefId = doc.InstanceDefinitions[circleIndex].Id;
    var iref = new InstanceReferenceGeometry(irefId, transform);
    circle.Radius = circle.Radius * 2.0;
    GeometryBase[] blockList = { iref, new ArcCurve(circle) };
    var circle2Index = doc.InstanceDefinitions.Add("TwoCircles", "Nested block test", Point3d.Origin, blockList);
    doc.Objects.AddInstanceObject(circle2Index, transform);
    doc.Views.Redraw();
    return Rhino.Commands.Result.Success;
  }
}
Version Information

Rhino for Mac

Supported in: 5.4

Rhino for Windows

Supported in: 6.8
See Also