Using Linq in C# scripting component

Hi,

In the latest Rhino 8 WIP, the C# scripting component doesn’t seem like recognizing the ‘using’ statement complaining about the missing reference.

Hi @woojsung,

The attached seems to work.

test_linq.gh (4.7 KB)

– Dale

Hi @dale

Maybe it is my installation - I am getting the same error message.

fresh installation might help do you think?

Hi @woojsung,

I just noticed your running on a Mac. Does this work in V7? Can you run the SystemInfo command and post the results?

— Dale

Oh. Right I am on a Mac, it works fine on v7

2022년 4월 28일 (목) 오전 11:05, Dale Fugier via McNeel Forum <mcneel@discoursemail.com>님이 작성:

In the Rhino WIP, please run the SystemInfo command and post the results.

— Dale

@dale

Here you are. Thank you.
If you can take a look at the new C# scripting component’s copy and paste issue (doesn’t work) that would be great!

Rhino 8 SR0 2022-4-26 (Rhino WIP, 8.0.22116.12306, Git hash:master @ 03d671c58e622c1af59c363b7c31025cf8e0f70b)
License type: Commercial, build 2022-04-26
License details: Cloud Zoo
Expires on: 2022-06-10

Apple macOS Version 12.3.1 (Build 21E258) (Physical RAM: 32Gb)
Mac Model Identifier: MacBookPro16,4
Language: en-KR (MacOS default)

AMD Radeon Pro 5600M OpenGL Engine (OpenGL ver:4.1 ATI-4.8.15)

OpenGL Settings
Safe mode: Off
Use accelerated hardware modes: On
Redraw scene when viewports are exposed: On

Anti-alias mode: 4x
Mip Map Filtering: Linear
Anisotropic Filtering Mode: High

Vendor Name: ATI Technologies Inc.
Render version: 4.1
Shading Language: 4.10
Maximum Texture size: 16384 x 16384
Z-Buffer depth: n/a
Maximum Viewport size: 16384 x 16384
Total Video Memory: 8176 MB
Graphics: AMD Radeon Pro 5600M
Displays: Color LCD (264dpi 2x), U3277WB (219dpi 2x)

Graphics processors
Intel UHD Graphics 630 (1536 MB)
AMD Radeon Pro 5600M (8 GB)
Color LCD (1792 x 1120 @ 59.00Hz)
U3277WB (3008 x 1692 @ 60.00Hz)

USB devices
VLI Inc.: USB 2.0 BILLBOARD
Apple: composite_device
Apple Inc.: Touch Bar Backlight
Apple Inc.: Touch Bar Display
Apple Inc.: Apple Internal Keyboard / Trackpad
Apple: Headset
Apple Inc.: Ambient Light Sensor
Apple Inc.: FaceTime HD Camera (Built-in)
Apple Inc.: Apple T2 Controller

Bluetooth devices
None

Third party kernel extensions
com.intel.driver.EnergyDriver (3.7.0) 35E739F9-BF6C-3024-A67C-750711B3FB64
com.CalDigit.ThunderboltStationChargingSupport (1.2) 93581301-3B34-39B8-803B-E2F733B2D0D1

Third party plugins
/usr/lib/swift/libswiftCloudKit.dylib
/usr/lib/swift/libswiftCore.dylib
/usr/lib/swift/libswiftCoreData.dylib
/usr/lib/swift/libswiftCoreFoundation.dylib
/usr/lib/swift/libswiftCoreGraphics.dylib
/usr/lib/swift/libswiftCoreLocation.dylib
/usr/lib/swift/libswiftDarwin.dylib
/usr/lib/swift/libswiftDispatch.dylib
/usr/lib/swift/libswiftFoundation.dylib
/usr/lib/swift/libswiftIOKit.dylib
/usr/lib/swift/libswiftObjectiveC.dylib
/usr/lib/swift/libswiftXPC.dylib
/usr/lib/swift/libswiftos.dylib
/usr/lib/swift/libswift_Concurrency.dylib
/usr/lib/swift/libswiftAppKit.dylib
/usr/lib/swift/libswiftCoreImage.dylib
/usr/lib/swift/libswiftMetal.dylib
/usr/lib/swift/libswiftQuartzCore.dylib
/usr/lib/swift/libswiftCryptoTokenKit.dylib
/usr/lib/swift/libswiftAccelerate.dylib
/usr/lib/swift/libswiftContacts.dylib
/usr/lib/swift/libswiftCoreAudio.dylib
/usr/lib/swift/libswiftCoreML.dylib
/usr/lib/swift/libswiftCoreMedia.dylib
/usr/lib/swift/libswiftOSLog.dylib
/usr/lib/swift/libswiftVision.dylib
/usr/lib/swift/libswiftsimd.dylib
/usr/lib/swift/libswiftNetwork.dylib
/usr/lib/swift/libswiftDemangle.dylib
/usr/lib/swift/libswiftFileProvider.dylib
/usr/lib/swift/libswiftIntents.dylib
/usr/lib/swift/libswiftPrivate_BiomePubSub.dylib
/usr/lib/swift/libswiftPrivate_BiomeStreams.dylib
/usr/lib/swift/libswiftUniformTypeIdentifiers.dylib
/usr/lib/swift/libswiftAVFoundation.dylib
/usr/lib/swift/libswiftCoreMIDI.dylib
/usr/lib/log/liblog_network.dylib

