Rhino Wip missing lots of Assemblies - System.Drawing, Threading etc

I try to open some simple C# components that work on windows and also on mac v7, but on the WIP version they all throw many errors about missing assemblies?

E.g. I can add System.Drawing without errors in the editor, but as soon as i use even the simplest thing like ‘Color’ in the actual code, I get errors about missing assemblies.

See Rhino WIP Feature: Get ready for .NET 6!

Basically .NET 6 doesn’t have all the API the older .NET framework came with. To be future proof you should move drawing code to Eto.Forms and stop using other non-supported API.

I see - but this is not about drawing interfaces.
I cant even add a color to a pointcloud at this point.
Stackoverflow says to use System.Drawing.Common instead, but this is not linked, rendering a big chunk of the rhino api not useable right now.

System.Drawing still should work though. I just tested with

# EditPythonScript
import scriptcontext as sc
import Rhino.Geometry as rg
import System.Drawing as sd

pc = rg.PointCloud()

for i in range(10):
    for j in range(10):
        pc.Add(rg.Point3d(i,j,0), sd.Color.FromName("Orange"))

sc.doc.Objects.AddPointCloud(pc)
sc.doc.Views.Redraw()

and with

# RhinoCode
#! python3

import Rhino as r
import Rhino.Geometry as rg
import System.Drawing as sd

pc = rg.PointCloud()

for i in range(10):
    for j in range(10):
        pc.Add(rg.Point3d(i, j, 0), sd.Color.FromName("Orange"))


ad = r.RhinoDoc.ActiveDoc
ad.Objects.AddPointCloud(pc)
ad.Views.Redraw()

Both work just fine

Sorry - didnt specify: c#

Can you post a small sample so we can try to repeat? The goal has been to keep things working abd this includes dealing with System.Drawing classes

Hey @atair, thanks for reporting the issue. A similar issue was reported here and I filed it as RH-70150. A fix is going through that I believe will resolve this for the next WIP build.

It would certainly help if you could post a sample GH file or steps to reproduce so I can verify the fix for your scenario.

Hi - attached a screenshot - its literally two lines of code:

it works fine in Windows V7 and WIP (and V7 mac)
Also all bitmap related functions are gone… guess the whole drawing namespace

@atair great, thanks for the sample. Yes, I think this will be resolved with the next WIP release. You can give our daily build a try with this link Rhino WIP 8.0.22280.04306.

2 Likes

Works now! thanks alot.
Maybe Copy/Paste functionality could come next?

@nathanletwory isn’t System.Drawing.Common only supported on Windows ?
Breaking change: System.Drawing.Common only supported on Windows - .NET | Microsoft Learn and How do you use System.Drawing in .NET Core? - Scott Hanselman’s Blog Is Rhino only using the Colors from System.Drawing?

Rhino implements its own System.Drawing