Site Tools


Attaching Custom Data to Objects

Developer: .NET
Summary: Demonstrates how to attach custom data to objects using .NET

Download

Tagging objects with C# - tags objects with estimating data using C#.

Overview

A common question asked of SDK developers is how to attach, or tag, objects with application-specific data. For example, if you were writing a construction cost estimating plug-in, you would want to attach specific properties, such as material, labor, cost to Rhino objects.

Estimator plug-in

The Estimator plug-in (download the source code above) is a sample C# plug-in that demonstrates how to attach custom data to Rhino objects. The sample code demonstrates several useful techniques, including:

  1. Reading data from a web site.
  2. Picking Rhino objects.
  3. Attaching custom data to any Rhino object.
  4. Iterating Rhino's geometry table.
  5. Calculating object length, area, and volume.
  6. Writing to CSV files.
  7. Writing to XML files.
  8. More…

The Estimator plug-in sample code contains useful commands.

  1. EstTagItem - attaches a single tag to an item.
  2. EstTagLinear - attaches linear-specific tags to curves.
  3. EstTagArea - attaches area-specific tags to closed planar curves, surfaces, polysurfaces, and meshes.
  4. EstTagVolume - attaches volume-specific tags to closed planar curves, surfaces, polysurfaces, and meshes.
  5. EstReportOne - saves a tag report to an XML file.
  6. EstReportAll - saves all tag data to either a CSV or an XML file.
  7. EstReportItemCounts - counts the number of single item tags and reports the totals to the command line.

Please note, this is not a full-fledged cost estimating system. Rather, it is sample code to get you started writing your own tagging or estimating plug-in.


developer/estimator.txt · Last modified: 2016/02/09 by sandy