V8 Plugin Visual Studio Issues

@stevebaer

Steve, not sure what’s happening here but I’ve got an odd thing happening in VS with code that “should” work:

I’m not sure why, but VS is flagging rhino common as needing an update under net7.0:

Yet as far as I can tell 8.0.23304.9001 IS the most recent (nov 1 from the looks of things).

When I right click it I get this:

image,

But it doesn’t actually update.

The reason for the question is that code that previously worked not longer does:

// List of Object Types to filter
            List<ObjectType> enumList = new List<ObjectType> {
                ObjectType.Point,
                ObjectType.Curve,
                ObjectType.Extrusion,
                ObjectType.Surface,
                ObjectType.Brep,
                ObjectType.Mesh,
                ObjectType.InstanceReference,
                ObjectType.Light,
                ObjectType.ClipPlane,
                ObjectType.Hatch,
                ObjectType.Annotation,
                ObjectType.ClipPlane,
            };

            string[] enumNames = Enum.GetNames(typeof(ObjectType));
            var enumValues = Enum.GetValues(typeof(ObjectType)).OfType<ObjectType>().ToList();
            List<OptionToggle> options = new List<OptionToggle>();
            List<ObjectType> types = new List<ObjectType>();

            for (int i = 0; i < enumList.Count; i++)
            {
                var value = (ObjectType)enumList[i];
                var index = enumValues.IndexOf(value);

                if (index > -1)
                {
                    var toggle = new OptionToggle(false, "Off", "On");
                    options.Add(toggle);
                    types.Add(value);
                    go.AddOptionToggle(enumNames[index], ref toggle);
                }
            }

In particular it’s this:

var enumValues = Enum.GetValues(typeof(ObjectType)).OfType().ToList();

The .oftype method is getting flagged by vs as a method not known by “array”, yet this exact code USED to work (and is even in your example files, which is where I swiped it from to repurpose for something else).

Not sure if this is due to net7.0 or not (also have net 48 which is also flagged as needing an update to

image

As well.

And finally, where in the API can I find the equivalent of the “createUniqueBlock” command?

Wanting to do exactly what that command does but under plugin control.

And while on the subject, I’ve scoured through the examples but haven’t found many that demonstrate how to present a list in the command area for a “native” looking workflow like this:

followed by this:

What I’m looking to do is when the user selects a block, prase the key value pairs and present the key values to the user like the button options in set view does to pick which key value they want to use as the base name for the plugin driven “create unique block” followed by a picker to choose what layer they want to land the new blocks on.

The whole point of the exercise of this plugin is we use various blocks with specific values on specific layers to annotate on construction prints where various things need to be installed. By converting the generic block to it’s own named block we can then use a textfield object to count those instances to get a total for the project, which will dynamically update as those blocks are added and removed.

As far as I know its the only viable way to get counts of something that can be incorporated into a layout.

It’s these blocks (labeled patient / staff / public etc) that will be wired to a specific IDF in the building that we need counts on:

And as soon as I saw the v8 release with createUniqueBlock I saw a viable means of doing so.

Which led me to reinstalling visual studio and heading down the rabbit hole I’m currently in.

Hi @LewnWorx,

Make sure Visual Studio for Mac is up-to-date. Click Visual Studio > Check for Updates... to verify.

After updating the RhinoCommon NuGet package, just close and reopen Visual Studio.

Make sure you’re using System.Linq in your source code. If this doesn’t help, then please post the engire command code.

No. But I’ll log wish.

Look for samples that use a RhinoGet inherit class and use the AddOption method.

– Dale