13 April 2022

How to use Orchid in Python

Some would state that this was about time, and why have we been waiting so long!?

Well, to be honest, I have found it extremely problematic that The Dynamo Team at Autodesk always has hidden several classes, and still does hide several classes, by setting the wrapped objects as internal.
This has always made me a kind of angry and made me decide that I would shield my classes as well so everyone who was asking “but why?” I would reply “Make the team change and I will change!”
However, we do all know that nothing coherent to Autodesk is changing anything, they do only maintenance. And if they change something, it is surely not what users/customers want!

Now some years have passed and I wondered why should I be the same as them!? Why should I not be a larger person than that team... this is why I now have opened all my classes for transfering data to the Autodesk API. However, there are still some things to consider, and this is why I make my setter private to prevent unintended breakdowns. All my classes that return Orchid elements do now return Autodesk elements by the keyword WrappedType.

An example on a class from the dynamo team
namespace Revit.Elements
{
    public class Parameter
    {
        internal Autodesk.Revit.DB.Parameter InternalParameter
        {
            get;
            set;
        }


An example on a class from the Orchid package
namespace Orchid.RevitProject.Common
{
    public class Document
    {
        public Autodesk.Revit.DB.Document WrappedType { get; private set; }


An example on how to use the Orchid package combined with Python.