Rhino plugins that do not ship with Rhino
/Users/woojsung/Library/Application Support/McNeel/Rhinoceros/MacPlugIns/Twinmotion Direct Link 2020.2.rhp “Twinmotion Direct Link 2020” 1.0.6.0

Rhino plugins that ship with Rhino
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/RhinoCycles.rhp “RhinoCycles” 8.0.22116.12306
/Applications/RhinoWIP.app/Contents/PlugIns/NamedSnapshots.rhp “Snapshots” 8.0.22116.1002
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/RhinoRoslyn.rhp “RhinoRoslyn” 8.0.22116.12306
/Applications/RhinoWIP.app/Contents/PlugIns/Constraints.rhp “Constraints” 8.0.22116.1002
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/ConstraintsUI.rhp “Constraints UI” 8.0.22116.12306
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/GrasshopperPlugin.rhp “Grasshopper” 8.0.22116.12306
/Applications/RhinoWIP.app/Contents/PlugIns/PanelingTools.rhp “PanelingTools” 8.0.22116.1002
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/Commands.rhp “Commands” 8.0.22116.12306
/Applications/RhinoWIP.app/Contents/Frameworks/RhMaterialEditor.framework “Renderer Development Kit” 8.0.22116.1002
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/RhinoCPython.rhp “RhinoCPython” 8.0.22116.12306
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/RDK_EtoUI.rhp “RDK_EtoUI” 8.0.22116.12306
/Applications/RhinoWIP.app/Contents/PlugIns/Displacement.rhp “Displacement” 8.0.22116.1002
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/RhinoRenderCycles.rhp “Rhino Render” 8.0.22116.12306
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/RhinoDLR_Python.rhp “IronPython” 8.0.22116.12306
/Applications/RhinoWIP.app/Contents/Frameworks/RhCore.framework/Resources/ManagedPlugIns/RhinoCodePlugin.rhp “RhinoCodePlugin” 8.0.22116.12306

Hi @woojsung,

I can repeat this - I’ve logged the issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-68472

Thanks,

– Dale

RH-68472 is fixed in the latest WIP

Thanks for the reply. However, Linq still doesn’t work. Please see attached.

I am on Version 8 WIP (8.0.22130.14236, 2022-05-10) updated just now.

Also, line number reporting doesn’t work reporting incorrect numbers, and most importantly copy and paste in the editor doesn’t work. Any chance to use dark mode in the editor?

Thanks,

That is not a problem with LINQ. You need to add using System.Collections.Generic so you can use List<>.

It is already there.

Yes, sorry, I just realized it myself. After a bit of testing it looks like the SQL-like syntax works just fine:

@curtisw any idea why the extension methods from LINQ don’t work? They don’t even autocomplete when typing code. Maybe missing an assembly reference for collections to have these work?

No worries. I think the issue is with ToList(). Please see attached. Thanks,

Also as it is really important to me, could you please take a look at the other issues with the new code editor?

Quite possible. But it should still work (: In this particular case you indeed don’t need it, sorting works without the ToList() just fine.

That’s right. But sometimes I need to use the method in Linq, which is problematic with many existing codes.

Could someone please take a look at this?

Also, again, the other issues with the new code editor should receive more love.

I believe that @Alain and @curtisw are the best people to look at this.

Hi,

Yes, that’s the problem. Thanks

@woojsung
All these other issues are being worked on and will be fixed soon.
Thanks for the feedback.

1 Like