Looking for a very basic C# RhinoCommon example beyond "Your First Plugin"

Hello most excellent Rhino Devs – I’m a perennial C# beginner and am trying to write my own command line plugin on Mac, using VS, and the Rhino Plugin template boilerplate, aided by the RhinoCommon SDK.

I’m aiming to simply do something useless but that allows me to get my feet wet with writing a plugin from scratch. I’m thinking of creating a plugin that simply creates a text item in Rhino of a preset size, with a pre-written string, and then extrudes it a preset height. Nothing special, but any chances someone could provide some code guidance on this? I’m hoping once I piece together something simple like this I’ll start to get a better feel for it all.

Otherwise, if someone has any super-simple plugin just beyond the complexity of the provided Your First Plugin code, I’d be very grateful to see that and play around with it myself.

If only there were a lesson guide for learning how to build plugins with RhinoCommon, I’d pay for that! Maybe someday. If this particular request of mine for a simple plugin example is something you’d only be motived to demo for a bit of chump change, I can PayPal you something as long as you comment out the baby-steps. Thanks for your consideration everyone.

Hi @jarombra,

Here is something simple. Keep in mind that this has absolutely no error checking.

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
  var font_index = doc.Fonts.FindOrCreate("Times New Roman", true, false);

  var text_entity = new TextEntity
    FontIndex = font_index,
    Justification = TextJustification.None,
    Plane = Plane.WorldXY,
    Text = "Hello Rhino!",
    TextHeight = 5.0

  var curves = text_entity.Explode();

  var dir = new Vector3d(0, 0, 5);
  foreach (var curve in curves)
    var surface = Surface.CreateExtrusion(curve, dir);


  return Result.Success;

You can find a whole lot of command samples in our Developer repo on GitHub.


– Dale

1 Like

the beauty of C# .net is you can chunk together most any code snippet from anywhere to get going. this super simple example uses code from

to convert decimal number to roman, we use it for making “date” rings. this simple version we dont use, I added code to the example to accept a fingersize, roll the text out on a line, extrude, flow it around the fingersize and creat the completed ring

good luck, its a fun journey.



using Rhino;
using Rhino.Commands;
using Rhino.Input;
using Rhino.Input.Custom;

namespace Romanify

    public class RomanifyCommand : Command

        private string[] ThouLetters = { "", "M", "MM", "MMM" };
        private string[] HundLetters =
            { "", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM" };
        private string[] TensLetters =
            { "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC" };
        private string[] OnesLetters =
            { "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX" };

        // Convert Roman numerals to an integer.
        private string ArabicToRoman(int arabic)
            // See if it's >= 4000.
            if (arabic >= 4000)
                // Use parentheses.
                int thou = arabic / 1000;
                arabic %= 1000;
                return "(" + ArabicToRoman(thou) + ")" +

            // Otherwise process the letters.
            string result = "";

            // Pull out thousands.
            int num;
            num = arabic / 1000;
            result += ThouLetters[num];
            arabic %= 1000;

            // Handle hundreds.
            num = arabic / 100;
            result += HundLetters[num];
            arabic %= 100;

            // Handle tens.
            num = arabic / 10;
            result += TensLetters[num];
            arabic %= 10;

            // Handle ones.
            result += OnesLetters[arabic];

            return result;
        public RomanifyCommand()
        {Instance = this;}
        public static RomanifyCommand Instance
        {get; private set;}
        public override string EnglishName
        {get { return "NumberToRoman"; }}
        protected override Result RunCommand(RhinoDoc doc, RunMode mode)
            GetInteger getUserInteger = new GetInteger();
            getUserInteger.SetCommandPrompt("Enter a valid Integer only (no decimal points):");
            GetResult get_rn = getUserInteger.Get();
            RhinoApp.WriteLine("The Roman Numeral version of " + getUserInteger.Number() + " is " + ArabicToRoman(getUserInteger.Number()));
            return Result.Success;

1 Like

Works great Dale, thank you – I’m going to pick this apart and get up to speed. Thanks a ton!

This is fantastic, and I vaguely recall a CS housemate of mine coding something very similar – is this a kind of FizzBuzz rite of passage program? Either way, thank you for providing this fantastic example with comments! I’ll muck around now and give it some geometry output as well if I can. Thanks @ChristopherBotha

1 Like

Lots to be learned from the blog in my first link by the way, including some really nice math models and complex geometry forms hiding away in there.

Its good form to credit the original author if you use his code (as per my link credit). he is a nice guy and has taken time to answer some emails from me about converting some of his more complex stuff.

1 Like

I cant wait to dig in – thanks @ChristopherBotha, this will be an invaluable resource.