From 664bdfc741281c82d4d73b5cfa6cfbe76c374316 Mon Sep 17 00:00:00 2001 From: travisserio Date: Mon, 19 Aug 2024 13:24:38 -0400 Subject: [PATCH 01/14] Adds SampleCsExportSvgWithDialog example for exporting an svg using the print dialog. --- .../SampleCsCommands/SampleCsCommands.csproj | 2 + .../SampleCsExportSvgWithDialog.cs | 59 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 rhinocommon/cs/SampleCsCommands/SampleCsExportSvgWithDialog.cs diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsCommands.csproj b/rhinocommon/cs/SampleCsCommands/SampleCsCommands.csproj index 5f2f1040..df69e394 100644 --- a/rhinocommon/cs/SampleCsCommands/SampleCsCommands.csproj +++ b/rhinocommon/cs/SampleCsCommands/SampleCsCommands.csproj @@ -55,6 +55,7 @@ + C:\Program Files\Rhino 7\Plug-ins\Xfinium.Pdf.Win.dll @@ -83,6 +84,7 @@ + diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsExportSvgWithDialog.cs b/rhinocommon/cs/SampleCsCommands/SampleCsExportSvgWithDialog.cs new file mode 100644 index 00000000..1ad084e8 --- /dev/null +++ b/rhinocommon/cs/SampleCsCommands/SampleCsExportSvgWithDialog.cs @@ -0,0 +1,59 @@ +using System; +using Eto.Forms; +using Rhino; +using Rhino.Commands; +using Rhino.UI.Forms; +using Rhino.UI; +using Command = Rhino.Commands.Command; + +namespace SampleCsCommands +{ + /// + /// Exports the contents of the 3dm file to an svg via the print dialog. + /// The print dialog is automatically configured for SVG exporting. + /// + public class SampleCsExportSvgWithDialog : Command + { + public override string EnglishName => "SampleCsExportSvgWithDialog"; + + protected override Result RunCommand(RhinoDoc doc, RunMode mode) + { + + //Create an ETO file save dialog + var save_dialog = new Eto.Forms.SaveFileDialog() + { + CheckFileExists = false, + Title = "Export SVG" + }; + + //Add an SVG filter to the save dialog + save_dialog.Filters.Add(new FileFilter("Export", "*.svg")); + save_dialog.CurrentFilter = save_dialog.Filters[0]; + + //Show the file save dialog + var result = save_dialog.ShowDialog(RhinoEtoApp.MainWindow); + if (result != DialogResult.Ok) + return Result.Cancel; + + //The previous Print dialog settings are stored in the Commands.rhp plug-in. We can get its previous settings directly from the plug-in. + Guid.TryParse("02bf604d-799c-4cc2-830e-8d72f21b14b7", out var commands_id); + + //Show the Print Dialog configured for SVG export. + var svg_export_view_capture_settings = PrintDialogUi.EtoExportSvg(doc.RuntimeSerialNumber, PersistentSettings.FromPlugInId(commands_id)); + + if (svg_export_view_capture_settings == null) + return Result.Cancel; + + //Get the SVG Xml settings from the ViewCapture. + var capture_to_svg = Rhino.Display.ViewCapture.CaptureToSvg(svg_export_view_capture_settings); + if (capture_to_svg == null) + return Result.Cancel; + + //Save the xml to disk + capture_to_svg.Save(save_dialog.FileName); + + + return Result.Success; + } + } +} From b70ec3f932a9f527b0314d38e2082efa4b1e1cba Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Thu, 22 Aug 2024 10:01:11 -0700 Subject: [PATCH 02/14] Modified SampleCsEventWatcher project for .NET7 --- .../Properties/AssemblyInfo.cs | 48 ---------- .../Properties/launchSettings.json | 14 +++ rhinocommon/cs/SampleCsEventWatcher/README.md | 6 +- .../SampleCsEventWatcher.csproj | 89 +++++-------------- .../SampleCsEventWatcherCommand.cs | 1 - rhinocommon/cs/SamplesCs.sln | 4 +- 6 files changed, 40 insertions(+), 122 deletions(-) delete mode 100644 rhinocommon/cs/SampleCsEventWatcher/Properties/AssemblyInfo.cs create mode 100644 rhinocommon/cs/SampleCsEventWatcher/Properties/launchSettings.json diff --git a/rhinocommon/cs/SampleCsEventWatcher/Properties/AssemblyInfo.cs b/rhinocommon/cs/SampleCsEventWatcher/Properties/AssemblyInfo.cs deleted file mode 100644 index 301f1c48..00000000 --- a/rhinocommon/cs/SampleCsEventWatcher/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using Rhino.PlugIns; - -// Plug-in Description Attributes - all of these are optional -// These will show in Rhino's option dialog, in the tab Plug-ins -[assembly: PlugInDescription(DescriptionType.Address, "3670 Woodland Park Avenue North\r\nSeattle, WA 98103")] -[assembly: PlugInDescription(DescriptionType.Country, "United States")] -[assembly: PlugInDescription(DescriptionType.Email, "devsupport@mcneel.com")] -[assembly: PlugInDescription(DescriptionType.Phone, "206-545-6877")] -[assembly: PlugInDescription(DescriptionType.Fax, "206-545-7321")] -[assembly: PlugInDescription(DescriptionType.Organization, "Robert McNeel & Associates")] -[assembly: PlugInDescription(DescriptionType.UpdateUrl, "https://github.com/mcneel/rhino-developer-samples")] -[assembly: PlugInDescription(DescriptionType.WebSite, "http://www.rhino3d.com/")] -[assembly: PlugInDescription(DescriptionType.Icon, "SampleCsEventWatcher.Resources.SampleCs.ico")] - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SampleCsEventWatcher")] // Plug-In title is extracted from this -[assembly: AssemblyDescription("RhinoCommon Sample - SampleCsEventWatcher")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Robert McNeel & Associates")] -[assembly: AssemblyProduct("SampleCsEventWatcher")] -[assembly: AssemblyCopyright("Copyright © 2017, Robert McNeel & Associates")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("71fbf81e-a132-41bf-af86-998285170f99")] // This will also be the Guid of the Rhino plug-in - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("6.0.0.0")] -[assembly: AssemblyFileVersion("6.0.0.0")] diff --git a/rhinocommon/cs/SampleCsEventWatcher/Properties/launchSettings.json b/rhinocommon/cs/SampleCsEventWatcher/Properties/launchSettings.json new file mode 100644 index 00000000..8c3121d1 --- /dev/null +++ b/rhinocommon/cs/SampleCsEventWatcher/Properties/launchSettings.json @@ -0,0 +1,14 @@ +{ + "profiles": { + "Rhino 8 (net7.0)": { + "commandName": "Executable", + "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe", + "commandLineArgs": "/netcore" + }, + "Rhino 8 (net48)": { + "commandName": "Executable", + "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe", + "commandLineArgs": "/netfx" + } + } +} \ No newline at end of file diff --git a/rhinocommon/cs/SampleCsEventWatcher/README.md b/rhinocommon/cs/SampleCsEventWatcher/README.md index c7d16e88..3229b6c4 100644 --- a/rhinocommon/cs/SampleCsEventWatcher/README.md +++ b/rhinocommon/cs/SampleCsEventWatcher/README.md @@ -7,12 +7,12 @@ Building Sample -------------------- To build the sample, you are going to need: -* Rhinoceros 6 (http://www.rhino3d.com) -* Microsoft Visual C# 2017 +* Rhinoceros 8 (http://www.rhino3d.com) +* Microsoft Visual C# 2022 Legal Stuff ----------- -Copyright © 2017, Robert McNeel & Associates. All Rights Reserved. +Copyright © 2017-2024, Robert McNeel & Associates. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/rhinocommon/cs/SampleCsEventWatcher/SampleCsEventWatcher.csproj b/rhinocommon/cs/SampleCsEventWatcher/SampleCsEventWatcher.csproj index e2f17a23..1afc3938 100644 --- a/rhinocommon/cs/SampleCsEventWatcher/SampleCsEventWatcher.csproj +++ b/rhinocommon/cs/SampleCsEventWatcher/SampleCsEventWatcher.csproj @@ -1,78 +1,31 @@ - - + - Debug32 - AnyCPU - 8.0.30703 - 2.0 - {C46E6928-A0E4-46D7-9382-350AF2BD1AB2} + net7.0;net48 + .rhp + ..\Bin\ Library - Properties - SampleCsEventWatcher - SampleCsEventWatcher - v4.8 - 512 - false - + Robert McNeel & Associates + Copyright © 2013-2024, Robert McNeel & Associates + SampleCsEventWatcher + Sample Event Watcher Plug-in + 8.0.0 - - true - full - false - ..\bin\ - DEBUG;TRACE - prompt - false + + 1701;1702;NU1701 - - pdbonly - true - ..\bin\ - TRACE - prompt - 4 - false + + 1701;1702;NU1701 + + + 1701;1702;NU1701 + + + 1701;1702;NU1701 - - C:\Program Files\Rhino 7\System\RhinoCommon.dll - False - - - - - - - - - - - - + - + - - - - Copy "$(TargetPath)" "$(TargetDir)$(ProjectName).rhp" -Erase "$(TargetPath)" - - - en-US - - - C:\Program Files\Rhino 7\System\Rhino.exe - - - Program - false - \ No newline at end of file diff --git a/rhinocommon/cs/SampleCsEventWatcher/SampleCsEventWatcherCommand.cs b/rhinocommon/cs/SampleCsEventWatcher/SampleCsEventWatcherCommand.cs index 5461b564..9c164a93 100644 --- a/rhinocommon/cs/SampleCsEventWatcher/SampleCsEventWatcherCommand.cs +++ b/rhinocommon/cs/SampleCsEventWatcher/SampleCsEventWatcherCommand.cs @@ -8,7 +8,6 @@ namespace SampleCsEventWatcher /// /// SampleCsEventWatcher command /// - [System.Runtime.InteropServices.Guid("61055a13-cd6d-4c5d-8978-0ee9a0560837")] public class SampleCsEventWatcherCommand : Command { /// diff --git a/rhinocommon/cs/SamplesCs.sln b/rhinocommon/cs/SamplesCs.sln index bd0a4227..a3689293 100644 --- a/rhinocommon/cs/SamplesCs.sln +++ b/rhinocommon/cs/SamplesCs.sln @@ -1,11 +1,11 @@ - + Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34408.163 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsCommands", "SampleCsCommands\SampleCsCommands.csproj", "{C1498326-89AB-48B0-A148-290C169CAA68}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsEventWatcher", "SampleCsEventWatcher\SampleCsEventWatcher.csproj", "{C46E6928-A0E4-46D7-9382-350AF2BD1AB2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleCsEventWatcher", "SampleCsEventWatcher\SampleCsEventWatcher.csproj", "{C46E6928-A0E4-46D7-9382-350AF2BD1AB2}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsWinForms", "SampleCsWinForms\SampleCsWinForms.csproj", "{AF28BFFB-93EC-4B7F-B61B-21E08AD1EB4C}" EndProject From 994269a84ce8ee12c83dc6b5539000133f729d18 Mon Sep 17 00:00:00 2001 From: Curtis Wensley Date: Wed, 28 Aug 2024 10:18:48 -0700 Subject: [PATCH 03/14] Update SampleCsEto for .NET 7 support --- .../cs/SampleCsEto/Properties/AssemblyInfo.cs | 24 ---- .../Properties/launchSettings.json | 20 +++ rhinocommon/cs/SampleCsEto/SampleCsEto.csproj | 120 +++--------------- 3 files changed, 41 insertions(+), 123 deletions(-) mode change 100644 => 100755 rhinocommon/cs/SampleCsEto/Properties/AssemblyInfo.cs create mode 100755 rhinocommon/cs/SampleCsEto/Properties/launchSettings.json mode change 100644 => 100755 rhinocommon/cs/SampleCsEto/SampleCsEto.csproj diff --git a/rhinocommon/cs/SampleCsEto/Properties/AssemblyInfo.cs b/rhinocommon/cs/SampleCsEto/Properties/AssemblyInfo.cs old mode 100644 new mode 100755 index b9c024fb..25963142 --- a/rhinocommon/cs/SampleCsEto/Properties/AssemblyInfo.cs +++ b/rhinocommon/cs/SampleCsEto/Properties/AssemblyInfo.cs @@ -14,17 +14,6 @@ [assembly: PlugInDescription(DescriptionType.WebSite, "http://www.rhino3d.com/")] [assembly: PlugInDescription(DescriptionType.Icon, "SampleCsEto.Resources.SampleCs.ico")] -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SampleCsEto")] // Plug-In title is extracted from this -[assembly: AssemblyDescription("RhinoCommon Sample - SampleCsEto")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Robert McNeel & Associates")] -[assembly: AssemblyProduct("SampleCsEto")] -[assembly: AssemblyCopyright("Copyright © 2017, Robert McNeel & Associates")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -33,16 +22,3 @@ // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("152aa1ba-306b-402b-98ee-1cf04409ff7f")] // This will also be the Guid of the Rhino plug-in - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("6.0.0.0")] -[assembly: AssemblyFileVersion("6.0.0.0")] diff --git a/rhinocommon/cs/SampleCsEto/Properties/launchSettings.json b/rhinocommon/cs/SampleCsEto/Properties/launchSettings.json new file mode 100755 index 00000000..4960d37b --- /dev/null +++ b/rhinocommon/cs/SampleCsEto/Properties/launchSettings.json @@ -0,0 +1,20 @@ +{ + "profiles": { + "Rhino 8 netcore": { + "commandName": "Executable", + "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe", + "commandLineArgs": "/netcore", + "environmentVariables": { + "RHINO_PACKAGE_DIRS": "$(ProjectDir)$(OutputPath)\\" + } + }, + "Rhino 8 netfx": { + "commandName": "Executable", + "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe", + "commandLineArgs": "/netfx", + "environmentVariables": { + "RHINO_PACKAGE_DIRS": "$(ProjectDir)$(OutputPath)\\" + } + } + } +} \ No newline at end of file diff --git a/rhinocommon/cs/SampleCsEto/SampleCsEto.csproj b/rhinocommon/cs/SampleCsEto/SampleCsEto.csproj old mode 100644 new mode 100755 index e5f8933b..4a091f1e --- a/rhinocommon/cs/SampleCsEto/SampleCsEto.csproj +++ b/rhinocommon/cs/SampleCsEto/SampleCsEto.csproj @@ -1,114 +1,36 @@ - - + + - Debug64 - AnyCPU - 8.0.30703 - 2.0 - {CD962975-5E0A-4BB7-AF01-ABD4A9E18AAC} - Library - Properties - SampleCsEto - SampleCsEto - v4.8 - 512 - false - - - - true - full - false - ..\bin\ - DEBUG;TRACE - prompt - false - - - pdbonly - true - ..\bin\ - TRACE - prompt - 4 - false + net7.0;net48 + true + 8.0 + SampleCsEto + RhinoCommon Sample - SampleCsEto + Robert McNeel & Associates + Copyright © 2024, Robert McNeel & Associates + .rhp + NU1701 + - - C:\Program Files\Rhino 7\System\Eto.dll - False - - - C:\Program Files\Rhino 7\System\Rhino.UI.dll - False - - - C:\Program Files\Rhino 7\System\RhinoCommon.dll - False - - - - - + + + + - - - - - - - - - - - True + True + True Resources.resx - - - - - - - - - + - + ResXFileCodeGenerator Resources.Designer.cs - - - - - - - - - - - Copy "$(TargetPath)" "$(TargetDir)$(ProjectName).rhp" -Erase "$(TargetPath)" - - - en-US - - - c:\Program Files\Rhinoceros 5 (64-bit)\System\Rhino.exe - - - Program - false - + \ No newline at end of file From 4a3f456684808310c58ed61c93fb5ccae85ac71e Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Tue, 3 Sep 2024 10:37:46 -0700 Subject: [PATCH 04/14] Added SubD drawing samples --- cpp/SampleCommands/SampleCommands.vcxproj | 3 +- .../SampleCommands.vcxproj.filters | 5 +- cpp/SampleCommands/cmdSampleDrawSubD.cpp | 116 +++++++++++++++++ cpp/SampleCommands/cmdSampleDrawSubDWires.cpp | 120 ++++++++++++++++++ 4 files changed, 242 insertions(+), 2 deletions(-) create mode 100644 cpp/SampleCommands/cmdSampleDrawSubD.cpp create mode 100644 cpp/SampleCommands/cmdSampleDrawSubDWires.cpp diff --git a/cpp/SampleCommands/SampleCommands.vcxproj b/cpp/SampleCommands/SampleCommands.vcxproj index af70d4d9..131e85ef 100644 --- a/cpp/SampleCommands/SampleCommands.vcxproj +++ b/cpp/SampleCommands/SampleCommands.vcxproj @@ -17,8 +17,9 @@ - + + diff --git a/cpp/SampleCommands/SampleCommands.vcxproj.filters b/cpp/SampleCommands/SampleCommands.vcxproj.filters index ce136dae..e1198519 100644 --- a/cpp/SampleCommands/SampleCommands.vcxproj.filters +++ b/cpp/SampleCommands/SampleCommands.vcxproj.filters @@ -852,7 +852,10 @@ Source Files - + + Source Files + + Source Files diff --git a/cpp/SampleCommands/cmdSampleDrawSubD.cpp b/cpp/SampleCommands/cmdSampleDrawSubD.cpp new file mode 100644 index 00000000..ef93f5c2 --- /dev/null +++ b/cpp/SampleCommands/cmdSampleDrawSubD.cpp @@ -0,0 +1,116 @@ +#include "stdafx.h" + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// BEGIN SampleDrawSubD command +// + +class CSampleDrawSubDConduit : public CRhinoDisplayConduit +{ +public: + CSampleDrawSubDConduit(const ON_SubD& subd, ON_Color color); + bool ExecConduit(CRhinoDisplayPipeline& dp, UINT nActiveChannel, bool& bTerminateChannel) override; + +private: + const ON_SubD& m_subd; + ON_Color m_color; +}; + +CSampleDrawSubDConduit::CSampleDrawSubDConduit(const ON_SubD& subd, ON_Color color) + : CRhinoDisplayConduit(CSupportChannels::SC_CALCBOUNDINGBOX | CSupportChannels::SC_PREDRAWOBJECTS) + , m_subd(subd) + , m_color(color) +{ +} + +bool CSampleDrawSubDConduit::ExecConduit(CRhinoDisplayPipeline& dp, UINT nActiveChannel, bool& bTerminateChannel) +{ + if (nActiveChannel == CSupportChannels::SC_CALCBOUNDINGBOX) + { + ON_BoundingBox bbox; + if (m_subd.GetTightBoundingBox(bbox, false)) + m_pChannelAttrs->m_BoundingBox.Union(bbox); + } + else if (nActiveChannel == CSupportChannels::SC_PREDRAWOBJECTS) + { + CDisplayPipelineAttributes* pDA = const_cast(dp.DisplayAttrs()); + if (nullptr != pDA) + { + CRhinoSubDDisplay subd_display = CRhinoSubDDisplay::Create(m_subd); + CRhinoSubDDisplayAttributes subd_display_attrs; + subd_display_attrs.m_bDrawControlNet = false; + subd_display_attrs.m_bDrawSurfaceNet = false; + subd_display_attrs.m_bDrawEdges = false; + subd_display_attrs.m_bDrawSurface = true; + + ON_Material mat; + mat.m_diffuse = m_color; + CDisplayPipelineMaterial material(mat); + + CDisplayPipelineMaterial* pOldMaterial = pDA->m_pMaterial; + pDA->m_pMaterial = &material; + + dp.DrawSubD(subd_display, subd_display_attrs); + + pDA->m_pMaterial = pOldMaterial; + } + } + + return true; +} + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// + +#pragma region SampleDrawSubD command + +class CCommandSampleDrawSubD : public CRhinoCommand +{ +public: + CCommandSampleDrawSubD() = default; + UUID CommandUUID() override + { + // {EA9A6A06-2CAA-4971-9E89-6DD97177CE2F} + static const GUID SampleDrawSubDCommand_UUID = + { 0xEA9A6A06, 0x2CAA, 0x4971, { 0x9E, 0x89, 0x6D, 0xD9, 0x71, 0x77, 0xCE, 0x2F } }; + return SampleDrawSubDCommand_UUID; + } + const wchar_t* EnglishCommandName() override { return L"SampleDrawSubD"; } + CRhinoCommand::result RunCommand(const CRhinoCommandContext& context) override; +}; + +// The one and only CCommandSampleDrawSubD object +static class CCommandSampleDrawSubD theSampleDrawSubDCommand; + +CRhinoCommand::result CCommandSampleDrawSubD::RunCommand(const CRhinoCommandContext& context) +{ + ON_Sphere sphere(ON_3dPoint::Origin, 4.0); + + ON_SubD subd_sphere; + ON_SubDComponentLocation subd_location = ON_SubDComponentLocation::Surface; + if (nullptr == ON_SubD::CreateSubDQuadSphere(sphere, subd_location, 2, &subd_sphere)) + return CRhinoCommand::failure; + + CSampleDrawSubDConduit conduit(subd_sphere, ON_Color::SaturatedMagenta); + conduit.Enable(context.m_rhino_doc_sn); + context.m_doc.Regen(); + + CRhinoGetString gs; + gs.SetCommandPrompt(L"Press to continue"); + gs.AcceptNothing(); + gs.GetString(); + + conduit.Disable(); + context.m_doc.Regen(); + + return CRhinoCommand::success; +} + +#pragma endregion + +// +// END SampleDrawSubD command +// +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// diff --git a/cpp/SampleCommands/cmdSampleDrawSubDWires.cpp b/cpp/SampleCommands/cmdSampleDrawSubDWires.cpp new file mode 100644 index 00000000..20fd99e7 --- /dev/null +++ b/cpp/SampleCommands/cmdSampleDrawSubDWires.cpp @@ -0,0 +1,120 @@ +#include "stdafx.h" + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// BEGIN SampleDrawSubDWires command +// + +class CSampleDrawSubDWiresConduit : public CRhinoDisplayConduit +{ +public: + CSampleDrawSubDWiresConduit(const ON_SubD& subd, ON_Color wire_color); + bool ExecConduit(CRhinoDisplayPipeline& dp, UINT nActiveChannel, bool& bTerminateChannel) override; + +private: + const ON_SubD& m_subd; + ON_Color m_wire_color; +}; + +CSampleDrawSubDWiresConduit::CSampleDrawSubDWiresConduit(const ON_SubD& subd, ON_Color wire_color) + : CRhinoDisplayConduit(CSupportChannels::SC_CALCBOUNDINGBOX | CSupportChannels::SC_DRAWOVERLAY) + , m_subd(subd) + , m_wire_color(wire_color) +{ +} + +bool CSampleDrawSubDWiresConduit::ExecConduit(CRhinoDisplayPipeline& dp, UINT nActiveChannel, bool& bTerminateChannel) +{ + if (nActiveChannel == CSupportChannels::SC_CALCBOUNDINGBOX) + { + ON_BoundingBox bbox; + if (m_subd.GetTightBoundingBox(bbox, false)) + m_pChannelAttrs->m_BoundingBox.Union(bbox); + } + else if (nActiveChannel == CSupportChannels::SC_DRAWOVERLAY) + { + CDisplayPipelineAttributes* pDA = const_cast(dp.DisplayAttrs()); + if (nullptr != pDA) + { + CRhinoSubDDisplay subd_display = CRhinoSubDDisplay::Create(m_subd); + CRhinoSubDDisplayAttributes subd_display_attrs; + subd_display_attrs.m_bDrawControlNet = false; + subd_display_attrs.m_bDrawSurfaceNet = false; + subd_display_attrs.m_bDrawEdges = true; + subd_display_attrs.m_bDrawSurface = false; + + ON_Color oldColors[4]; + float oldThicknesses[4]; + pDA->m_ObjectColor = m_wire_color; + pDA->GetSubDWireAttributes(oldColors, oldThicknesses); + + // Set color + for (int i = 0; i < 4; i++) + pDA->SetSubDEdgeColor((CDisplayPipelineAttributes::SubDEdgeType)i, m_wire_color); + + dp.DrawSubD(subd_display, subd_display_attrs); + + // Reset color + for (int i = 0; i < 4; i++) + pDA->SetSubDEdgeColor((CDisplayPipelineAttributes::SubDEdgeType)i, oldColors[i]); + } + } + + return true; +} + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// + +#pragma region SampleDrawSubDWires command + +class CCommandSampleDrawSubDWires : public CRhinoCommand +{ +public: + CCommandSampleDrawSubDWires() = default; + UUID CommandUUID() override + { + // {8A5A2555-3656-4144-B096-BE2876CF4030} + static const GUID SampleDrawSubDWiresCommand_UUID = + { 0x8A5A2555, 0x3656, 0x4144, { 0xB0, 0x96, 0xBE, 0x28, 0x76, 0xCF, 0x40, 0x30 } }; + return SampleDrawSubDWiresCommand_UUID; + } + const wchar_t* EnglishCommandName() override { return L"SampleDrawSubDWires"; } + CRhinoCommand::result RunCommand(const CRhinoCommandContext& context) override; +}; + +// The one and only CCommandSampleDrawSubDWires object +static class CCommandSampleDrawSubDWires theSampleDrawSubDWiresCommand; + +CRhinoCommand::result CCommandSampleDrawSubDWires::RunCommand(const CRhinoCommandContext& context) +{ + ON_Sphere sphere(ON_3dPoint::Origin, 4.0); + + ON_SubD subd_sphere; + ON_SubDComponentLocation subd_location = ON_SubDComponentLocation::Surface; + if (nullptr == ON_SubD::CreateSubDQuadSphere(sphere, subd_location, 2, &subd_sphere)) + return CRhinoCommand::failure; + + CSampleDrawSubDWiresConduit conduit(subd_sphere, ON_Color::SaturatedGold); + conduit.Enable(context.m_rhino_doc_sn); + context.m_doc.Redraw(); + + CRhinoGetString gs; + gs.SetCommandPrompt(L"Press to continue"); + gs.AcceptNothing(); + gs.GetString(); + + conduit.Disable(); + context.m_doc.Redraw(); + + return CRhinoCommand::success; +} + +#pragma endregion + +// +// END SampleDrawSubDWires command +// +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// From 9ba502181ce5e003413560fe950ffaeca15778d1 Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Mon, 16 Sep 2024 10:30:42 -0700 Subject: [PATCH 05/14] Ported SampleCsUserData to Rhino 8, .NET7.0 --- .../Commands/SampleCsAddBrepFaceUserData.cs | 1 - .../Commands/SampleCsAddLayerUserData.cs | 1 - .../Commands/SampleCsAddSimpleDocumentData.cs | 1 - .../Commands/SampleCsDocumentDictionary.cs | 1 - .../Commands/SampleCsModifyUserData.cs | 1 - .../Commands/SampleCsQueryLayerUserData.cs | 1 - .../Commands/SampleCsQueryUserData.cs | 1 - .../Commands/SampleCsRemoveUserData.cs | 1 - .../Commands/SampleCsStringTable.cs | 1 - .../Properties/AssemblyInfo.cs | 48 --------- .../Properties/launchSettings.json | 14 +++ .../SampleCsUserData/SampleCsUserData.csproj | 101 ++++-------------- 12 files changed, 36 insertions(+), 136 deletions(-) delete mode 100644 rhinocommon/cs/SampleCsUserData/Properties/AssemblyInfo.cs create mode 100644 rhinocommon/cs/SampleCsUserData/Properties/launchSettings.json diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddBrepFaceUserData.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddBrepFaceUserData.cs index 27b5ef58..f7d36b46 100644 --- a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddBrepFaceUserData.cs +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddBrepFaceUserData.cs @@ -5,7 +5,6 @@ namespace SampleCsUserData.Commands { - [System.Runtime.InteropServices.Guid("38868ab0-cef1-4b61-ab53-45ef4d450027")] public class SampleCsAddBrepFaceUserData : Command { public override string EnglishName diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddLayerUserData.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddLayerUserData.cs index d2a61e8a..974e532c 100644 --- a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddLayerUserData.cs +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddLayerUserData.cs @@ -4,7 +4,6 @@ namespace SampleCsUserData.Commands { - [System.Runtime.InteropServices.Guid("d8f14956-165c-4c22-9f2d-93db2b8e108d")] public class SampleCsAddLayerUserData : Command { public override string EnglishName diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddSimpleDocumentData.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddSimpleDocumentData.cs index 6fcdc28e..e1a4a303 100644 --- a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddSimpleDocumentData.cs +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddSimpleDocumentData.cs @@ -4,7 +4,6 @@ namespace SampleCsUserData.Commands { - [System.Runtime.InteropServices.Guid("dd97883a-077d-4ea3-9848-8752ac40339b")] public class SampleCsAddSimpleDocumentData : Command { public override string EnglishName diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsDocumentDictionary.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsDocumentDictionary.cs index 426d297d..2c595156 100644 --- a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsDocumentDictionary.cs +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsDocumentDictionary.cs @@ -4,7 +4,6 @@ namespace SampleCsUserData.Commands { - [System.Runtime.InteropServices.Guid("2adff73e-30b1-4ded-80d0-6eae56d8a790")] public class SampleCsDocumentDictionary : Command { private const string INTEGER_VALUE = "INT"; diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsModifyUserData.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsModifyUserData.cs index 8eaadf29..9944c3cf 100644 --- a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsModifyUserData.cs +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsModifyUserData.cs @@ -6,7 +6,6 @@ namespace SampleCsUserData.Commands { - [System.Runtime.InteropServices.Guid("59f0cc43-3019-41ae-b65b-87e1fbadfba3")] public class SampleCsModifyUserData : Command { public override string EnglishName diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsQueryLayerUserData.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsQueryLayerUserData.cs index ede18a6d..5ad958dc 100644 --- a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsQueryLayerUserData.cs +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsQueryLayerUserData.cs @@ -3,7 +3,6 @@ namespace SampleCsUserData.Commands { - [System.Runtime.InteropServices.Guid("075db042-a92e-40f4-8ca2-5b9c9e243334")] public class SampleCsQueryLayerUserData : Command { public override string EnglishName diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsQueryUserData.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsQueryUserData.cs index 14307114..0b64def6 100644 --- a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsQueryUserData.cs +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsQueryUserData.cs @@ -5,7 +5,6 @@ namespace SampleCsUserData.Commands { - [System.Runtime.InteropServices.Guid("171d4a92-600b-485c-9629-d5648a878600")] public class SampleCsQueryUserData : Command { public override string EnglishName diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsRemoveUserData.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsRemoveUserData.cs index b6206fe0..ec72a026 100644 --- a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsRemoveUserData.cs +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsRemoveUserData.cs @@ -5,7 +5,6 @@ namespace SampleCsUserData.Commands { - [System.Runtime.InteropServices.Guid("60fcd171-d0a4-4184-b2a4-22dc2e9c1ebe")] public class SampleCsRemoveUserData : Command { public override string EnglishName diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsStringTable.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsStringTable.cs index 48ba5b1a..8e6fcede 100644 --- a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsStringTable.cs +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsStringTable.cs @@ -5,7 +5,6 @@ namespace SampleCsUserData.Commands { - [System.Runtime.InteropServices.Guid("e4653aad-b0e8-4b4b-b94a-7dedb64dc501")] public class SampleCsStringTable : Command { public override string EnglishName diff --git a/rhinocommon/cs/SampleCsUserData/Properties/AssemblyInfo.cs b/rhinocommon/cs/SampleCsUserData/Properties/AssemblyInfo.cs deleted file mode 100644 index 7050dce4..00000000 --- a/rhinocommon/cs/SampleCsUserData/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; -using Rhino.PlugIns; - -// Plug-in Description Attributes - all of these are optional -// These will show in Rhino's option dialog, in the tab Plug-ins -[assembly: PlugInDescription(DescriptionType.Address, "3670 Woodland Park Avenue North\r\nSeattle, WA 98103")] -[assembly: PlugInDescription(DescriptionType.Country, "United States")] -[assembly: PlugInDescription(DescriptionType.Email, "devsupport@mcneel.com")] -[assembly: PlugInDescription(DescriptionType.Phone, "206-545-6877")] -[assembly: PlugInDescription(DescriptionType.Fax, "206-545-7321")] -[assembly: PlugInDescription(DescriptionType.Organization, "Robert McNeel & Associates")] -[assembly: PlugInDescription(DescriptionType.UpdateUrl, "https://github.com/mcneel/rhino-developer-samples")] -[assembly: PlugInDescription(DescriptionType.WebSite, "http://www.rhino3d.com/")] -[assembly: PlugInDescription(DescriptionType.Icon, "SampleCsUserData.Resources.SampleCs.ico")] - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SampleCsUserData")] // Plug-In title is extracted from this -[assembly: AssemblyDescription("RhinoCommon Sample - SampleCsUserData")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Robert McNeel & Associates")] -[assembly: AssemblyProduct("SampleCsUserData")] -[assembly: AssemblyCopyright("Copyright © 2017, Robert McNeel & Associates")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a164cc56-abd8-4a3c-a000-e8b7ab6a9bb3")] // This will also be the Guid of the Rhino plug-in - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("6.0.0.0")] -[assembly: AssemblyFileVersion("6.0.0.0")] diff --git a/rhinocommon/cs/SampleCsUserData/Properties/launchSettings.json b/rhinocommon/cs/SampleCsUserData/Properties/launchSettings.json new file mode 100644 index 00000000..1eef7cd6 --- /dev/null +++ b/rhinocommon/cs/SampleCsUserData/Properties/launchSettings.json @@ -0,0 +1,14 @@ +{ + "profiles": { + "Rhino 8 (net7.0)": { + "commandName": "Executable", + "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe", + "commandLineArgs": "/netcore" + }, + "Rhino 8 net48)": { + "commandName": "Executable", + "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe", + "commandLineArgs": "/netfx" + } + } +} \ No newline at end of file diff --git a/rhinocommon/cs/SampleCsUserData/SampleCsUserData.csproj b/rhinocommon/cs/SampleCsUserData/SampleCsUserData.csproj index 5228b204..0d6e4ed4 100644 --- a/rhinocommon/cs/SampleCsUserData/SampleCsUserData.csproj +++ b/rhinocommon/cs/SampleCsUserData/SampleCsUserData.csproj @@ -1,89 +1,32 @@ - - + - Debug32 - AnyCPU - 8.0.30703 - 2.0 - {444482E8-CB8F-4A79-87A8-9C3FCBCC7B16} + net7.0;net48 + .rhp + ..\Bin\ Library - Properties - SampleCsUserData - SampleCsUserData - v4.8 - 512 - false - + Robert McNeel & Associates + Copyright © 2013-2024, Robert McNeel & Associates + SampleCsUserData + Sample Event Watcher Plug-in + 8.0.0 - - true - full - false - ..\bin\ - DEBUG;TRACE - prompt - false + + 1701;1702;NU1701 - - pdbonly - true - ..\bin\ - TRACE - prompt - 4 - false + + 1701;1702;NU1701 + + + 1701;1702;NU1701 + + + 1701;1702;NU1701 - - C:\Program Files\Rhino 7\System\RhinoCommon.dll - False - - - - - - - - - - - - - - - - - - - - - - - + - + + - - - - Copy "$(TargetPath)" "$(TargetDir)$(ProjectName).rhp" -Erase "$(TargetPath)" - - - en-US - - - c:\Program Files\Rhinoceros 5.0 (64-bit)\System\Rhino.exe - - - Program - false - \ No newline at end of file From 97c9e7b023dc0a56ceb5ce9c2b31796f7de4d2f0 Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Mon, 16 Sep 2024 12:16:29 -0700 Subject: [PATCH 06/14] Added cmdSampleGroupUserData.cpp --- cpp/SampleCommands/SampleCommands.vcxproj | 1 + .../SampleCommands.vcxproj.filters | 3 + cpp/SampleCommands/cmdSampleGroupUserData.cpp | 308 ++++++++++++++++++ 3 files changed, 312 insertions(+) create mode 100644 cpp/SampleCommands/cmdSampleGroupUserData.cpp diff --git a/cpp/SampleCommands/SampleCommands.vcxproj b/cpp/SampleCommands/SampleCommands.vcxproj index 131e85ef..b1dd47cd 100644 --- a/cpp/SampleCommands/SampleCommands.vcxproj +++ b/cpp/SampleCommands/SampleCommands.vcxproj @@ -28,6 +28,7 @@ + diff --git a/cpp/SampleCommands/SampleCommands.vcxproj.filters b/cpp/SampleCommands/SampleCommands.vcxproj.filters index e1198519..482bbd75 100644 --- a/cpp/SampleCommands/SampleCommands.vcxproj.filters +++ b/cpp/SampleCommands/SampleCommands.vcxproj.filters @@ -858,6 +858,9 @@ Source Files + + Source Files + diff --git a/cpp/SampleCommands/cmdSampleGroupUserData.cpp b/cpp/SampleCommands/cmdSampleGroupUserData.cpp new file mode 100644 index 00000000..d5da49cc --- /dev/null +++ b/cpp/SampleCommands/cmdSampleGroupUserData.cpp @@ -0,0 +1,308 @@ +#include "stdafx.h" +#include "SampleCommandsPlugIn.h" + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// BEGIN CSampleGroupUserData +// + +class CSampleGroupUserData : public ON_UserData +{ + ON_OBJECT_DECLARE(CSampleGroupUserData); + +public: + static ON_UUID Id(); + + CSampleGroupUserData(); + ~CSampleGroupUserData() = default; + CSampleGroupUserData(const CSampleGroupUserData& src); + CSampleGroupUserData& operator=(const CSampleGroupUserData& src); + + bool GetDescription(ON_wString& description) override; + bool Archive() const override; + bool Write(ON_BinaryArchive& binary_archive) const override; + bool Read(ON_BinaryArchive& binary_archive) override; + +public: + // Helper functions + static bool HasUserData(const CRhinoGroup* group); + static bool SetUserData(CRhinoDoc& doc, const CRhinoGroup* group); + static bool GetUserData(const CRhinoGroup* group, ON_wString& string); + static bool RemoveUserData(CRhinoDoc& doc, const CRhinoGroup* pRhinoGroup); + +public: + ON_wString m_string; +}; + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// + +ON_OBJECT_IMPLEMENT(CSampleGroupUserData, ON_UserData, "820A89D9-8AA5-48F2-8DAE-1A440F3A93CB"); + +ON_UUID CSampleGroupUserData::Id() +{ + return ON_CLASS_ID(CSampleGroupUserData); +} + +CSampleGroupUserData::CSampleGroupUserData() +{ + m_userdata_uuid = CSampleGroupUserData::Id(); + m_application_uuid = SampleCommandsPlugIn().PlugInID(); + m_userdata_copycount = 1; // enable copying + m_string = L"Hello Rhino Group!"; +} + +CSampleGroupUserData::CSampleGroupUserData(const CSampleGroupUserData& src) + : ON_UserData(src) +{ + m_userdata_uuid = CSampleGroupUserData::Id(); + m_application_uuid = SampleCommandsPlugIn().PlugInID(); + m_string = src.m_string; +} + +CSampleGroupUserData& CSampleGroupUserData::operator=(const CSampleGroupUserData& src) +{ + if (this != &src) + { + ON_UserData::operator=(src); + m_string = src.m_string; + } + return *this; +} + +bool CSampleGroupUserData::GetDescription(ON_wString& description) +{ + description = L"Sample Group User Data"; + return true; +} + +bool CSampleGroupUserData::Archive() const +{ + return true; +} + +bool CSampleGroupUserData::Write(ON_BinaryArchive& binary_archive) const +{ + int minor_version = 0; + bool rc = binary_archive.BeginWrite3dmChunk(TCODE_ANONYMOUS_CHUNK, 1, minor_version); + if (!rc) + return false; + + for (;;) + { + // version 1.0 fields + rc = binary_archive.WriteString(m_string); + if (!rc) break; + + break; + } + + if (!binary_archive.EndWrite3dmChunk()) + rc = false; + + return rc; +} + +bool CSampleGroupUserData::Read(ON_BinaryArchive& binary_archive) +{ + int major_version = 0; + int minor_version = 0; + bool rc = binary_archive.BeginRead3dmChunk(TCODE_ANONYMOUS_CHUNK, &major_version, &minor_version); + if (!rc) + return false; + + for (;;) + { + rc = (1 == major_version); + if (!rc) break; + + // version 1.0 fields + rc = binary_archive.ReadString(m_string); + if (!rc) break; + + break; + } + + if (!binary_archive.EndRead3dmChunk()) + rc = false; + + return rc; +} + +bool CSampleGroupUserData::HasUserData(const CRhinoGroup* group) +{ + if (nullptr != group) + { + CSampleGroupUserData* data = CSampleGroupUserData::Cast(group->GetUserData(CSampleGroupUserData::Id())); + return (nullptr != data); + } + return false; +} + +bool CSampleGroupUserData::SetUserData(CRhinoDoc& doc, const CRhinoGroup* group) +{ + if (nullptr == group) + return false; + + if (CSampleGroupUserData::HasUserData(group)) + return true; + + ON_Group new_group(*group); + + CSampleGroupUserData* data = new CSampleGroupUserData(); + if (!new_group.AttachUserData(data)) + { + delete data; + return false; + } + + return doc.m_group_table.ModifyGroup(new_group, group->Index(), false); +} + +bool CSampleGroupUserData::GetUserData(const CRhinoGroup* group, ON_wString& string) +{ + if (nullptr != group) + { + CSampleGroupUserData* data = CSampleGroupUserData::Cast(group->GetUserData(CSampleGroupUserData::Id())); + if (nullptr != data) + { + string = data->m_string; + return true; + } + } + return false; +} + +bool CSampleGroupUserData::RemoveUserData(CRhinoDoc& doc, const CRhinoGroup* group) +{ + if (nullptr == group) + return false; + + if (!CSampleGroupUserData::HasUserData(group)) + return false; + + ON_Group new_group(*group); + + CSampleGroupUserData* data = CSampleGroupUserData::Cast(new_group.GetUserData(CSampleGroupUserData::Id())); + if (nullptr != data) + { + new_group.DetachUserData(data); + delete data; + data = nullptr; + return doc.m_group_table.ModifyGroup(new_group, group->Index(), false); + } + + return false; +} + +// +// END CSampleGroupUserData +// +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// BEGIN SampleSetGroupUserData command +// + +#pragma region SampleSetGroupUserData command + +class CCommandSampleSetGroupUserData : public CRhinoCommand +{ +public: + CCommandSampleSetGroupUserData() = default; + UUID CommandUUID() override + { + // {9A8AE3FD-6413-4397-8303-EAD11954232E} + static const GUID SampleSetGroupUserDataCommand_UUID = + { 0x9a8ae3fd, 0x6413, 0x4397, { 0x83, 0x3, 0xea, 0xd1, 0x19, 0x54, 0x23, 0x2e } }; + return SampleSetGroupUserDataCommand_UUID; + } + const wchar_t* EnglishCommandName() override { return L"SampleSetGroupUserData"; } + CRhinoCommand::result RunCommand(const CRhinoCommandContext& context) override; +}; + +// The one and only CCommandSampleSetGroupUserData object +static class CCommandSampleSetGroupUserData theSampleSetGroupUserDataCommand; + +CRhinoCommand::result CCommandSampleSetGroupUserData::RunCommand(const CRhinoCommandContext& context) +{ + const CRhinoGroup* group = context.m_doc.m_group_table[0]; + if (nullptr == group) + { + RhinoApp().Print(L"The document's group table is empty.\n"); + return CRhinoCommand::nothing; + } + + bool rc = CSampleGroupUserData::SetUserData(context.m_doc, group); + if (rc) + RhinoApp().Print(L"Group user data added successfully.\n"); + else + RhinoApp().Print(L"Unable to add group user data.\n"); + + return CRhinoCommand::success; +} + +#pragma endregion + +// +// END SampleSetGroupUserData command +// +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// +// +// BEGIN SampleGetGroupUserData command +// + +#pragma region SampleGetGroupUserData command + +class CCommandSampleGetGroupUserData : public CRhinoCommand +{ +public: + CCommandSampleGetGroupUserData() = default; + UUID CommandUUID() override + { + // {15C1B793-F9EB-4B9F-8591-CC467A360ED0} + static const GUID SampleGetGroupUserDataCommand_UUID = + { 0x15c1b793, 0xf9eb, 0x4b9f, { 0x85, 0x91, 0xcc, 0x46, 0x7a, 0x36, 0xe, 0xd0 } }; + return SampleGetGroupUserDataCommand_UUID; + } + const wchar_t* EnglishCommandName() override { return L"SampleGetGroupUserData"; } + CRhinoCommand::result RunCommand(const CRhinoCommandContext& context) override; +}; + +// The one and only CCommandSampleGetGroupUserData object +static class CCommandSampleGetGroupUserData theSampleGetGroupUserDataCommand; + +CRhinoCommand::result CCommandSampleGetGroupUserData::RunCommand(const CRhinoCommandContext& context) +{ + const CRhinoGroup* group = context.m_doc.m_group_table[0]; + if (nullptr == group) + { + RhinoApp().Print(L"The document's group table is empty.\n"); + return CRhinoCommand::nothing; + } + + ON_wString string; + bool rc = CSampleGroupUserData::GetUserData(group, string); + if (rc) + RhinoApp().Print(L"Group has user data: %ls\n", static_cast(string)); + else + RhinoApp().Print(L"No group user data found.\n"); + + return CRhinoCommand::success; +} + +#pragma endregion + +// +// END SampleGetGroupUserData command +// +//////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////// From 592fd4cd15de2c85a52e410e9cf34c9e3e57330a Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Mon, 16 Sep 2024 13:03:57 -0700 Subject: [PATCH 07/14] Added SampleCsAddGroupUserData.cs, some missing AssemblyInfo.cs files. --- .../Properties/AssemblyInfo.cs | 18 ++++++++++ .../Commands/SampleCsAddGroupUserData.cs | 34 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 18 ++++++++++ rhinocommon/cs/SamplesCs.sln | 5 ++- 4 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 rhinocommon/cs/SampleCsEventWatcher/Properties/AssemblyInfo.cs create mode 100644 rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddGroupUserData.cs create mode 100644 rhinocommon/cs/SampleCsUserData/Properties/AssemblyInfo.cs diff --git a/rhinocommon/cs/SampleCsEventWatcher/Properties/AssemblyInfo.cs b/rhinocommon/cs/SampleCsEventWatcher/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..cd760f8e --- /dev/null +++ b/rhinocommon/cs/SampleCsEventWatcher/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +using Rhino.PlugIns; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: PlugInDescription(DescriptionType.Address, "146 North Canal Street, Suite 320\r\nSeattle, WA 98103")] +[assembly: PlugInDescription(DescriptionType.Country, "United States")] +[assembly: PlugInDescription(DescriptionType.Email, "dale@mcneel.com")] +[assembly: PlugInDescription(DescriptionType.Phone, "206-545-6877")] +[assembly: PlugInDescription(DescriptionType.Fax, "206-545-7321")] +[assembly: PlugInDescription(DescriptionType.Organization, "Robert McNeel & Associates")] +[assembly: PlugInDescription(DescriptionType.UpdateUrl, "https://github.com/mcneel/rhino-developer-samples")] +[assembly: PlugInDescription(DescriptionType.WebSite, "https://github.com/mcneel/rhino-developer-samples")] +[assembly: PlugInDescription(DescriptionType.Icon, "SampleCsEventWatcher.Resources.SampleCs.ico")] + +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: Guid("934955FB-33BB-4F6C-9F9E-9B0927854AAE")] diff --git a/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddGroupUserData.cs b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddGroupUserData.cs new file mode 100644 index 00000000..0cb66841 --- /dev/null +++ b/rhinocommon/cs/SampleCsUserData/Commands/SampleCsAddGroupUserData.cs @@ -0,0 +1,34 @@ +using Rhino; +using Rhino.Commands; + +namespace SampleCsUserData.Commands +{ + public class SampleCsAddGroupUserData : Command + { + public override string EnglishName => "SampleCsAddGroupUserData"; + + protected override Result RunCommand(RhinoDoc doc, RunMode mode) + { + var group = doc.Groups.FindIndex(0); + if (null == group) + { + RhinoApp.WriteLine("No groups found in the document."); + return Result.Success; + } + + var ud = group.UserData.Find(typeof(SampleCsUserDataObject)) as SampleCsUserDataObject; + if (null == ud) + { + ud = new SampleCsUserDataObject { Notes = "Hello Rhino Group!" }; + group.UserData.Add(ud); + RhinoApp.WriteLine("{0} added", ud.Description); + } + else + { + RhinoApp.WriteLine("{0} = {1}", ud.Description, ud.Notes); + } + + return Result.Success; + } + } +} \ No newline at end of file diff --git a/rhinocommon/cs/SampleCsUserData/Properties/AssemblyInfo.cs b/rhinocommon/cs/SampleCsUserData/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..d2aa4377 --- /dev/null +++ b/rhinocommon/cs/SampleCsUserData/Properties/AssemblyInfo.cs @@ -0,0 +1,18 @@ +using Rhino.PlugIns; +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: PlugInDescription(DescriptionType.Address, "146 North Canal Street, Suite 320\r\nSeattle, WA 98103")] +[assembly: PlugInDescription(DescriptionType.Country, "United States")] +[assembly: PlugInDescription(DescriptionType.Email, "dale@mcneel.com")] +[assembly: PlugInDescription(DescriptionType.Phone, "206-545-6877")] +[assembly: PlugInDescription(DescriptionType.Fax, "206-545-7321")] +[assembly: PlugInDescription(DescriptionType.Organization, "Robert McNeel & Associates")] +[assembly: PlugInDescription(DescriptionType.UpdateUrl, "https://github.com/mcneel/rhino-developer-samples")] +[assembly: PlugInDescription(DescriptionType.WebSite, "https://github.com/mcneel/rhino-developer-samples")] +[assembly: PlugInDescription(DescriptionType.Icon, "SampleCsUserData.Resources.SampleCs.ico")] + +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: Guid("8A62C7AE-3C24-4151-BCD0-AAB36C7DCA8B")] diff --git a/rhinocommon/cs/SamplesCs.sln b/rhinocommon/cs/SamplesCs.sln index a3689293..a796e28d 100644 --- a/rhinocommon/cs/SamplesCs.sln +++ b/rhinocommon/cs/SamplesCs.sln @@ -1,4 +1,3 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34408.163 @@ -29,11 +28,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsTest2", "SampleCsSh EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsSkin", "SampleCsSkin\SampleCsSkin.csproj", "{4E0FCE1B-4577-4F25-86FC-2F1526D2C7CB}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsUserData", "SampleCsUserData\SampleCsUserData.csproj", "{444482E8-CB8F-4A79-87A8-9C3FCBCC7B16}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleCsUserData", "SampleCsUserData\SampleCsUserData.csproj", "{444482E8-CB8F-4A79-87A8-9C3FCBCC7B16}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsWpf", "SampleCsWpf\SampleCsWpf.csproj", "{098AF3EE-CF77-4FEF-859B-B3BC22C7336A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsEto", "SampleCsEto\SampleCsEto.csproj", "{CD962975-5E0A-4BB7-AF01-ABD4A9E18AAC}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleCsEto", "SampleCsEto\SampleCsEto.csproj", "{CD962975-5E0A-4BB7-AF01-ABD4A9E18AAC}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsCollapsibleSectionETOUI", "SampleCsCollapsibleSectionETO_UI\SampleCsCollapsibleSectionETOUI.csproj", "{D36880D5-3106-4D36-A9AB-E446E5C5781D}" EndProject From 6484bb1f101fa9defda31195e3ffb5523284a9b9 Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Mon, 16 Sep 2024 13:07:11 -0700 Subject: [PATCH 08/14] Update README.md --- rhinocommon/cs/SampleCsUserData/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rhinocommon/cs/SampleCsUserData/README.md b/rhinocommon/cs/SampleCsUserData/README.md index 4a1ef34b..d711e093 100644 --- a/rhinocommon/cs/SampleCsUserData/README.md +++ b/rhinocommon/cs/SampleCsUserData/README.md @@ -7,12 +7,12 @@ Building Sample -------------------- To build the sample, you are going to need: -* Rhinoceros 6 (http://www.rhino3d.com) -* Microsoft Visual C# 2017 +* Rhinoceros 8 (http://www.rhino3d.com) +* Microsoft Visual C# 2022 Legal Stuff ----------- -Copyright © 2017, Robert McNeel & Associates. All Rights Reserved. +Copyright © 2017-2024, Robert McNeel & Associates. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -24,4 +24,4 @@ THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLI WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED. -Rhinoceros is a registered trademark of Robert McNeel & Associates. \ No newline at end of file +Rhinoceros is a registered trademark of Robert McNeel & Associates. From 7efdcf28b7f69e520f933ae7aeeba17fc25f897c Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Mon, 16 Sep 2024 14:19:52 -0700 Subject: [PATCH 09/14] Ported SampleCsCommands.csproj to Rhino 8, .net7.0 --- .../Properties/AssemblyInfo.cs | 42 +-- .../Properties/launchSettings.json | 14 + .../cs/SampleCsCommands/SampleCsClipboard.cs | 2 +- .../SampleCsCommands/SampleCsCommands.csproj | 302 ++---------------- .../SampleCsCommands/SampleCsContourMesh.cs | 2 +- .../SampleCsExtrudeMeshFace.cs | 3 +- .../SampleCsGumballCylinder.cs | 4 +- .../SampleCsCommands/SampleCsMeshOutline.cs | 18 +- .../SampleCsCommands/SampleCsWrite3dmFile.cs | 5 +- 9 files changed, 62 insertions(+), 330 deletions(-) create mode 100644 rhinocommon/cs/SampleCsCommands/Properties/launchSettings.json diff --git a/rhinocommon/cs/SampleCsCommands/Properties/AssemblyInfo.cs b/rhinocommon/cs/SampleCsCommands/Properties/AssemblyInfo.cs index 563484d2..082fcaf8 100644 --- a/rhinocommon/cs/SampleCsCommands/Properties/AssemblyInfo.cs +++ b/rhinocommon/cs/SampleCsCommands/Properties/AssemblyInfo.cs @@ -1,48 +1,18 @@ -using System.Reflection; +using Rhino.PlugIns; +using System.Reflection; using System.Runtime.InteropServices; -using Rhino.PlugIns; -// Plug-in Description Attributes - all of these are optional -// These will show in Rhino's option dialog, in the tab Plug-ins -[assembly: PlugInDescription(DescriptionType.Address, "3670 Woodland Park Avenue North\r\nSeattle, WA 98103")] +[assembly: PlugInDescription(DescriptionType.Address, "146 North Canal Street, Suite 320\r\nSeattle, WA 98103")] [assembly: PlugInDescription(DescriptionType.Country, "United States")] -[assembly: PlugInDescription(DescriptionType.Email, "devsupport@mcneel.com")] +[assembly: PlugInDescription(DescriptionType.Email, "dale@mcneel.com")] [assembly: PlugInDescription(DescriptionType.Phone, "206-545-6877")] [assembly: PlugInDescription(DescriptionType.Fax, "206-545-7321")] [assembly: PlugInDescription(DescriptionType.Organization, "Robert McNeel & Associates")] [assembly: PlugInDescription(DescriptionType.UpdateUrl, "https://github.com/mcneel/rhino-developer-samples")] -[assembly: PlugInDescription(DescriptionType.WebSite, "http://www.rhino3d.com/")] +[assembly: PlugInDescription(DescriptionType.WebSite, "https://github.com/mcneel/rhino-developer-samples")] [assembly: PlugInDescription(DescriptionType.Icon, "SampleCsCommands.Resources.SampleCs.ico")] -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("SampleCsCommands")] // Plug-In title is extracted from this -[assembly: AssemblyDescription("RhinoCommon Sample - SampleCsCommands")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Robert McNeel & Associates")] -[assembly: AssemblyProduct("SampleCsCommands")] -[assembly: AssemblyCopyright("Copyright © 2017, Robert McNeel & Associates")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("4d58b9ad-7cfd-47c2-b250-f44001d2cf9f")] // This will also be the Guid of the Rhino plug-in - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("6.0.0.0")] -[assembly: AssemblyFileVersion("6.0.0.0")] +[assembly: Guid("4D58B9AD-7CFD-47C2-B250-F44001D2CF9F")] diff --git a/rhinocommon/cs/SampleCsCommands/Properties/launchSettings.json b/rhinocommon/cs/SampleCsCommands/Properties/launchSettings.json new file mode 100644 index 00000000..1eef7cd6 --- /dev/null +++ b/rhinocommon/cs/SampleCsCommands/Properties/launchSettings.json @@ -0,0 +1,14 @@ +{ + "profiles": { + "Rhino 8 (net7.0)": { + "commandName": "Executable", + "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe", + "commandLineArgs": "/netcore" + }, + "Rhino 8 net48)": { + "commandName": "Executable", + "executablePath": "C:\\Program Files\\Rhino 8\\System\\Rhino.exe", + "commandLineArgs": "/netfx" + } + } +} \ No newline at end of file diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsClipboard.cs b/rhinocommon/cs/SampleCsCommands/SampleCsClipboard.cs index d44791a9..c2f271ce 100644 --- a/rhinocommon/cs/SampleCsCommands/SampleCsClipboard.cs +++ b/rhinocommon/cs/SampleCsCommands/SampleCsClipboard.cs @@ -98,7 +98,7 @@ private static byte[] GeometryBaseToBytes(GeometryBase src) if (null == src) return null; - var rc = new byte[0]; + var rc = Array.Empty(); try { var formatter = new BinaryFormatter(); diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsCommands.csproj b/rhinocommon/cs/SampleCsCommands/SampleCsCommands.csproj index df69e394..87ccca52 100644 --- a/rhinocommon/cs/SampleCsCommands/SampleCsCommands.csproj +++ b/rhinocommon/cs/SampleCsCommands/SampleCsCommands.csproj @@ -1,290 +1,36 @@ - - + - Debug32 - AnyCPU - 8.0.30703 - 2.0 - {C1498326-89AB-48B0-A148-290C169CAA68} + net7.0-windows;net48 + true + .rhp + ..\Bin\ Library - Properties - SampleCsCommands - SampleCsCommands - v4.8 - 512 - false - + Robert McNeel & Associates + Copyright © 2013-2024, Robert McNeel & Associates + SampleCsUserData + Sample Commands Plug-in + 8.0.0 - - true - full - false - ..\bin\ - DEBUG;TRACE - prompt - false + + 1701;1702;NU1701 - - pdbonly - true - ..\bin\ - TRACE - prompt - 4 - false + + 1701;1702;NU1701 + + + 1701;1702;NU1701 + + + 1701;1702;NU1701 - - C:\Program Files\Rhino 7\System\Eto.dll - False - - - C:\Program Files\Rhino 7\System\Rhino.UI.dll - False - - - C:\Program Files\Rhino 7\System\RhinoCommon.dll - False - - - C:\Program Files\Rhino 7\System\RhinoWindows.dll - False - - - - - - - - - C:\Program Files\Rhino 7\Plug-ins\Xfinium.Pdf.Win.dll - - - - - True - True - Resources.resx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - + - + + - + - - - - Copy "$(TargetPath)" "$(TargetDir)$(ProjectName).rhp" -Erase "$(TargetPath)" - - - en-US - - - C:\Program Files\Rhino WIP\System\Rhino.exe - - - Program - false - \ No newline at end of file diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsContourMesh.cs b/rhinocommon/cs/SampleCsCommands/SampleCsContourMesh.cs index db8743c8..87738b45 100644 --- a/rhinocommon/cs/SampleCsCommands/SampleCsContourMesh.cs +++ b/rhinocommon/cs/SampleCsCommands/SampleCsContourMesh.cs @@ -25,7 +25,7 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode) Rhino.Geometry.Point3d end_pt = bbox.Corner(false, true, true); double interval = start_pt.DistanceTo(end_pt) / 10; - Rhino.Geometry.Curve[] curves = Rhino.Geometry.Mesh.CreateContourCurves(mesh, start_pt, end_pt, interval); + Rhino.Geometry.Curve[] curves = Rhino.Geometry.Mesh.CreateContourCurves(mesh, start_pt, end_pt, interval, doc.ModelAbsoluteTolerance); if (null != curves && curves.Length > 0) { for (int i = 0; i < curves.Length; i++) diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsExtrudeMeshFace.cs b/rhinocommon/cs/SampleCsCommands/SampleCsExtrudeMeshFace.cs index f3a6f086..fcd6f7eb 100644 --- a/rhinocommon/cs/SampleCsCommands/SampleCsExtrudeMeshFace.cs +++ b/rhinocommon/cs/SampleCsCommands/SampleCsExtrudeMeshFace.cs @@ -1,5 +1,4 @@ -using System.Collections.Generic; -using Rhino; +using Rhino; using Rhino.Commands; using Rhino.DocObjects; using Rhino.Geometry; diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsGumballCylinder.cs b/rhinocommon/cs/SampleCsCommands/SampleCsGumballCylinder.cs index 50869632..156f408b 100644 --- a/rhinocommon/cs/SampleCsCommands/SampleCsGumballCylinder.cs +++ b/rhinocommon/cs/SampleCsCommands/SampleCsGumballCylinder.cs @@ -41,8 +41,8 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode) var radius_go = new GumballObject(); var height_go = new GumballObject(); - var radius_dc = new GumballDisplayConduit(); - var height_dc = new GumballDisplayConduit(); + var radius_dc = new GumballDisplayConduit(Rhino.DocObjects.ActiveSpace.ModelSpace); + var height_dc = new GumballDisplayConduit(Rhino.DocObjects.ActiveSpace.ModelSpace); var radius_gas = RadiusGumballAppearanceSettings(); var height_gas = HeightGumballAppearanceSettings(); diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsMeshOutline.cs b/rhinocommon/cs/SampleCsCommands/SampleCsMeshOutline.cs index 5da34439..4ab264bf 100644 --- a/rhinocommon/cs/SampleCsCommands/SampleCsMeshOutline.cs +++ b/rhinocommon/cs/SampleCsCommands/SampleCsMeshOutline.cs @@ -1,11 +1,11 @@ using System; using System.Collections.Generic; +using System.Linq; using Rhino; using Rhino.Commands; using Rhino.Display; using Rhino.DocObjects; using Rhino.Geometry; -using Rhino.Input; using Rhino.Input.Custom; namespace SampleCsCommands @@ -44,14 +44,18 @@ protected override Result RunCommand(RhinoDoc doc, RunMode mode) if (InObjects.Count > 0) { - var meshRefs = RhinoObject.GetRenderMeshes(InObjects, true, false); - if (null != meshRefs) + var flags = Rhino.Render.CustomRenderMeshes.RenderMeshProvider.Flags.Recursive; + foreach (RhinoObject obj in InObjects) { - for (int i = 0; i < meshRefs.Length; i++) + var meshRefs = obj.RenderMeshes(MeshType.Render, null, null, ref flags, null, null).ToArray(); + if (null != meshRefs) { - Mesh mesh = meshRefs[i].Mesh(); - if (null != mesh) - InMeshes.Add(mesh); + for (int i = 0; i < meshRefs.Length; i++) + { + Mesh mesh = meshRefs[i].Mesh; + if (null != mesh) + InMeshes.Add(mesh); + } } } } diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsWrite3dmFile.cs b/rhinocommon/cs/SampleCsCommands/SampleCsWrite3dmFile.cs index 85da988d..c35bdfb5 100644 --- a/rhinocommon/cs/SampleCsCommands/SampleCsWrite3dmFile.cs +++ b/rhinocommon/cs/SampleCsCommands/SampleCsWrite3dmFile.cs @@ -1,5 +1,4 @@ -using System; -using System.Drawing; +using System.Drawing; using System.IO; using Rhino; using Rhino.Commands; @@ -15,7 +14,7 @@ public class SampleCsWrite3dmFile : Command protected override Result RunCommand(RhinoDoc doc, RunMode mode) { - var path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); + var path = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Desktop); var filename = Path.Combine(path, "SampleCsWrite3dmFile.3dm"); Result rc; From 1a768cf8892207afe75aedea9dad9d43aa69707a Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Mon, 16 Sep 2024 14:30:39 -0700 Subject: [PATCH 10/14] Removed obsolete samples. --- .../Properties/Resources.Designer.cs | 73 ------ .../Properties/Resources.resx | 124 ----------- .../cs/SampleCsCommands/Resources/Logo.png | Bin 13918 -> 0 bytes .../cs/SampleCsCommands/SampleCsClipboard.cs | 208 ------------------ .../SampleCsDrawViewportLogo.cs | 57 ----- .../SampleCsRestoreLayerState.cs | 36 --- .../SampleCsSerializeClass.cs | 198 ----------------- .../cs/SampleCsCommands/SampleCsWritePdf.cs | 83 ------- 8 files changed, 779 deletions(-) delete mode 100644 rhinocommon/cs/SampleCsCommands/Properties/Resources.Designer.cs delete mode 100644 rhinocommon/cs/SampleCsCommands/Properties/Resources.resx delete mode 100644 rhinocommon/cs/SampleCsCommands/Resources/Logo.png delete mode 100644 rhinocommon/cs/SampleCsCommands/SampleCsClipboard.cs delete mode 100644 rhinocommon/cs/SampleCsCommands/SampleCsDrawViewportLogo.cs delete mode 100644 rhinocommon/cs/SampleCsCommands/SampleCsRestoreLayerState.cs delete mode 100644 rhinocommon/cs/SampleCsCommands/SampleCsSerializeClass.cs delete mode 100644 rhinocommon/cs/SampleCsCommands/SampleCsWritePdf.cs diff --git a/rhinocommon/cs/SampleCsCommands/Properties/Resources.Designer.cs b/rhinocommon/cs/SampleCsCommands/Properties/Resources.Designer.cs deleted file mode 100644 index 3974bdb9..00000000 --- a/rhinocommon/cs/SampleCsCommands/Properties/Resources.Designer.cs +++ /dev/null @@ -1,73 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace SampleCsCommands.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleCsCommands.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Logo { - get { - object obj = ResourceManager.GetObject("Logo", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - } -} diff --git a/rhinocommon/cs/SampleCsCommands/Properties/Resources.resx b/rhinocommon/cs/SampleCsCommands/Properties/Resources.resx deleted file mode 100644 index 61e26f0d..00000000 --- a/rhinocommon/cs/SampleCsCommands/Properties/Resources.resx +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\Logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - \ No newline at end of file diff --git a/rhinocommon/cs/SampleCsCommands/Resources/Logo.png b/rhinocommon/cs/SampleCsCommands/Resources/Logo.png deleted file mode 100644 index 70c77b57e8ce4066ac21c1852c166d2224ba9996..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13918 zcmV-kHlfLhP)kv*~ZT-ZRwyaWnp3I=+Y68-jOK9L<9?#h@yVR9={|;#i%hRF|mEtsEHUw z#Q>IA2}P0KL_k1UdXc5GEM@o3eE*r}-otS3?kaV&BSRF2O$ z;|wH2B;hO4kdcwWnS9&%k19v4g1}C|g(=4|$nMy&Ln^3LsZwxvqehKjdFq3E#fla8 z?%m4)l&D_4`ho=uAX54A6f>P9Qo%nLp5&)p`Z3M@mpk!xfgHe?# zRXFAV^#bBDvpG3AI$5qn$+P8$1uCjfUG2A-@bk5CD_jrj~+c}oU2ZI+i-ND5D0<=FaaX4;?JOA@N*yu1VA9r>|3^M*|cdB=fRQs z7-4Xf;-Zes1IJK8L<+Z0HOb1_wQI5AeAW5?N(r63l8{%uBbJB4H}qGeD@zs0I3K*O9Ta!Q9ghL;+*6F-k08x-iJ<`H*e-bOfDzE zlrtQ21|?=SiA~!{P)wlfBn{XDNQIe^lWOTy)VQ6nax7ku%z%X8yYIdOefSh;)~{br zkYxhzQ@o5VMMr@(ibxS0=<^el;8*2^gsG*gJ{5=|Rmcsh3>o4is!24kJt=DR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IPo51-G4F5_DgrWG zbImo_2Kw;pU;i55&|R<+oP}*f9DDZcsh2HilLGpn4O+E-@UUUSh|f_SAY#>~rbcrw zc;%&+UZV4KjLO=GBkbxRl;Egg27~}pVPY`~^%Zc?dE97(jF?ofOXEr5{onlNH{6l) zbPq#Fvw#kdV)^MOnhhn!Bipo!$gzFZ9MWZ7|GF7yuec zNlAf!AAR&uNvgz4v52;d(B=j9EmgK?Mu|AxzLnm-e9sNG`qSR9oQJRVu%fiy#;7!b zWG=j+M=)BtOMy!vZs_6tF-(5b4o!l~|Gj>FoI{;&;waxVYQBDgmoN=7PLpC1@wiZ5 zKmYm9wY;m4UM1c%4w1MgH3dX1anV3Q-f&{Hln((4NnwVcxscrQQB5c-q*@_?SR7;~ szrgUQ`tSpj=il3(d;_;aqSVCl|6u_sAwr4)#Q*>R07*qoM6N<$f=wWw=l}o! diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsClipboard.cs b/rhinocommon/cs/SampleCsCommands/SampleCsClipboard.cs deleted file mode 100644 index c2f271ce..00000000 --- a/rhinocommon/cs/SampleCsCommands/SampleCsClipboard.cs +++ /dev/null @@ -1,208 +0,0 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters.Binary; -using System.Windows.Forms; -using Rhino; -using Rhino.Commands; -using Rhino.Geometry; - -namespace SampleCsCommands -{ - /// - /// SampleCsCopyToClipboard command - /// - public class SampleCsCopyToClipboard : Command - { - public override string EnglishName => "SampleCsCopyToClipboard"; - - protected override Result RunCommand(RhinoDoc doc, RunMode mode) - { - var sphere = new Sphere(Plane.WorldXY, 5.0); - var brep = sphere.ToBrep(); - - var rc = SampleCsGeometryBaseClipboardHelper.Write(brep); - if (rc) - { - //Console.WriteLine("{0} copied to the Windows Clipboard", brep.ObjectType); - RhinoApp.WriteLine("{0} copied to the Windows Clipboard", brep.ObjectType); - } - - return Result.Success; - } - } - - /// - /// SampleCsPasteFromClipboard command - /// - public class SampleCsPasteFromClipboard : Command - { - public override string EnglishName => "SampleCsPasteFromClipboard"; - - protected override Result RunCommand(RhinoDoc doc, RunMode mode) - { - var geometry = SampleCsGeometryBaseClipboardHelper.Read(); - if (null == geometry) - { - RhinoApp.WriteLine("Nothing to paste."); - return Result.Nothing; - } - - doc.Objects.Add(geometry); - doc.Views.Redraw(); - - return Result.Success; - } - } - - public static class SampleCsGeometryBaseClipboardHelper - { - private const string CLIPBOARD_FORMAT = "Rhino.Geometry.GeometryBase"; - - /// - /// Writes an object, that inherits from Rhino.Geometry.GeometryBase to the Windows Clipboard. - /// - /// The geometry to write. - /// True if successful, false otherwise. - public static bool Write(GeometryBase geometry) - { - if (null == geometry) - return false; - - var bytes = GeometryBaseToBytes(geometry); - if (null == bytes || 0 == bytes.Length) - return false; - - return WriteClipboardBytes(bytes); - } - - /// - /// Reads an object, that inherits from Rhino.Geometry.GeometryBase from the Windows Clipboard. - /// - /// The object if successful, null otherwise. - public static GeometryBase Read() - { - var bytes = ReadClipboardBytes(); - if (null == bytes || 0 == bytes.Length) - return null; - - return BytesToGeometryBase(bytes); - } - - /// - /// Converts an object that inherits from Rhino.Geometry.GeometryBase to an array of bytes. - /// - private static byte[] GeometryBaseToBytes(GeometryBase src) - { - if (null == src) - return null; - - var rc = Array.Empty(); - try - { - var formatter = new BinaryFormatter(); - using (var stream = new MemoryStream()) - { - formatter.Serialize(stream, src); - rc = stream.ToArray(); - } - } - catch (Exception e) - { - Debug.WriteLine(e.Message); - } - - return rc; - } - - /// - /// Converts an array of bytes to an object that inherits from Rhino.Geometry.GeometryBase. - /// - private static GeometryBase BytesToGeometryBase(byte[] bytes) - { - if (null == bytes || 0 == bytes.Length) - return null; - - GeometryBase rc = null; - try - { - using (var stream = new MemoryStream()) - { - var formatter = new BinaryFormatter {Binder = new GeometryBaseBinder()}; - stream.Write(bytes, 0, bytes.Length); - stream.Seek(0, SeekOrigin.Begin); - if (formatter.Deserialize(stream) is GeometryBase geometry && geometry.IsValid) - rc = geometry; - } - } - catch (Exception e) - { - Debug.WriteLine(e.Message); - } - - return rc; - } - - /// - /// Writes an array of bytes to the Window Clipboard in our format. - /// - private static bool WriteClipboardBytes(byte[] bytes) - { - if (null == bytes || 0 == bytes.Length) - return false; - - var rc = false; - try - { - var data = new DataObject(); - using (var stream = new MemoryStream()) - { - stream.Write(bytes, 0, bytes.Length); - data.SetData(CLIPBOARD_FORMAT, false, stream); - Clipboard.SetDataObject(data, true); - rc = true; - } - } - catch (Exception e) - { - Debug.WriteLine(e.Message); - } - - return rc; - } - - /// - /// Reads an array of bytes from the Window Clipboard in our format. - /// - private static byte[] ReadClipboardBytes() - { - if (!(Clipboard.GetDataObject() is DataObject data) || !data.GetDataPresent(CLIPBOARD_FORMAT)) - return null; - - var stream = data.GetData(CLIPBOARD_FORMAT) as MemoryStream; - return stream?.ToArray(); - } - - /// - /// Both RhinoCommon and Rhino3dmIO have a Rhino.Geometry.GeometryBase - /// class. This serialization binder helps deserialize the equivalent - /// objects across the different assemblies. - /// - private class GeometryBaseBinder : SerializationBinder - { - public override Type BindToType(string assemblyName, string typeName) - { - if (assemblyName == null) - throw new ArgumentNullException(nameof(assemblyName)); - - var assembly = typeof(GeometryBase).Assembly; - assemblyName = assembly.ToString(); - var type_to_deserialize = Type.GetType($"{typeName}, {assemblyName}"); - - return type_to_deserialize; - } - } - - } -} \ No newline at end of file diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsDrawViewportLogo.cs b/rhinocommon/cs/SampleCsCommands/SampleCsDrawViewportLogo.cs deleted file mode 100644 index 05752ad9..00000000 --- a/rhinocommon/cs/SampleCsCommands/SampleCsDrawViewportLogo.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System; -using Rhino; -using Rhino.Commands; -using Rhino.Geometry; -using Rhino.Input.Custom; - -namespace SampleCsCommands -{ - /// - /// SampleCsDrawViewportLogo command - /// - public class SampleCsDrawViewportLogo : Command - { - public override string EnglishName => "SampleCsDrawViewportLogo"; - - protected override Result RunCommand(RhinoDoc doc, RunMode mode) - { - SampleCsDrawViewportLogoConduit conduit = new SampleCsDrawViewportLogoConduit(); - conduit.Enabled = true; - doc.Views.Redraw(); - - GetString gs = new GetString(); - gs.SetCommandPrompt("Press to continue"); - gs.AcceptNothing(true); - gs.Get(); - - conduit.Enabled = false; - doc.Views.Redraw(); - - return Result.Success; - } - } - - /// - /// SampleCsDrawViewportLogoConduit display conduit - /// - public class SampleCsDrawViewportLogoConduit : Rhino.Display.DisplayConduit - { - private float m_sprite_size = 64; - private System.Drawing.Bitmap m_logo; - private readonly Rhino.Display.DisplayBitmap m_bitmap; - - public SampleCsDrawViewportLogoConduit() - { - m_logo = SampleCsCommands.Properties.Resources.Logo; - m_bitmap = new Rhino.Display.DisplayBitmap(m_logo); - } - - protected override void DrawForeground(Rhino.Display.DrawEventArgs e) - { - System.Drawing.Rectangle rect = e.Viewport.Bounds; - Point2d point = new Point2d(rect.Right - (0.5 * m_sprite_size), rect.Bottom - (0.5 * m_sprite_size)); - e.Display.DrawSprite(m_bitmap, point, m_sprite_size); - } - } - -} diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsRestoreLayerState.cs b/rhinocommon/cs/SampleCsCommands/SampleCsRestoreLayerState.cs deleted file mode 100644 index c555e68a..00000000 --- a/rhinocommon/cs/SampleCsCommands/SampleCsRestoreLayerState.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using Rhino; -using Rhino.Commands; - -namespace SampleCsCommands -{ - public class SampleCsRestoreLayerState : Command - { - public override string EnglishName => "SampleCsRestoreLayerState"; - - protected override Result RunCommand(RhinoDoc doc, RunMode mode) - { - Guid plugin_id = Rhino.PlugIns.PlugIn.IdFromName("Rhino Bonus Tools"); - if (plugin_id == Guid.Empty) - return Result.Failure; - - // The object returned by Rhino.RhinoApp.GetPlugInObject is a COM object, not a .NET object. - // C# 4 introduced the new dynamic keyword, which was designed with COM Interop in mind. - // The intent was to make calling properties and methods in C# as easy as it was in VBScript, etc. - - dynamic plugin_obj = Rhino.RhinoApp.GetPlugInObject(plugin_id); - if (null == plugin_obj) - return Result.Failure; - - object[] layer_states = plugin_obj.LayerStateNames(); - foreach (object layer_state in layer_states) - { - string state_name = layer_state.ToString(); - if (state_name.Equals("MyLayerState", StringComparison.OrdinalIgnoreCase)) - plugin_obj.RestoreLayerState(layer_state, 0); - } - - return Result.Success; - } - } -} diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsSerializeClass.cs b/rhinocommon/cs/SampleCsCommands/SampleCsSerializeClass.cs deleted file mode 100644 index 353bceab..00000000 --- a/rhinocommon/cs/SampleCsCommands/SampleCsSerializeClass.cs +++ /dev/null @@ -1,198 +0,0 @@ -using System; -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; -using Rhino; -using Rhino.Commands; -using Rhino.DocObjects; -using Rhino.DocObjects.Custom; -using Rhino.FileIO; -using Rhino.Input; - -namespace SampleCsCommands -{ - public class SampleCsSerializeClass : Command - { - public override string EnglishName => "SampleCsSerializeClass"; - - protected override Result RunCommand(RhinoDoc doc, RunMode mode) - { - var rc = RhinoGet.GetOneObject("Select object", false, ObjectType.AnyObject, out var objref); - if (rc != Result.Success) - return rc; - - var obj = objref.Object(); - if (null == obj) - return Result.Failure; - - if (!(obj.Attributes.UserData.Find(typeof(SampleCsCustomUserData)) is SampleCsCustomUserData ud)) - { - var rand = new Random(); - ud = new SampleCsCustomUserData - { - Data = - { - X = rand.NextDouble(), - Y = rand.NextDouble(), - Z = rand.NextDouble() - } - }; - obj.Attributes.UserData.Add(ud); - } - - RhinoApp.WriteLine("{0} = {1}", ud.Description, ud.Data); - - return Result.Success; - } - } - - /// - /// SampleCsCustomUserData - /// - [System.Runtime.InteropServices.Guid("23A7FA3D-74F6-4578-9059-B5E3611CD406")] - public class SampleCsCustomUserData : UserData - { - public SampleCsCustomClass Data { get; } - - public SampleCsCustomUserData() - { - Data = new SampleCsCustomClass(); - } - - public bool IsValid => Data.IsValid; - - public override string Description => "SampleCsCustomClass"; - - public override string ToString() - { - return Description; - } - - protected override void OnDuplicate(UserData source) - { - if (source is SampleCsCustomUserData src) - { - Data.Create(src.Data); - } - } - - public override bool ShouldWrite => IsValid; - - protected override bool Read(BinaryArchiveReader archive) - { - archive.Read3dmChunkVersion(out var major, out var minor); - if (1 == major && 0 == minor) - { - Data.Read(archive); - } - return !archive.ReadErrorOccured; - } - - protected override bool Write(BinaryArchiveWriter archive) - { - archive.Write3dmChunkVersion(1, 0); - Data.Write(archive); - return !archive.WriteErrorOccured; - } - } - - /// - /// SampleCsCustomClass - /// - [Serializable] - public class SampleCsCustomClass - { - public double X { get; set; } - public double Y { get; set; } - public double Z { get; set; } - - public SampleCsCustomClass() - { - X = Y = Z = 0.0; - } - - public SampleCsCustomClass(SampleCsCustomClass src) - { - X = src.X; - Y = src.Y; - Z = src.Z; - } - - public void Create(SampleCsCustomClass src) - { - X = src.X; - Y = src.Y; - Z = src.Z; - } - - public bool IsValid => RhinoMath.IsValidDouble(X) && - RhinoMath.IsValidDouble(Y) && - RhinoMath.IsValidDouble(Z); - - public bool Write(BinaryArchiveWriter archive) - { - var rc = false; - if (null != archive) - { - try - { - // Write chunk version - archive.Write3dmChunkVersion(1, 0); - - // Write 'this' object - var formatter = new BinaryFormatter(); - var stream = new MemoryStream(); - formatter.Serialize(stream, this); - stream.Seek(0, 0); - var bytes = stream.ToArray(); - archive.WriteByteArray(bytes); - stream.Close(); - - // Verify writing - rc = archive.WriteErrorOccured; - } - catch - { - // TODO - } - } - return rc; - } - - public bool Read(BinaryArchiveReader archive) - { - var rc = false; - if (null != archive) - { - // Read and verify chunk version - archive.Read3dmChunkVersion(out var major, out var minor); - if (1 == major && 0 == minor) - { - try - { - // Read this object - var bytes = archive.ReadByteArray(); - var stream = new MemoryStream(bytes); - var formatter = new BinaryFormatter(); - var data = formatter.Deserialize(stream) as SampleCsCustomClass; - Create(data); - - // Verify reading - rc = archive.ReadErrorOccured; - } - catch - { - // TODO - } - } - } - return rc; - } - - public override string ToString() - { - var culture = System.Globalization.CultureInfo.InvariantCulture; - return $"{X.ToString(culture)},{Y.ToString(culture)},{Z.ToString(culture)}"; - } - } - -} diff --git a/rhinocommon/cs/SampleCsCommands/SampleCsWritePdf.cs b/rhinocommon/cs/SampleCsCommands/SampleCsWritePdf.cs deleted file mode 100644 index 049682d8..00000000 --- a/rhinocommon/cs/SampleCsCommands/SampleCsWritePdf.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using Rhino; -using Rhino.Commands; -using Rhino.FileIO; - -namespace SampleCsCommands -{ - public class SampleCsWritePdf : Command - { - public override string EnglishName => "SampleCsWritePdf"; - - protected override Result RunCommand(RhinoDoc doc, RunMode mode) - { - var pdf = FilePdf.Create(); - - var pdf_doc = pdf.PdfDocumentImplementation() as Xfinium.Pdf.PdfFixedDocument; - if (null == pdf_doc) - return Result.Failure; - - var cover_page = pdf_doc.Pages.Add(); - - using (var font = new System.Drawing.Font("Arial", 30)) - { - var pdf_font = new Xfinium.Pdf.Graphics.PdfUnicodeTrueTypeFont(font, false) { Underline = true }; - var color = new Xfinium.Pdf.Graphics.PdfRgbColor(0, 0, 0); - var appearance = new Xfinium.Pdf.Graphics.PdfStringAppearanceOptions(pdf_font, null, new Xfinium.Pdf.Graphics.PdfBrush(color)); - var layout = new Xfinium.Pdf.Graphics.PdfStringLayoutOptions - { - HorizontalAlign = Xfinium.Pdf.Graphics.PdfStringHorizontalAlign.Center, - X = cover_page.Width / 2, - Y = cover_page.Height / 2 - }; - cover_page.Graphics.DrawString(EnglishName, appearance, layout); - } - - const int w = (int)(8.5 * 300); - const int h = 11 * 300; - - var views = doc.Views.GetViewList(true, false); - for (var i = 0; i < views.Length; i++) - { - var view = views[i]; - var viewcapture = new Rhino.Display.ViewCaptureSettings(view, new System.Drawing.Size(w, h), 300); - var page_index = pdf.AddPage(viewcapture) - 1; - using (var font = new System.Drawing.Font("Arial", 80)) - { - var pdf_font = new Xfinium.Pdf.Graphics.PdfUnicodeTrueTypeFont(font, false); - var color = new Xfinium.Pdf.Graphics.PdfRgbColor(40, 40, 40); - var pen = new Xfinium.Pdf.Graphics.PdfPen(color, 3); - var appearance = new Xfinium.Pdf.Graphics.PdfStringAppearanceOptions(pdf_font, pen, null); - var layout = new Xfinium.Pdf.Graphics.PdfStringLayoutOptions - { - HorizontalAlign = Xfinium.Pdf.Graphics.PdfStringHorizontalAlign.Center, - Rotation = 45, - X = cover_page.Width / 2, - Y = cover_page.Height / 2 - }; - pdf_doc.Pages[page_index].Graphics.DrawString("Top Secret", appearance, layout); - } - - using (var font = new System.Drawing.Font("Arial", 20)) - { - var pdf_font = new Xfinium.Pdf.Graphics.PdfUnicodeTrueTypeFont(font, false); - var color = new Xfinium.Pdf.Graphics.PdfRgbColor(0, 0, 0); - var appearance = new Xfinium.Pdf.Graphics.PdfStringAppearanceOptions(pdf_font, null, new Xfinium.Pdf.Graphics.PdfBrush(color)); - var layout = new Xfinium.Pdf.Graphics.PdfStringLayoutOptions - { - HorizontalAlign = Xfinium.Pdf.Graphics.PdfStringHorizontalAlign.Right, - X = cover_page.Width * 0.9, - Y = cover_page.Height * 0.9 - }; - pdf_doc.Pages[page_index].Graphics.DrawString($"Page {i + 1} of {views.Length}", appearance, layout); - } - } - - var path = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); - path = System.IO.Path.Combine(path, EnglishName + ".pdf"); - pdf.Write(path); - - return Result.Success; - } - } -} \ No newline at end of file From 9ecc765c1008b2da832eac8a2641fd43b37307d9 Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Wed, 18 Sep 2024 15:43:05 -0700 Subject: [PATCH 11/14] Added cmdSampleBlendCurve.cpp --- cpp/SampleCommands/SampleCommands.vcxproj | 2 + .../SampleCommands.vcxproj.filters | 6 + cpp/SampleCommands/SampleFunctions.cpp | 84 ++- cpp/SampleCommands/cmdSampleBlendCurve.cpp | 523 ++++++++++++++++++ cpp/SampleCommands/stdafx.h | 4 +- 5 files changed, 566 insertions(+), 53 deletions(-) create mode 100644 cpp/SampleCommands/cmdSampleBlendCurve.cpp diff --git a/cpp/SampleCommands/SampleCommands.vcxproj b/cpp/SampleCommands/SampleCommands.vcxproj index b1dd47cd..33159b03 100644 --- a/cpp/SampleCommands/SampleCommands.vcxproj +++ b/cpp/SampleCommands/SampleCommands.vcxproj @@ -11,6 +11,7 @@ + @@ -306,6 +307,7 @@ + diff --git a/cpp/SampleCommands/SampleCommands.vcxproj.filters b/cpp/SampleCommands/SampleCommands.vcxproj.filters index 482bbd75..23d90e25 100644 --- a/cpp/SampleCommands/SampleCommands.vcxproj.filters +++ b/cpp/SampleCommands/SampleCommands.vcxproj.filters @@ -861,6 +861,9 @@ Source Files + + Source Files + @@ -899,6 +902,9 @@ Header Files + + Header Files + diff --git a/cpp/SampleCommands/SampleFunctions.cpp b/cpp/SampleCommands/SampleFunctions.cpp index eb25bfa6..a8b82018 100644 --- a/cpp/SampleCommands/SampleFunctions.cpp +++ b/cpp/SampleCommands/SampleFunctions.cpp @@ -26,6 +26,35 @@ double ON_CurveTorsion(const ON_Curve& curve, double t) return tau; } +/// +/// Create a blend curve with G0 continuity between two existing curves. +/// +/// Curve to blend from (blending will occur at curve end point). +/// Curve to blend to (blending will occur at curve start point). +/// An ON_Curve representing the blend between A and B. +/// +/// CRITICAL: Memory for the resulting curve is allocated. It is the calling +/// functions responsibility to clean up the memory. +/// +ON_Curve* ON_BlendG0Curve( + const ON_Curve* crvA, + const ON_Curve* crvB + ) +{ + ON_Curve* rc = nullptr; + if (crvA && !crvA->IsClosed() && crvB && !crvB->IsClosed()) + { + double ta = crvA->Domain().Max(); + double tb = crvB->Domain().Min(); + + ON_3dPoint A = crvA->PointAt(ta); + ON_3dPoint B = crvB->PointAt(tb); + + rc = new ON_LineCurve(A, B); + } + return rc; +} + /// /// Create a blend curve with G1 continuity between two existing curves. /// @@ -46,7 +75,7 @@ ON_Curve* ON_BlendG1Curve( ) { ON_Curve* rc = nullptr; - if (crvA && crvB) + if (crvA && !crvA->IsClosed() && crvB && !crvB->IsClosed()) { double ta = crvA->Domain().Max(); double tb = crvB->Domain().Min(); @@ -101,7 +130,7 @@ ON_Curve* ON_BlendG2Curve( ) { ON_Curve* rc = nullptr; - if (crvA && crvB) + if (crvA && !crvA->IsClosed() && crvB && !crvB->IsClosed()) { double ta = crvA->Domain().Max(); double tb = crvB->Domain().Min(); @@ -259,53 +288,6 @@ HBITMAP ON_ReadBitmapPreviewImage(const wchar_t* pszFilePath) return hBitmap; } -/// -/// CRhinoHatchPatternTable helpers for system hatch patterns -/// -class CRhinoHatchTableHelper -{ -public: - /// - /// Returns the Solid hatch pattern - /// - static const CRhinoHatchPattern* Solid(CRhinoHatchPatternTable& table); - /// - /// Returns the Hatch1 hatch pattern - /// - static const CRhinoHatchPattern* Hatch1(CRhinoHatchPatternTable& table); - /// - /// Returns the Hatch2 hatch pattern - /// - static const CRhinoHatchPattern* Hatch2(CRhinoHatchPatternTable& table); - /// - /// Returns the Hatch3 hatch pattern - /// - static const CRhinoHatchPattern* Hatch3(CRhinoHatchPatternTable& table); - /// - /// Returns the HatchDash hatch pattern - /// - static const CRhinoHatchPattern* HatchDash(CRhinoHatchPatternTable& table); - /// - /// Returns the Grid hatch pattern - /// - static const CRhinoHatchPattern* Grid(CRhinoHatchPatternTable& table); - /// - /// Returns the Grid60 hatch pattern - /// - static const CRhinoHatchPattern* Grid60(CRhinoHatchPatternTable& table); - /// - /// Returns the Plus hatch pattern - /// - static const CRhinoHatchPattern* Plus(CRhinoHatchPatternTable& table); - /// - /// Returns the Squares hatch pattern - /// - static const CRhinoHatchPattern* Squares(CRhinoHatchPatternTable& table); - -private: - static const CRhinoHatchPattern* FindOrCreateHatchPattern(CRhinoHatchPatternTable& table, const ON_HatchPattern& hatch_pattern); -}; - const CRhinoHatchPattern* CRhinoHatchTableHelper::Solid(CRhinoHatchPatternTable& table) { return FindOrCreateHatchPattern(table, CRhinoHatchPattern::Solid); @@ -367,7 +349,7 @@ const CRhinoHatchPattern* CRhinoHatchTableHelper::FindOrCreateHatchPattern(CRhin /// Returns true if Rhino was started as a standalone executable. /// Returns false if Rhino was started by some other application or process. /// -static bool IsRhinoRunningAsExe() +bool IsRhinoRunningAsExe() { bool rc = false; DWORD dwProcessId = ::GetCurrentProcessId(); @@ -390,7 +372,7 @@ static bool IsRhinoRunningAsExe() /// /// Returns true if Rhino has input focus. /// -static bool RhinoHasFocus() +bool RhinoHasFocus() { // Retrieves a handle to the foreground window HWND hWnd = ::GetForegroundWindow(); diff --git a/cpp/SampleCommands/cmdSampleBlendCurve.cpp b/cpp/SampleCommands/cmdSampleBlendCurve.cpp new file mode 100644 index 00000000..457a865a --- /dev/null +++ b/cpp/SampleCommands/cmdSampleBlendCurve.cpp @@ -0,0 +1,523 @@ +#include "stdafx.h" + +/// +/// CSampleBlendCurveConduit display conduit class +/// +class CSampleBlendCurveConduit : public CRhinoDisplayConduit +{ +public: + CSampleBlendCurveConduit(); + bool ExecConduit(CRhinoDisplayPipeline& dp, UINT nChannel, bool& bTerminate) override; + void SetCurve(const ON_Curve* curve); + +private: + const ON_Curve* m_curve = nullptr; + ON_Color m_color; +}; + +CSampleBlendCurveConduit::CSampleBlendCurveConduit() + : CRhinoDisplayConduit(CSupportChannels::SC_CALCBOUNDINGBOX | CSupportChannels::SC_DRAWOVERLAY) +{ + m_color = RhinoApp().AppSettings().ActiveLayerColor(); +} + +void CSampleBlendCurveConduit::SetCurve(const ON_Curve* curve) +{ + m_curve = curve; +} + +bool CSampleBlendCurveConduit::ExecConduit(CRhinoDisplayPipeline& dp, UINT nActiveChannel, bool&) +{ + if (nActiveChannel == CSupportChannels::SC_CALCBOUNDINGBOX) + { + if (nullptr != m_curve) + m_pChannelAttrs->m_BoundingBox.Union(m_curve->BoundingBox()); + } + else if (nActiveChannel == CSupportChannels::SC_DRAWOVERLAY) + { + if (nullptr != m_curve) + dp.DrawCurve(*m_curve, m_color); + } + return true; +} + + +/// +/// Blend continuity types +/// +enum class BlendContinuity : unsigned char +{ + /// + /// G0: The curves or surfaces touch at the join point (position). + /// + Position = 0, + /// + /// G1: The curves or surfaces also share a common tangent direction at the join point (tangent). + /// + Tangency = 1, + /// + /// G2: The curves or surfaces also share a common center of curvature at the join point (curvature). + /// + Curvature = 2 +}; + +static BlendContinuity BlendContinuityFromUnsigned(unsigned int continuity_as_unsigned) +{ + switch (continuity_as_unsigned) + { + ON_ENUM_FROM_UNSIGNED_CASE(BlendContinuity::Position); + ON_ENUM_FROM_UNSIGNED_CASE(BlendContinuity::Tangency); + ON_ENUM_FROM_UNSIGNED_CASE(BlendContinuity::Curvature); + } + return BlendContinuity::Position; +} + + +/// +/// CSampleBlendCurveHelper blend curve helper class +/// +class CSampleBlendCurveHelper +{ +public: + CSampleBlendCurveHelper() = default; + ~CSampleBlendCurveHelper(); + + bool IsValid() const; + bool ComputeBlendCurve(); + + const ON_Curve* GetBlendCurve() const; + ON_Curve* DetachBlendCurve(); + void DestroyBlendCurve(); + +public: + CRhinoObjRef m_curveRefA; + CRhinoObjRef m_curveRefB; + BlendContinuity m_continuity = BlendContinuity::Position; + double m_bulgeA = 1.0; + double m_bulgeB = 1.0; + +private: + ON_Curve* m_blend_curve = nullptr; +}; + +CSampleBlendCurveHelper::~CSampleBlendCurveHelper() +{ + DestroyBlendCurve(); +} + +void CSampleBlendCurveHelper::DestroyBlendCurve() +{ + if (nullptr != m_blend_curve) + { + delete m_blend_curve; + m_blend_curve = nullptr; + } +} + +bool CSampleBlendCurveHelper::IsValid() const +{ + const ON_Curve* curveA = m_curveRefA.Curve(); + const ON_Curve* curveB = m_curveRefB.Curve(); + if ( + nullptr != curveA + && !curveA->IsClosed() + && nullptr != curveB + && !curveB->IsClosed() + ) + return true; + return false; +} + +bool CSampleBlendCurveHelper::ComputeBlendCurve() +{ + DestroyBlendCurve(); + + const ON_Curve* curveA = m_curveRefA.Curve(); + const ON_Curve* curveB = m_curveRefB.Curve(); + if (nullptr != curveA && nullptr != curveB) + { + // Simple curve blending routines, assume curves are in order. + // You can also use RhinoSdkBlend::CurveBlend, but it will require + // updating this class and the command history record. + switch (m_continuity) + { + case BlendContinuity::Position: + m_blend_curve = ON_BlendG0Curve(curveA, curveB); + break; + case BlendContinuity::Tangency: + m_blend_curve = ON_BlendG1Curve(curveA, curveB, m_bulgeA, m_bulgeB); + break; + case BlendContinuity::Curvature: + m_blend_curve = ON_BlendG2Curve(curveA, curveB, m_bulgeA, m_bulgeB); + break; + } + } + + return (nullptr != m_blend_curve); +} + +const ON_Curve* CSampleBlendCurveHelper::GetBlendCurve() const +{ + return m_blend_curve; +} + +ON_Curve* CSampleBlendCurveHelper::DetachBlendCurve() +{ + if (nullptr != m_blend_curve) + { + // caller now own pointer + ON_Curve* curve = m_blend_curve; + m_blend_curve = nullptr; + return curve; + } + return nullptr; +} + + +/// +/// CGetSampleBlendCurve object getting class +/// +class CGetSampleBlendCurve : public CRhinoGetObject +{ +public: + CGetSampleBlendCurve() = default; + ~CGetSampleBlendCurve() = default; + + bool CustomGeometryFilter( + const CRhinoObject* object, + const ON_Geometry* geometry, + ON_COMPONENT_INDEX component_index + ) const override; +}; + + +/// +/// SampleBlendCurve command class +/// +class CCommandSampleBlendCurve : public CRhinoCommand +{ +public: + CCommandSampleBlendCurve() = default; + UUID CommandUUID() override + { + // {4E602038-AEB3-42D4-A567-3A2625B91BBB} + static const GUID SampleBlendCurveCommand_UUID = + { 0x4E602038, 0xAEB3, 0x42D4, { 0xA5, 0x67, 0x3A, 0x26, 0x25, 0xB9, 0x1B, 0xBB } }; + return SampleBlendCurveCommand_UUID; + } + const wchar_t* EnglishCommandName() override { return L"SampleBlendCurve"; } + CRhinoCommand::result RunCommand(const CRhinoCommandContext& context) override; + CRhinoObject* ReplayHistory(const CRhinoHistoryRecord& history_record) override; + + bool HasSampleBlendSurfaceHistory(const CRhinoObject* object); + +private: + CRhinoCommand::result EditBlendCurve(const CRhinoCommandContext& context, CSampleBlendCurveHelper& helper); + CRhinoCommand::result EditCommandOption(const CRhinoCommandContext& context); + + bool WriteHistory(CRhinoHistory& history, const CSampleBlendCurveHelper& helper) const; + bool ReadHistory(const CRhinoHistoryRecord& history_record, CSampleBlendCurveHelper& helper) const; + + void GetPersistentSettings(CSampleBlendCurveHelper& helper); + void SetPersistentSettings(const CSampleBlendCurveHelper& helper); + +private: + const int m_history_version = 20240918; +}; + +// The one and only CCommandSampleBlendCurve object +static class CCommandSampleBlendCurve theSampleBlendCurveCommand; + +CRhinoCommand::result CCommandSampleBlendCurve::RunCommand(const CRhinoCommandContext& context) +{ + CSampleBlendCurveHelper helper; + + CRhinoGetObject go; + go.SetCommandPrompt(L"Select curve to blend"); + go.SetGeometryFilter(CRhinoGetObject::curve_object); + go.SetGeometryAttributeFilter(CRhinoGetObject::open_curve); + go.EnableSubObjectSelect(false); + go.AddCommandOption(RHCMDOPTNAME(L"Edit")); + + CRhinoGet::result res = go.GetObjects(1, 1); + if (res == CRhinoGet::option) + return EditCommandOption(context); + else if (res != CRhinoGet::object) + return CRhinoCommand::cancel; + + helper.m_curveRefA = go.Object(0); + + go.ClearCommandOptions(); + go.EnablePreSelect(false, true); + go.EnableDeselectAllBeforePostSelect(false); + go.GetObjects(1, 1); + if (go.CommandResult() != CRhinoCommand::success) + return go.CommandResult(); + + helper.m_curveRefB = go.Object(0); + + if (!helper.IsValid()) + return CRhinoCommand::failure; + + GetPersistentSettings(helper); + + CRhinoCommand::result rc = EditBlendCurve(context, helper); + if (rc == CRhinoCommand::success) + { + // One final compute + if (helper.ComputeBlendCurve()) + { + ON_Curve* curve = helper.DetachBlendCurve(); + if (curve) + { + CRhinoCurveObject* curve_obj = new CRhinoCurveObject(); + curve_obj->SetCurve(curve); + + CRhinoHistory history(*this); + WriteHistory(history, helper); + + context.m_doc.m_history_record_table.CreateObjectHistory(curve_obj, history); + context.m_doc.AddObject(curve_obj); + + SetPersistentSettings(helper); + } + } + } + + context.m_doc.Redraw(); + + return CRhinoCommand::success; +} + +CRhinoCommand::result CCommandSampleBlendCurve::EditBlendCurve(const CRhinoCommandContext& context, CSampleBlendCurveHelper& helper) +{ + if (!helper.IsValid()) + return CRhinoCommand::failure; + + CRhinoCommandOptionValue list[3] = { RHCMDOPTVALUE(L"Position"), RHCMDOPTVALUE(L"Tangency"), RHCMDOPTVALUE(L"Curvature") }; + + CSampleBlendCurveConduit conduit; + conduit.Enable(context.m_rhino_doc_sn); + + CRhinoGetOption go; + go.SetCommandPrompt(L"Blend curve options"); + go.AcceptNothing(); + + CRhinoCommand::result rc = CRhinoCommand::success; + + while (true) + { + helper.ComputeBlendCurve(); + conduit.SetCurve(helper.GetBlendCurve()); + context.m_doc.Redraw(); + + go.ClearCommandOptions(); + int c_index = go.AddCommandOptionList(RHCMDOPTNAME(L"Continuity"), _countof(list), list, (int)helper.m_continuity); + int a_index = -1; + int b_index = -2; + if (helper.m_continuity != BlendContinuity::Position) + { + a_index = go.AddCommandOptionNumber(RHCMDOPTNAME(L"BulgeA"), &helper.m_bulgeA, L"New bulge value", false, 0.0); + b_index = go.AddCommandOptionNumber(RHCMDOPTNAME(L"BulgeB"), &helper.m_bulgeB, L"New bulge value", false, 0.0); + } + + CRhinoGet::result res = go.GetOption(); + if (res == CRhinoGet::nothing) + break; + + else if (res != CRhinoGet::option) + { + rc = CRhinoCommand::cancel; + break; + } + + const CRhinoCommandOption* command_option = go.Option(); + if (nullptr == command_option) + { + rc = CRhinoCommand::failure; + break; + } + + const int option_index = command_option->m_option_index; + if (option_index == c_index) + helper.m_continuity = BlendContinuityFromUnsigned(command_option->m_list_option_current); + + // other options modify helper values directly + + continue; + } + + conduit.Disable(); + + return rc; +} + +bool CGetSampleBlendCurve::CustomGeometryFilter(const CRhinoObject* object, const ON_Geometry*, ON_COMPONENT_INDEX) const +{ + return theSampleBlendCurveCommand.HasSampleBlendSurfaceHistory(object); +} + +CRhinoCommand::result CCommandSampleBlendCurve::EditCommandOption(const CRhinoCommandContext& context) +{ + CGetSampleBlendCurve go; + go.SetCommandPrompt(L"Select blend curve to edit"); + go.SetGeometryFilter(CRhinoGetObject::curve_object); + go.EnableSubObjectSelect(false); + go.GetObjects(1, 1); + if (go.CommandResult() != CRhinoCommand::success) + return go.CommandResult(); + + const CRhinoObjRef objref = go.Object(0); + const CRhinoObject* object = objref.Object(); + if (!HasSampleBlendSurfaceHistory(object)) + return CRhinoCommand::failure; + + const CRhinoHistoryRecord* history_record = object->HistoryRecord(); + if (nullptr == history_record) + { + RhinoApp().Print(L"Error retrieving %ls history record.\n", EnglishCommandName()); + return CRhinoCommand::failure; + } + + CSampleBlendCurveHelper helper; + if (!ReadHistory(*history_record, helper)) + { + RhinoApp().Print(L"Error reading %ls history record.\n", EnglishCommandName()); + return CRhinoCommand::failure; + } + + CRhinoHistoryManager* history_manager = RhinoHistoryManager(); + bool bLocking = history_manager->HistoryObjectLockingEnabled(); + if (bLocking) + history_manager->EnableHistoryObjectLocking(false); + + CRhinoCommand::result rc = EditBlendCurve(context, helper); + if (rc == CRhinoCommand::success) + { + // One final compute + if (helper.ComputeBlendCurve()) + { + ON_Curve* curve = helper.DetachBlendCurve(); + if (curve) + { + CRhinoCurveObject* curve_obj = new CRhinoCurveObject(); + curve_obj->SetCurve(curve); + + // Always record history for editing + bool bRecording = history_manager->HistoryRecordingEnabled(); + history_manager->EnableHistoryRecording(true); + + CRhinoHistory history(*this); + WriteHistory(history, helper); + + context.m_doc.m_history_record_table.CreateObjectHistory(curve_obj, history); + context.m_doc.ReplaceObject(object, curve_obj); + + history_manager->EnableHistoryRecording(bRecording); + } + } + } + + history_manager->EnableHistoryObjectLocking(bLocking); + + context.m_doc.Redraw(); + + return rc; +} + +CRhinoObject* CCommandSampleBlendCurve::ReplayHistory(const CRhinoHistoryRecord& history_record) +{ + if (m_history_version != history_record.HistoryVersion()) + return nullptr; + + CRhinoCurveObject* curve_obj = nullptr; + + CSampleBlendCurveHelper helper; + if (ReadHistory(history_record, helper)) + { + if (helper.ComputeBlendCurve()) + { + ON_Curve* curve = helper.DetachBlendCurve(); + if (curve) + { + curve_obj = new CRhinoCurveObject(); + curve_obj->SetCurve(curve); + } + } + } + + return curve_obj; +} + +bool CCommandSampleBlendCurve::WriteHistory(CRhinoHistory& history, const CSampleBlendCurveHelper& helper) const +{ + bool rc = history.SetHistoryVersion(m_history_version); + if (rc) + rc = history.SetObjRefValue(1, helper.m_curveRefA); + if (rc) + rc = history.SetObjRefValue(2, helper.m_curveRefB); + if (rc) + rc = history.SetIntValue(3, (int)helper.m_continuity); + if (rc) + rc = history.SetDoubleValue(4, helper.m_bulgeA); + if (rc) + rc = history.SetDoubleValue(5, helper.m_bulgeB); + return rc; +} + +bool CCommandSampleBlendCurve::ReadHistory(const CRhinoHistoryRecord& history_record, CSampleBlendCurveHelper& helper) const +{ + bool rc = m_history_version == history_record.HistoryVersion(); + if (rc) + rc = history_record.m_hr.GetObjRefValue(1, helper.m_curveRefA); + if (rc) + rc = history_record.m_hr.GetObjRefValue(2, helper.m_curveRefB); + if (rc) + { + int continuity = (int)BlendContinuity::Position; + rc = history_record.m_hr.GetIntValue(3, &continuity); + if (rc) + helper.m_continuity = BlendContinuityFromUnsigned(continuity); + } + if (rc) + rc = history_record.m_hr.GetDoubleValue(4, &helper.m_bulgeA); + if (rc) + rc = history_record.m_hr.GetDoubleValue(5, &helper.m_bulgeB); + return rc; +} + +void CCommandSampleBlendCurve::GetPersistentSettings(CSampleBlendCurveHelper& helper) +{ + int continuity = (int)BlendContinuity::Position; + Settings().GetInteger(L"continuity", continuity, (int)BlendContinuity::Position); + helper.m_continuity = BlendContinuityFromUnsigned(continuity); + + Settings().GetDouble(L"bulgeA", helper.m_bulgeA, 1.0); + Settings().GetDouble(L"bulgeB", helper.m_bulgeB, 1.0); +} + +void CCommandSampleBlendCurve::SetPersistentSettings(const CSampleBlendCurveHelper& helper) +{ + Settings().SetInteger(L"continuity", (int)helper.m_continuity); + Settings().SetDouble(L"bulgeA", helper.m_bulgeA); + Settings().SetDouble(L"bulgeB", helper.m_bulgeB); +} + +bool CCommandSampleBlendCurve::HasSampleBlendSurfaceHistory(const CRhinoObject* object) +{ + const CRhinoCurveObject* curve_obj = CRhinoCurveObject::Cast(object); + if (nullptr != curve_obj) + { + const CRhinoHistoryRecord* history_record = curve_obj->HistoryRecord(); + if (nullptr != history_record) + { + if (m_history_version == history_record->HistoryVersion()) + { + CRhinoCommand* command = history_record->Command(); + if (command == this) + return true; + } + } + } + return false; +} diff --git a/cpp/SampleCommands/stdafx.h b/cpp/SampleCommands/stdafx.h index c253b6df..ddbc6461 100644 --- a/cpp/SampleCommands/stdafx.h +++ b/cpp/SampleCommands/stdafx.h @@ -54,10 +54,8 @@ #include // MFC support for Windows Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT - // TODO: include additional commonly used header files here - #if defined(_M_X64) && defined(WIN32) && defined(WIN64) // The afxwin.h includes afx.h, which includes afxver_.h, // which unconditionally defines WIN32 This is a bug. @@ -74,6 +72,8 @@ // Rhino Render Development Kit (RDK) classes #include "RhRdkHeaders.h" +#include "SampleFunctions.h" + #if defined(RHINO_DEBUG_PLUGIN) // Now that all the system headers are read, we can // safely define _DEBUG so the developers can test From 1596dd0e2e4f0848a9e737069c3e5507c422a503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E6=B0=B4?= <53346444+ArchiDog1998@users.noreply.github.com> Date: Thu, 26 Sep 2024 10:17:13 +0800 Subject: [PATCH 12/14] fix: DisplayConduit Boundingbox including fix. --- rhinocommon/snippets/cs/display-conduit.cs | 2 +- rhinocommon/snippets/cs/draw-mesh.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rhinocommon/snippets/cs/display-conduit.cs b/rhinocommon/snippets/cs/display-conduit.cs index f2d9fa03..e5101204 100644 --- a/rhinocommon/snippets/cs/display-conduit.cs +++ b/rhinocommon/snippets/cs/display-conduit.cs @@ -23,7 +23,7 @@ class MyConduit : Rhino.Display.DisplayConduit protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e) { base.CalculateBoundingBox(e); - e.BoundingBox.Union(e.Display.Viewport.ConstructionPlane().Origin); + e.IncludeBoundingBox(e.Display.Viewport.ConstructionPlane().Origin); } protected override void PreDrawObjects(DrawEventArgs e) diff --git a/rhinocommon/snippets/cs/draw-mesh.cs b/rhinocommon/snippets/cs/draw-mesh.cs index 6a1a54b5..7e81d162 100644 --- a/rhinocommon/snippets/cs/draw-mesh.cs +++ b/rhinocommon/snippets/cs/draw-mesh.cs @@ -64,7 +64,7 @@ protected override void CalculateBoundingBox(CalculateBoundingBoxEventArgs e) // dynamically drawing geometry would get clipped. // Union the mesh's bbox with the scene's bounding box - e.BoundingBox.Union(m_bbox); + e.IncludeBoundingBox(m_bbox); } protected override void PreDrawObjects(DrawEventArgs e) From 1e1f662709a5a23d7b9b231744397f1474961cd1 Mon Sep 17 00:00:00 2001 From: Dale Fugier Date: Wed, 2 Oct 2024 14:35:06 -0700 Subject: [PATCH 13/14] 2-Oct-2024 --- cpp/SampleCommands/SampleFunctions.h | 158 ++++++++++++++++ .../cmdSampleAddNurbsCircle.cpp | 13 +- cpp/SamplesCpp.sln | 174 ++++++++++++++++++ 3 files changed, 343 insertions(+), 2 deletions(-) create mode 100644 cpp/SampleCommands/SampleFunctions.h diff --git a/cpp/SampleCommands/SampleFunctions.h b/cpp/SampleCommands/SampleFunctions.h new file mode 100644 index 00000000..41740fce --- /dev/null +++ b/cpp/SampleCommands/SampleFunctions.h @@ -0,0 +1,158 @@ +#pragma once + +/// +/// Evaluate torsion of a curve at a parmeter. +/// +/// Curve to evaluate. +/// Evaluation parameter. +/// The torsion if successful. +/// See Barrett O'Neill, Elementary Differential Geometry, page 69. +double ON_CurveTorsion(const ON_Curve& curve, double t); + +/// +/// Create a blend curve with G0 continuity between two existing curves. +/// +/// Curve to blend from (blending will occur at curve end point). +/// Curve to blend to (blending will occur at curve start point). +/// An ON_Curve representing the blend between A and B. +/// +/// CRITICAL: Memory for the resulting curve is allocated. It is the calling +/// functions responsibility to clean up the memory. +/// +ON_Curve* ON_BlendG0Curve( + const ON_Curve* crvA, + const ON_Curve* crvB +); + +/// +/// Create a blend curve with G1 continuity between two existing curves. +/// +/// Curve to blend from (blending will occur at curve end point). +/// Curve to blend to (blending will occur at curve start point). +/// Bulge factor at curveA end of blend. Values near 1.0 work best. +/// Bulge factor at curveB end of blend. Values near 1.0 work best. +/// An ON_Curve representing the blend between A and B. +/// +/// CRITICAL: Memory for the resulting curve is allocated. It is the calling +/// functions responsibility to clean up the memory. +/// +ON_Curve* ON_BlendG1Curve( + const ON_Curve* crvA, + const ON_Curve* crvB, + double bulgeA, + double bulgeB +); + +/// +/// Create a blend curve with G2 continuity between two existing curves. +/// +/// Curve to blend from (blending will occur at curve end point). +/// Curve to blend to (blending will occur at curve start point). +/// Bulge factor at curveA end of blend. Values near 1.0 work best. +/// Bulge factor at curveB end of blend. Values near 1.0 work best. +/// An ON_Curve representing the blend between A and B. +/// +/// CRITICAL: Memory for the resulting curve is allocated. It is the calling +/// functions responsibility to clean up the memory. +/// +ON_Curve* ON_BlendG2Curve( + const ON_Curve* crvA, + const ON_Curve* crvB, + double bulgeA, + double bulgeB +); + +/// +/// Get the BRep definition of a trimmed surface. +/// +/// Surface that will be trimmed. +/// +/// Closed, 2d parameter space boundary curve that defines the +/// outer boundary of the trimmed surface. +/// +/// Tolerance for fitting 3d edge curves. +/// +/// An ON_Brep representation of the trimmed surface with a single face. +/// +/// +/// CRITICAL: Memory for the resulting BRep is allocated. It is the calling +/// functions responsibility to clean up the memory. +/// +ON_Brep* ON_BrepFromSurfaceAndBoundary( + const ON_Surface& srf, + const ON_Curve& crv2d, + double tol +); + +/// +/// Returns the bitmap preview image from a 3dm file. +/// +/// The full path to the 3dm file. +/// An HBITMAP if successful, or nullptr if the 3dm file does not +/// contain a preview image or if there was an error reading the file. +/// +/// +/// CRITICAL: Memory for the bitmap is allocated. It is the calling +/// functions responsibility to clean up the memory by calling the +/// Win32 DeleteObject() function. +/// +HBITMAP ON_ReadBitmapPreviewImage(const wchar_t* pszFilePath); + +/// +/// CRhinoHatchPatternTable helpers for system hatch patterns +/// +class CRhinoHatchTableHelper +{ +public: + /// + /// Returns the Solid hatch pattern + /// + static const CRhinoHatchPattern* Solid(CRhinoHatchPatternTable& table); + /// + /// Returns the Hatch1 hatch pattern + /// + static const CRhinoHatchPattern* Hatch1(CRhinoHatchPatternTable& table); + /// + /// Returns the Hatch2 hatch pattern + /// + static const CRhinoHatchPattern* Hatch2(CRhinoHatchPatternTable& table); + /// + /// Returns the Hatch3 hatch pattern + /// + static const CRhinoHatchPattern* Hatch3(CRhinoHatchPatternTable& table); + /// + /// Returns the HatchDash hatch pattern + /// + static const CRhinoHatchPattern* HatchDash(CRhinoHatchPatternTable& table); + /// + /// Returns the Grid hatch pattern + /// + static const CRhinoHatchPattern* Grid(CRhinoHatchPatternTable& table); + /// + /// Returns the Grid60 hatch pattern + /// + static const CRhinoHatchPattern* Grid60(CRhinoHatchPatternTable& table); + /// + /// Returns the Plus hatch pattern + /// + static const CRhinoHatchPattern* Plus(CRhinoHatchPatternTable& table); + /// + /// Returns the Squares hatch pattern + /// + static const CRhinoHatchPattern* Squares(CRhinoHatchPatternTable& table); + +private: + static const CRhinoHatchPattern* FindOrCreateHatchPattern(CRhinoHatchPatternTable& table, const ON_HatchPattern& hatch_pattern); +}; + + +/// +/// Returns true if Rhino was started as a standalone executable. +/// Returns false if Rhino was started by some other application or process. +/// +bool IsRhinoRunningAsExe(); + +/// +/// Returns true if Rhino has input focus. +/// +bool RhinoHasFocus(); diff --git a/cpp/SampleCommands/cmdSampleAddNurbsCircle.cpp b/cpp/SampleCommands/cmdSampleAddNurbsCircle.cpp index b0271d04..9a812f8c 100644 --- a/cpp/SampleCommands/cmdSampleAddNurbsCircle.cpp +++ b/cpp/SampleCommands/cmdSampleAddNurbsCircle.cpp @@ -33,12 +33,20 @@ CRhinoCommand::result CCommandSampleAddNurbsCircle::RunCommand(const CRhinoComma if (nullptr == doc) return CRhinoCommand::failure; + // Specify dimension, degree and number of control points. + // The degree must be >= 1 and the number of control points + // must be >= (degree+1). The number of knots is always + // (number of control points + degree - 1). int dimension = 3; - BOOL bIsRational = TRUE; - int order = 3; // order = degree + 1 + bool bIsRational = true; + int degree = 2; + int order = degree + 1; int cv_count = 9; + int knot_count = cv_count + degree - 1; + // Make a rational, degree 2 NURBS curve with 9 control points ON_NurbsCurve nc(dimension, bIsRational, order, cv_count); + // Set the control points nc.SetCV(0, ON_4dPoint(1.0, 0.0, 0.0, 1.0)); nc.SetCV(1, ON_4dPoint(0.707107, 0.707107, 0.0, 0.707107)); nc.SetCV(2, ON_4dPoint(0.0, 1.0, 0.0, 1.0)); @@ -48,6 +56,7 @@ CRhinoCommand::result CCommandSampleAddNurbsCircle::RunCommand(const CRhinoComma nc.SetCV(6, ON_4dPoint(0.0, -1.0, 0.0, 1.0)); nc.SetCV(7, ON_4dPoint(0.707107, -0.707107, 0.0, 0.707107)); nc.SetCV(8, ON_4dPoint(1.0, 0.0, 0.0, 1.0)); + // Set the 10 knots nc.SetKnot(0, 0.0); nc.SetKnot(1, 0.0); nc.SetKnot(2, 0.5*ON_PI); diff --git a/cpp/SamplesCpp.sln b/cpp/SamplesCpp.sln index c6027c8a..bb82ae57 100644 --- a/cpp/SamplesCpp.sln +++ b/cpp/SamplesCpp.sln @@ -122,180 +122,354 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleRdkMaterialPreview", EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|x64 = Debug|x64 + Release|Any CPU = Release|Any CPU Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2AE01DAD-D283-4ADA-861C-6F0B2BFAF11C}.Debug|Any CPU.ActiveCfg = Debug|x64 + {2AE01DAD-D283-4ADA-861C-6F0B2BFAF11C}.Debug|Any CPU.Build.0 = Debug|x64 {2AE01DAD-D283-4ADA-861C-6F0B2BFAF11C}.Debug|x64.ActiveCfg = Debug|x64 {2AE01DAD-D283-4ADA-861C-6F0B2BFAF11C}.Debug|x64.Build.0 = Debug|x64 + {2AE01DAD-D283-4ADA-861C-6F0B2BFAF11C}.Release|Any CPU.ActiveCfg = Release|x64 + {2AE01DAD-D283-4ADA-861C-6F0B2BFAF11C}.Release|Any CPU.Build.0 = Release|x64 {2AE01DAD-D283-4ADA-861C-6F0B2BFAF11C}.Release|x64.ActiveCfg = Release|x64 {2AE01DAD-D283-4ADA-861C-6F0B2BFAF11C}.Release|x64.Build.0 = Release|x64 + {D2D3B9EF-207B-42B9-9E55-6DE168CB3B91}.Debug|Any CPU.ActiveCfg = Debug|x64 + {D2D3B9EF-207B-42B9-9E55-6DE168CB3B91}.Debug|Any CPU.Build.0 = Debug|x64 {D2D3B9EF-207B-42B9-9E55-6DE168CB3B91}.Debug|x64.ActiveCfg = Debug|x64 {D2D3B9EF-207B-42B9-9E55-6DE168CB3B91}.Debug|x64.Build.0 = Debug|x64 + {D2D3B9EF-207B-42B9-9E55-6DE168CB3B91}.Release|Any CPU.ActiveCfg = Release|x64 + {D2D3B9EF-207B-42B9-9E55-6DE168CB3B91}.Release|Any CPU.Build.0 = Release|x64 {D2D3B9EF-207B-42B9-9E55-6DE168CB3B91}.Release|x64.ActiveCfg = Release|x64 {D2D3B9EF-207B-42B9-9E55-6DE168CB3B91}.Release|x64.Build.0 = Release|x64 + {4217A2FA-B42F-4713-ABA9-4DB1E4D76D20}.Debug|Any CPU.ActiveCfg = Debug|x64 + {4217A2FA-B42F-4713-ABA9-4DB1E4D76D20}.Debug|Any CPU.Build.0 = Debug|x64 {4217A2FA-B42F-4713-ABA9-4DB1E4D76D20}.Debug|x64.ActiveCfg = Debug|x64 {4217A2FA-B42F-4713-ABA9-4DB1E4D76D20}.Debug|x64.Build.0 = Debug|x64 + {4217A2FA-B42F-4713-ABA9-4DB1E4D76D20}.Release|Any CPU.ActiveCfg = Release|x64 + {4217A2FA-B42F-4713-ABA9-4DB1E4D76D20}.Release|Any CPU.Build.0 = Release|x64 {4217A2FA-B42F-4713-ABA9-4DB1E4D76D20}.Release|x64.ActiveCfg = Release|x64 {4217A2FA-B42F-4713-ABA9-4DB1E4D76D20}.Release|x64.Build.0 = Release|x64 + {FE725F68-0E5C-44D0-A3E0-C2AF42DF09DA}.Debug|Any CPU.ActiveCfg = Debug|x64 + {FE725F68-0E5C-44D0-A3E0-C2AF42DF09DA}.Debug|Any CPU.Build.0 = Debug|x64 {FE725F68-0E5C-44D0-A3E0-C2AF42DF09DA}.Debug|x64.ActiveCfg = Debug|x64 {FE725F68-0E5C-44D0-A3E0-C2AF42DF09DA}.Debug|x64.Build.0 = Debug|x64 + {FE725F68-0E5C-44D0-A3E0-C2AF42DF09DA}.Release|Any CPU.ActiveCfg = Release|x64 + {FE725F68-0E5C-44D0-A3E0-C2AF42DF09DA}.Release|Any CPU.Build.0 = Release|x64 {FE725F68-0E5C-44D0-A3E0-C2AF42DF09DA}.Release|x64.ActiveCfg = Release|x64 {FE725F68-0E5C-44D0-A3E0-C2AF42DF09DA}.Release|x64.Build.0 = Release|x64 + {D6CD6128-BFBB-447A-A791-456041EA91CF}.Debug|Any CPU.ActiveCfg = Debug|x64 + {D6CD6128-BFBB-447A-A791-456041EA91CF}.Debug|Any CPU.Build.0 = Debug|x64 {D6CD6128-BFBB-447A-A791-456041EA91CF}.Debug|x64.ActiveCfg = Debug|x64 {D6CD6128-BFBB-447A-A791-456041EA91CF}.Debug|x64.Build.0 = Debug|x64 + {D6CD6128-BFBB-447A-A791-456041EA91CF}.Release|Any CPU.ActiveCfg = Release|x64 + {D6CD6128-BFBB-447A-A791-456041EA91CF}.Release|Any CPU.Build.0 = Release|x64 {D6CD6128-BFBB-447A-A791-456041EA91CF}.Release|x64.ActiveCfg = Release|x64 {D6CD6128-BFBB-447A-A791-456041EA91CF}.Release|x64.Build.0 = Release|x64 + {BBA91EAD-30DF-4CCE-8E61-1B196B78BE8D}.Debug|Any CPU.ActiveCfg = Debug|x64 + {BBA91EAD-30DF-4CCE-8E61-1B196B78BE8D}.Debug|Any CPU.Build.0 = Debug|x64 {BBA91EAD-30DF-4CCE-8E61-1B196B78BE8D}.Debug|x64.ActiveCfg = Debug|x64 {BBA91EAD-30DF-4CCE-8E61-1B196B78BE8D}.Debug|x64.Build.0 = Debug|x64 + {BBA91EAD-30DF-4CCE-8E61-1B196B78BE8D}.Release|Any CPU.ActiveCfg = Release|x64 + {BBA91EAD-30DF-4CCE-8E61-1B196B78BE8D}.Release|Any CPU.Build.0 = Release|x64 {BBA91EAD-30DF-4CCE-8E61-1B196B78BE8D}.Release|x64.ActiveCfg = Release|x64 {BBA91EAD-30DF-4CCE-8E61-1B196B78BE8D}.Release|x64.Build.0 = Release|x64 + {A1C5D0C6-912D-4504-8426-3BF5D76F684F}.Debug|Any CPU.ActiveCfg = Debug|x64 + {A1C5D0C6-912D-4504-8426-3BF5D76F684F}.Debug|Any CPU.Build.0 = Debug|x64 {A1C5D0C6-912D-4504-8426-3BF5D76F684F}.Debug|x64.ActiveCfg = Debug|x64 {A1C5D0C6-912D-4504-8426-3BF5D76F684F}.Debug|x64.Build.0 = Debug|x64 + {A1C5D0C6-912D-4504-8426-3BF5D76F684F}.Release|Any CPU.ActiveCfg = Release|x64 + {A1C5D0C6-912D-4504-8426-3BF5D76F684F}.Release|Any CPU.Build.0 = Release|x64 {A1C5D0C6-912D-4504-8426-3BF5D76F684F}.Release|x64.ActiveCfg = Release|x64 {A1C5D0C6-912D-4504-8426-3BF5D76F684F}.Release|x64.Build.0 = Release|x64 + {A71676AB-7A9B-4AED-98A7-4E7FAD6A8A9D}.Debug|Any CPU.ActiveCfg = Debug|x64 + {A71676AB-7A9B-4AED-98A7-4E7FAD6A8A9D}.Debug|Any CPU.Build.0 = Debug|x64 {A71676AB-7A9B-4AED-98A7-4E7FAD6A8A9D}.Debug|x64.ActiveCfg = Debug|x64 {A71676AB-7A9B-4AED-98A7-4E7FAD6A8A9D}.Debug|x64.Build.0 = Debug|x64 + {A71676AB-7A9B-4AED-98A7-4E7FAD6A8A9D}.Release|Any CPU.ActiveCfg = Release|x64 + {A71676AB-7A9B-4AED-98A7-4E7FAD6A8A9D}.Release|Any CPU.Build.0 = Release|x64 {A71676AB-7A9B-4AED-98A7-4E7FAD6A8A9D}.Release|x64.ActiveCfg = Release|x64 {A71676AB-7A9B-4AED-98A7-4E7FAD6A8A9D}.Release|x64.Build.0 = Release|x64 + {71F7EB35-7C2D-4646-802C-066BB942A22C}.Debug|Any CPU.ActiveCfg = Debug|x64 + {71F7EB35-7C2D-4646-802C-066BB942A22C}.Debug|Any CPU.Build.0 = Debug|x64 {71F7EB35-7C2D-4646-802C-066BB942A22C}.Debug|x64.ActiveCfg = Debug|x64 {71F7EB35-7C2D-4646-802C-066BB942A22C}.Debug|x64.Build.0 = Debug|x64 + {71F7EB35-7C2D-4646-802C-066BB942A22C}.Release|Any CPU.ActiveCfg = Release|x64 + {71F7EB35-7C2D-4646-802C-066BB942A22C}.Release|Any CPU.Build.0 = Release|x64 {71F7EB35-7C2D-4646-802C-066BB942A22C}.Release|x64.ActiveCfg = Release|x64 {71F7EB35-7C2D-4646-802C-066BB942A22C}.Release|x64.Build.0 = Release|x64 + {0FD7F8DB-DCE7-4273-9858-B90DF4FF40EF}.Debug|Any CPU.ActiveCfg = Debug|x64 + {0FD7F8DB-DCE7-4273-9858-B90DF4FF40EF}.Debug|Any CPU.Build.0 = Debug|x64 {0FD7F8DB-DCE7-4273-9858-B90DF4FF40EF}.Debug|x64.ActiveCfg = Debug|x64 {0FD7F8DB-DCE7-4273-9858-B90DF4FF40EF}.Debug|x64.Build.0 = Debug|x64 + {0FD7F8DB-DCE7-4273-9858-B90DF4FF40EF}.Release|Any CPU.ActiveCfg = Release|x64 + {0FD7F8DB-DCE7-4273-9858-B90DF4FF40EF}.Release|Any CPU.Build.0 = Release|x64 {0FD7F8DB-DCE7-4273-9858-B90DF4FF40EF}.Release|x64.ActiveCfg = Release|x64 {0FD7F8DB-DCE7-4273-9858-B90DF4FF40EF}.Release|x64.Build.0 = Release|x64 + {1A7AD606-4B4C-495D-9489-A0EC2792B8EB}.Debug|Any CPU.ActiveCfg = Debug|x64 + {1A7AD606-4B4C-495D-9489-A0EC2792B8EB}.Debug|Any CPU.Build.0 = Debug|x64 {1A7AD606-4B4C-495D-9489-A0EC2792B8EB}.Debug|x64.ActiveCfg = Debug|x64 {1A7AD606-4B4C-495D-9489-A0EC2792B8EB}.Debug|x64.Build.0 = Debug|x64 + {1A7AD606-4B4C-495D-9489-A0EC2792B8EB}.Release|Any CPU.ActiveCfg = Release|x64 + {1A7AD606-4B4C-495D-9489-A0EC2792B8EB}.Release|Any CPU.Build.0 = Release|x64 {1A7AD606-4B4C-495D-9489-A0EC2792B8EB}.Release|x64.ActiveCfg = Release|x64 {1A7AD606-4B4C-495D-9489-A0EC2792B8EB}.Release|x64.Build.0 = Release|x64 + {EC5823AC-9513-4D9A-8181-D65744423FE4}.Debug|Any CPU.ActiveCfg = Debug|x64 + {EC5823AC-9513-4D9A-8181-D65744423FE4}.Debug|Any CPU.Build.0 = Debug|x64 {EC5823AC-9513-4D9A-8181-D65744423FE4}.Debug|x64.ActiveCfg = Debug|x64 {EC5823AC-9513-4D9A-8181-D65744423FE4}.Debug|x64.Build.0 = Debug|x64 + {EC5823AC-9513-4D9A-8181-D65744423FE4}.Release|Any CPU.ActiveCfg = Release|x64 + {EC5823AC-9513-4D9A-8181-D65744423FE4}.Release|Any CPU.Build.0 = Release|x64 {EC5823AC-9513-4D9A-8181-D65744423FE4}.Release|x64.ActiveCfg = Release|x64 {EC5823AC-9513-4D9A-8181-D65744423FE4}.Release|x64.Build.0 = Release|x64 + {BD73956A-3999-4DBC-9218-F92E37E4FC12}.Debug|Any CPU.ActiveCfg = Debug|x64 + {BD73956A-3999-4DBC-9218-F92E37E4FC12}.Debug|Any CPU.Build.0 = Debug|x64 {BD73956A-3999-4DBC-9218-F92E37E4FC12}.Debug|x64.ActiveCfg = Debug|x64 {BD73956A-3999-4DBC-9218-F92E37E4FC12}.Debug|x64.Build.0 = Debug|x64 + {BD73956A-3999-4DBC-9218-F92E37E4FC12}.Release|Any CPU.ActiveCfg = Release|x64 + {BD73956A-3999-4DBC-9218-F92E37E4FC12}.Release|Any CPU.Build.0 = Release|x64 {BD73956A-3999-4DBC-9218-F92E37E4FC12}.Release|x64.ActiveCfg = Release|x64 {BD73956A-3999-4DBC-9218-F92E37E4FC12}.Release|x64.Build.0 = Release|x64 + {8E416487-0251-4D48-84F0-C3876B2FFCAD}.Debug|Any CPU.ActiveCfg = Debug|x64 + {8E416487-0251-4D48-84F0-C3876B2FFCAD}.Debug|Any CPU.Build.0 = Debug|x64 {8E416487-0251-4D48-84F0-C3876B2FFCAD}.Debug|x64.ActiveCfg = Debug|x64 {8E416487-0251-4D48-84F0-C3876B2FFCAD}.Debug|x64.Build.0 = Debug|x64 + {8E416487-0251-4D48-84F0-C3876B2FFCAD}.Release|Any CPU.ActiveCfg = Release|x64 + {8E416487-0251-4D48-84F0-C3876B2FFCAD}.Release|Any CPU.Build.0 = Release|x64 {8E416487-0251-4D48-84F0-C3876B2FFCAD}.Release|x64.ActiveCfg = Release|x64 {8E416487-0251-4D48-84F0-C3876B2FFCAD}.Release|x64.Build.0 = Release|x64 + {EB107F20-8EA3-407E-987A-55CD1DCEECD2}.Debug|Any CPU.ActiveCfg = Debug|x64 + {EB107F20-8EA3-407E-987A-55CD1DCEECD2}.Debug|Any CPU.Build.0 = Debug|x64 {EB107F20-8EA3-407E-987A-55CD1DCEECD2}.Debug|x64.ActiveCfg = Debug|x64 {EB107F20-8EA3-407E-987A-55CD1DCEECD2}.Debug|x64.Build.0 = Debug|x64 + {EB107F20-8EA3-407E-987A-55CD1DCEECD2}.Release|Any CPU.ActiveCfg = Release|x64 + {EB107F20-8EA3-407E-987A-55CD1DCEECD2}.Release|Any CPU.Build.0 = Release|x64 {EB107F20-8EA3-407E-987A-55CD1DCEECD2}.Release|x64.ActiveCfg = Release|x64 {EB107F20-8EA3-407E-987A-55CD1DCEECD2}.Release|x64.Build.0 = Release|x64 + {995DF447-BC77-4EED-A8D4-FF43433F8D1E}.Debug|Any CPU.ActiveCfg = Debug|x64 + {995DF447-BC77-4EED-A8D4-FF43433F8D1E}.Debug|Any CPU.Build.0 = Debug|x64 {995DF447-BC77-4EED-A8D4-FF43433F8D1E}.Debug|x64.ActiveCfg = Debug|x64 {995DF447-BC77-4EED-A8D4-FF43433F8D1E}.Debug|x64.Build.0 = Debug|x64 + {995DF447-BC77-4EED-A8D4-FF43433F8D1E}.Release|Any CPU.ActiveCfg = Release|x64 + {995DF447-BC77-4EED-A8D4-FF43433F8D1E}.Release|Any CPU.Build.0 = Release|x64 {995DF447-BC77-4EED-A8D4-FF43433F8D1E}.Release|x64.ActiveCfg = Release|x64 {995DF447-BC77-4EED-A8D4-FF43433F8D1E}.Release|x64.Build.0 = Release|x64 + {3D211A2E-1483-4E5F-A14A-0EE2CA4BC05C}.Debug|Any CPU.ActiveCfg = Debug|x64 + {3D211A2E-1483-4E5F-A14A-0EE2CA4BC05C}.Debug|Any CPU.Build.0 = Debug|x64 {3D211A2E-1483-4E5F-A14A-0EE2CA4BC05C}.Debug|x64.ActiveCfg = Debug|x64 {3D211A2E-1483-4E5F-A14A-0EE2CA4BC05C}.Debug|x64.Build.0 = Debug|x64 + {3D211A2E-1483-4E5F-A14A-0EE2CA4BC05C}.Release|Any CPU.ActiveCfg = Release|x64 + {3D211A2E-1483-4E5F-A14A-0EE2CA4BC05C}.Release|Any CPU.Build.0 = Release|x64 {3D211A2E-1483-4E5F-A14A-0EE2CA4BC05C}.Release|x64.ActiveCfg = Release|x64 {3D211A2E-1483-4E5F-A14A-0EE2CA4BC05C}.Release|x64.Build.0 = Release|x64 + {B0312430-A5D6-4C50-92B8-B05E0656FEA4}.Debug|Any CPU.ActiveCfg = Debug|x64 + {B0312430-A5D6-4C50-92B8-B05E0656FEA4}.Debug|Any CPU.Build.0 = Debug|x64 {B0312430-A5D6-4C50-92B8-B05E0656FEA4}.Debug|x64.ActiveCfg = Debug|x64 {B0312430-A5D6-4C50-92B8-B05E0656FEA4}.Debug|x64.Build.0 = Debug|x64 + {B0312430-A5D6-4C50-92B8-B05E0656FEA4}.Release|Any CPU.ActiveCfg = Release|x64 + {B0312430-A5D6-4C50-92B8-B05E0656FEA4}.Release|Any CPU.Build.0 = Release|x64 {B0312430-A5D6-4C50-92B8-B05E0656FEA4}.Release|x64.ActiveCfg = Release|x64 {B0312430-A5D6-4C50-92B8-B05E0656FEA4}.Release|x64.Build.0 = Release|x64 + {77575B79-42FD-4456-9933-81784BD9A4A6}.Debug|Any CPU.ActiveCfg = Debug|x64 + {77575B79-42FD-4456-9933-81784BD9A4A6}.Debug|Any CPU.Build.0 = Debug|x64 {77575B79-42FD-4456-9933-81784BD9A4A6}.Debug|x64.ActiveCfg = Debug|x64 {77575B79-42FD-4456-9933-81784BD9A4A6}.Debug|x64.Build.0 = Debug|x64 + {77575B79-42FD-4456-9933-81784BD9A4A6}.Release|Any CPU.ActiveCfg = Release|x64 + {77575B79-42FD-4456-9933-81784BD9A4A6}.Release|Any CPU.Build.0 = Release|x64 {77575B79-42FD-4456-9933-81784BD9A4A6}.Release|x64.ActiveCfg = Release|x64 {77575B79-42FD-4456-9933-81784BD9A4A6}.Release|x64.Build.0 = Release|x64 + {8C7A0630-6197-48C8-9D13-21CAEDA0A9FB}.Debug|Any CPU.ActiveCfg = Debug|x64 + {8C7A0630-6197-48C8-9D13-21CAEDA0A9FB}.Debug|Any CPU.Build.0 = Debug|x64 {8C7A0630-6197-48C8-9D13-21CAEDA0A9FB}.Debug|x64.ActiveCfg = Debug|x64 {8C7A0630-6197-48C8-9D13-21CAEDA0A9FB}.Debug|x64.Build.0 = Debug|x64 + {8C7A0630-6197-48C8-9D13-21CAEDA0A9FB}.Release|Any CPU.ActiveCfg = Release|x64 + {8C7A0630-6197-48C8-9D13-21CAEDA0A9FB}.Release|Any CPU.Build.0 = Release|x64 {8C7A0630-6197-48C8-9D13-21CAEDA0A9FB}.Release|x64.ActiveCfg = Release|x64 {8C7A0630-6197-48C8-9D13-21CAEDA0A9FB}.Release|x64.Build.0 = Release|x64 + {F797EED0-4168-4B0A-956A-465B64CD4FCC}.Debug|Any CPU.ActiveCfg = Debug|x64 + {F797EED0-4168-4B0A-956A-465B64CD4FCC}.Debug|Any CPU.Build.0 = Debug|x64 {F797EED0-4168-4B0A-956A-465B64CD4FCC}.Debug|x64.ActiveCfg = Debug|x64 {F797EED0-4168-4B0A-956A-465B64CD4FCC}.Debug|x64.Build.0 = Debug|x64 + {F797EED0-4168-4B0A-956A-465B64CD4FCC}.Release|Any CPU.ActiveCfg = Release|x64 + {F797EED0-4168-4B0A-956A-465B64CD4FCC}.Release|Any CPU.Build.0 = Release|x64 {F797EED0-4168-4B0A-956A-465B64CD4FCC}.Release|x64.ActiveCfg = Release|x64 {F797EED0-4168-4B0A-956A-465B64CD4FCC}.Release|x64.Build.0 = Release|x64 + {D9106855-428A-428F-9588-9076DE1A1321}.Debug|Any CPU.ActiveCfg = Debug|x64 + {D9106855-428A-428F-9588-9076DE1A1321}.Debug|Any CPU.Build.0 = Debug|x64 {D9106855-428A-428F-9588-9076DE1A1321}.Debug|x64.ActiveCfg = Debug|x64 {D9106855-428A-428F-9588-9076DE1A1321}.Debug|x64.Build.0 = Debug|x64 + {D9106855-428A-428F-9588-9076DE1A1321}.Release|Any CPU.ActiveCfg = Release|x64 + {D9106855-428A-428F-9588-9076DE1A1321}.Release|Any CPU.Build.0 = Release|x64 {D9106855-428A-428F-9588-9076DE1A1321}.Release|x64.ActiveCfg = Release|x64 {D9106855-428A-428F-9588-9076DE1A1321}.Release|x64.Build.0 = Release|x64 + {9996042C-BA07-4F6F-88EF-D9C304B40A7D}.Debug|Any CPU.ActiveCfg = Debug|x64 + {9996042C-BA07-4F6F-88EF-D9C304B40A7D}.Debug|Any CPU.Build.0 = Debug|x64 {9996042C-BA07-4F6F-88EF-D9C304B40A7D}.Debug|x64.ActiveCfg = Debug|x64 {9996042C-BA07-4F6F-88EF-D9C304B40A7D}.Debug|x64.Build.0 = Debug|x64 + {9996042C-BA07-4F6F-88EF-D9C304B40A7D}.Release|Any CPU.ActiveCfg = Release|x64 + {9996042C-BA07-4F6F-88EF-D9C304B40A7D}.Release|Any CPU.Build.0 = Release|x64 {9996042C-BA07-4F6F-88EF-D9C304B40A7D}.Release|x64.ActiveCfg = Release|x64 {9996042C-BA07-4F6F-88EF-D9C304B40A7D}.Release|x64.Build.0 = Release|x64 + {F24371C6-7DD7-4208-B6D4-D652F0DE434A}.Debug|Any CPU.ActiveCfg = Debug|x64 + {F24371C6-7DD7-4208-B6D4-D652F0DE434A}.Debug|Any CPU.Build.0 = Debug|x64 {F24371C6-7DD7-4208-B6D4-D652F0DE434A}.Debug|x64.ActiveCfg = Debug|x64 {F24371C6-7DD7-4208-B6D4-D652F0DE434A}.Debug|x64.Build.0 = Debug|x64 + {F24371C6-7DD7-4208-B6D4-D652F0DE434A}.Release|Any CPU.ActiveCfg = Release|x64 + {F24371C6-7DD7-4208-B6D4-D652F0DE434A}.Release|Any CPU.Build.0 = Release|x64 {F24371C6-7DD7-4208-B6D4-D652F0DE434A}.Release|x64.ActiveCfg = Release|x64 {F24371C6-7DD7-4208-B6D4-D652F0DE434A}.Release|x64.Build.0 = Release|x64 + {4128DEDE-8A8A-40A3-9DC4-87918DCE1E18}.Debug|Any CPU.ActiveCfg = Debug|x64 + {4128DEDE-8A8A-40A3-9DC4-87918DCE1E18}.Debug|Any CPU.Build.0 = Debug|x64 {4128DEDE-8A8A-40A3-9DC4-87918DCE1E18}.Debug|x64.ActiveCfg = Debug|x64 {4128DEDE-8A8A-40A3-9DC4-87918DCE1E18}.Debug|x64.Build.0 = Debug|x64 + {4128DEDE-8A8A-40A3-9DC4-87918DCE1E18}.Release|Any CPU.ActiveCfg = Release|x64 + {4128DEDE-8A8A-40A3-9DC4-87918DCE1E18}.Release|Any CPU.Build.0 = Release|x64 {4128DEDE-8A8A-40A3-9DC4-87918DCE1E18}.Release|x64.ActiveCfg = Release|x64 {4128DEDE-8A8A-40A3-9DC4-87918DCE1E18}.Release|x64.Build.0 = Release|x64 + {61FB7653-1897-45E1-9146-894D68963107}.Debug|Any CPU.ActiveCfg = Debug|x64 + {61FB7653-1897-45E1-9146-894D68963107}.Debug|Any CPU.Build.0 = Debug|x64 {61FB7653-1897-45E1-9146-894D68963107}.Debug|x64.ActiveCfg = Debug|x64 {61FB7653-1897-45E1-9146-894D68963107}.Debug|x64.Build.0 = Debug|x64 + {61FB7653-1897-45E1-9146-894D68963107}.Release|Any CPU.ActiveCfg = Release|x64 + {61FB7653-1897-45E1-9146-894D68963107}.Release|Any CPU.Build.0 = Release|x64 {61FB7653-1897-45E1-9146-894D68963107}.Release|x64.ActiveCfg = Release|x64 {61FB7653-1897-45E1-9146-894D68963107}.Release|x64.Build.0 = Release|x64 + {4F1C6A55-6481-4E5F-9E08-05BFAB531E0C}.Debug|Any CPU.ActiveCfg = Debug|x64 + {4F1C6A55-6481-4E5F-9E08-05BFAB531E0C}.Debug|Any CPU.Build.0 = Debug|x64 {4F1C6A55-6481-4E5F-9E08-05BFAB531E0C}.Debug|x64.ActiveCfg = Debug|x64 {4F1C6A55-6481-4E5F-9E08-05BFAB531E0C}.Debug|x64.Build.0 = Debug|x64 + {4F1C6A55-6481-4E5F-9E08-05BFAB531E0C}.Release|Any CPU.ActiveCfg = Release|x64 + {4F1C6A55-6481-4E5F-9E08-05BFAB531E0C}.Release|Any CPU.Build.0 = Release|x64 {4F1C6A55-6481-4E5F-9E08-05BFAB531E0C}.Release|x64.ActiveCfg = Release|x64 {4F1C6A55-6481-4E5F-9E08-05BFAB531E0C}.Release|x64.Build.0 = Release|x64 + {702A8DAD-BFBA-4A45-A1A9-AAACE4AFDFF7}.Debug|Any CPU.ActiveCfg = Debug|x64 + {702A8DAD-BFBA-4A45-A1A9-AAACE4AFDFF7}.Debug|Any CPU.Build.0 = Debug|x64 {702A8DAD-BFBA-4A45-A1A9-AAACE4AFDFF7}.Debug|x64.ActiveCfg = Debug|x64 {702A8DAD-BFBA-4A45-A1A9-AAACE4AFDFF7}.Debug|x64.Build.0 = Debug|x64 + {702A8DAD-BFBA-4A45-A1A9-AAACE4AFDFF7}.Release|Any CPU.ActiveCfg = Release|x64 + {702A8DAD-BFBA-4A45-A1A9-AAACE4AFDFF7}.Release|Any CPU.Build.0 = Release|x64 {702A8DAD-BFBA-4A45-A1A9-AAACE4AFDFF7}.Release|x64.ActiveCfg = Release|x64 {702A8DAD-BFBA-4A45-A1A9-AAACE4AFDFF7}.Release|x64.Build.0 = Release|x64 + {73B185C2-4058-4500-A12C-E2D7F917FA79}.Debug|Any CPU.ActiveCfg = Debug|x64 + {73B185C2-4058-4500-A12C-E2D7F917FA79}.Debug|Any CPU.Build.0 = Debug|x64 {73B185C2-4058-4500-A12C-E2D7F917FA79}.Debug|x64.ActiveCfg = Debug|x64 {73B185C2-4058-4500-A12C-E2D7F917FA79}.Debug|x64.Build.0 = Debug|x64 + {73B185C2-4058-4500-A12C-E2D7F917FA79}.Release|Any CPU.ActiveCfg = Release|x64 + {73B185C2-4058-4500-A12C-E2D7F917FA79}.Release|Any CPU.Build.0 = Release|x64 {73B185C2-4058-4500-A12C-E2D7F917FA79}.Release|x64.ActiveCfg = Release|x64 {73B185C2-4058-4500-A12C-E2D7F917FA79}.Release|x64.Build.0 = Release|x64 + {3CCC067E-989F-4E33-BABA-6FC75FBAC201}.Debug|Any CPU.ActiveCfg = Debug|x64 + {3CCC067E-989F-4E33-BABA-6FC75FBAC201}.Debug|Any CPU.Build.0 = Debug|x64 {3CCC067E-989F-4E33-BABA-6FC75FBAC201}.Debug|x64.ActiveCfg = Debug|x64 {3CCC067E-989F-4E33-BABA-6FC75FBAC201}.Debug|x64.Build.0 = Debug|x64 + {3CCC067E-989F-4E33-BABA-6FC75FBAC201}.Release|Any CPU.ActiveCfg = Release|x64 + {3CCC067E-989F-4E33-BABA-6FC75FBAC201}.Release|Any CPU.Build.0 = Release|x64 {3CCC067E-989F-4E33-BABA-6FC75FBAC201}.Release|x64.ActiveCfg = Release|x64 {3CCC067E-989F-4E33-BABA-6FC75FBAC201}.Release|x64.Build.0 = Release|x64 + {11103684-D2C8-4314-99B1-C4132BD46B9F}.Debug|Any CPU.ActiveCfg = Debug|x64 + {11103684-D2C8-4314-99B1-C4132BD46B9F}.Debug|Any CPU.Build.0 = Debug|x64 {11103684-D2C8-4314-99B1-C4132BD46B9F}.Debug|x64.ActiveCfg = Debug|x64 {11103684-D2C8-4314-99B1-C4132BD46B9F}.Debug|x64.Build.0 = Debug|x64 + {11103684-D2C8-4314-99B1-C4132BD46B9F}.Release|Any CPU.ActiveCfg = Release|x64 + {11103684-D2C8-4314-99B1-C4132BD46B9F}.Release|Any CPU.Build.0 = Release|x64 {11103684-D2C8-4314-99B1-C4132BD46B9F}.Release|x64.ActiveCfg = Release|x64 {11103684-D2C8-4314-99B1-C4132BD46B9F}.Release|x64.Build.0 = Release|x64 + {431CF7CF-4110-4EF8-ACFD-C98C4547B1F0}.Debug|Any CPU.ActiveCfg = Debug|x64 + {431CF7CF-4110-4EF8-ACFD-C98C4547B1F0}.Debug|Any CPU.Build.0 = Debug|x64 {431CF7CF-4110-4EF8-ACFD-C98C4547B1F0}.Debug|x64.ActiveCfg = Debug|x64 {431CF7CF-4110-4EF8-ACFD-C98C4547B1F0}.Debug|x64.Build.0 = Debug|x64 + {431CF7CF-4110-4EF8-ACFD-C98C4547B1F0}.Release|Any CPU.ActiveCfg = Release|x64 + {431CF7CF-4110-4EF8-ACFD-C98C4547B1F0}.Release|Any CPU.Build.0 = Release|x64 {431CF7CF-4110-4EF8-ACFD-C98C4547B1F0}.Release|x64.ActiveCfg = Release|x64 {431CF7CF-4110-4EF8-ACFD-C98C4547B1F0}.Release|x64.Build.0 = Release|x64 + {FE232237-9B56-4782-86C2-7359571B5D99}.Debug|Any CPU.ActiveCfg = Debug|x64 + {FE232237-9B56-4782-86C2-7359571B5D99}.Debug|Any CPU.Build.0 = Debug|x64 {FE232237-9B56-4782-86C2-7359571B5D99}.Debug|x64.ActiveCfg = Debug|x64 {FE232237-9B56-4782-86C2-7359571B5D99}.Debug|x64.Build.0 = Debug|x64 + {FE232237-9B56-4782-86C2-7359571B5D99}.Release|Any CPU.ActiveCfg = Release|x64 + {FE232237-9B56-4782-86C2-7359571B5D99}.Release|Any CPU.Build.0 = Release|x64 {FE232237-9B56-4782-86C2-7359571B5D99}.Release|x64.ActiveCfg = Release|x64 {FE232237-9B56-4782-86C2-7359571B5D99}.Release|x64.Build.0 = Release|x64 + {4D06FF1E-85B5-4A1E-8C2B-D4CC6F00F803}.Debug|Any CPU.ActiveCfg = Debug|x64 + {4D06FF1E-85B5-4A1E-8C2B-D4CC6F00F803}.Debug|Any CPU.Build.0 = Debug|x64 {4D06FF1E-85B5-4A1E-8C2B-D4CC6F00F803}.Debug|x64.ActiveCfg = Debug|x64 {4D06FF1E-85B5-4A1E-8C2B-D4CC6F00F803}.Debug|x64.Build.0 = Debug|x64 + {4D06FF1E-85B5-4A1E-8C2B-D4CC6F00F803}.Release|Any CPU.ActiveCfg = Release|x64 + {4D06FF1E-85B5-4A1E-8C2B-D4CC6F00F803}.Release|Any CPU.Build.0 = Release|x64 {4D06FF1E-85B5-4A1E-8C2B-D4CC6F00F803}.Release|x64.ActiveCfg = Release|x64 {4D06FF1E-85B5-4A1E-8C2B-D4CC6F00F803}.Release|x64.Build.0 = Release|x64 + {573A7BB2-9D75-429C-96A1-02BE949B7208}.Debug|Any CPU.ActiveCfg = Debug|x64 + {573A7BB2-9D75-429C-96A1-02BE949B7208}.Debug|Any CPU.Build.0 = Debug|x64 {573A7BB2-9D75-429C-96A1-02BE949B7208}.Debug|x64.ActiveCfg = Debug|x64 {573A7BB2-9D75-429C-96A1-02BE949B7208}.Debug|x64.Build.0 = Debug|x64 + {573A7BB2-9D75-429C-96A1-02BE949B7208}.Release|Any CPU.ActiveCfg = Release|x64 + {573A7BB2-9D75-429C-96A1-02BE949B7208}.Release|Any CPU.Build.0 = Release|x64 {573A7BB2-9D75-429C-96A1-02BE949B7208}.Release|x64.ActiveCfg = Release|x64 {573A7BB2-9D75-429C-96A1-02BE949B7208}.Release|x64.Build.0 = Release|x64 + {84E6EEE1-ED89-497F-959F-8BCE7EF8590F}.Debug|Any CPU.ActiveCfg = Debug|x64 + {84E6EEE1-ED89-497F-959F-8BCE7EF8590F}.Debug|Any CPU.Build.0 = Debug|x64 {84E6EEE1-ED89-497F-959F-8BCE7EF8590F}.Debug|x64.ActiveCfg = Debug|x64 {84E6EEE1-ED89-497F-959F-8BCE7EF8590F}.Debug|x64.Build.0 = Debug|x64 + {84E6EEE1-ED89-497F-959F-8BCE7EF8590F}.Release|Any CPU.ActiveCfg = Release|x64 + {84E6EEE1-ED89-497F-959F-8BCE7EF8590F}.Release|Any CPU.Build.0 = Release|x64 {84E6EEE1-ED89-497F-959F-8BCE7EF8590F}.Release|x64.ActiveCfg = Release|x64 {84E6EEE1-ED89-497F-959F-8BCE7EF8590F}.Release|x64.Build.0 = Release|x64 + {51E1386D-103D-4DDC-AD66-1557D766F288}.Debug|Any CPU.ActiveCfg = Debug|x64 + {51E1386D-103D-4DDC-AD66-1557D766F288}.Debug|Any CPU.Build.0 = Debug|x64 {51E1386D-103D-4DDC-AD66-1557D766F288}.Debug|x64.ActiveCfg = Debug|x64 {51E1386D-103D-4DDC-AD66-1557D766F288}.Debug|x64.Build.0 = Debug|x64 + {51E1386D-103D-4DDC-AD66-1557D766F288}.Release|Any CPU.ActiveCfg = Release|x64 + {51E1386D-103D-4DDC-AD66-1557D766F288}.Release|Any CPU.Build.0 = Release|x64 {51E1386D-103D-4DDC-AD66-1557D766F288}.Release|x64.ActiveCfg = Release|x64 {51E1386D-103D-4DDC-AD66-1557D766F288}.Release|x64.Build.0 = Release|x64 + {1E1CB813-3331-43C0-8E9A-E26525C25134}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1E1CB813-3331-43C0-8E9A-E26525C25134}.Debug|Any CPU.Build.0 = Debug|Any CPU {1E1CB813-3331-43C0-8E9A-E26525C25134}.Debug|x64.ActiveCfg = Debug|Any CPU {1E1CB813-3331-43C0-8E9A-E26525C25134}.Debug|x64.Build.0 = Debug|Any CPU + {1E1CB813-3331-43C0-8E9A-E26525C25134}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1E1CB813-3331-43C0-8E9A-E26525C25134}.Release|Any CPU.Build.0 = Release|Any CPU {1E1CB813-3331-43C0-8E9A-E26525C25134}.Release|x64.ActiveCfg = Release|x64 {1E1CB813-3331-43C0-8E9A-E26525C25134}.Release|x64.Build.0 = Release|x64 + {CBB4A661-91CF-465D-A5A0-B2841116FC03}.Debug|Any CPU.ActiveCfg = Debug|x64 + {CBB4A661-91CF-465D-A5A0-B2841116FC03}.Debug|Any CPU.Build.0 = Debug|x64 {CBB4A661-91CF-465D-A5A0-B2841116FC03}.Debug|x64.ActiveCfg = Debug|x64 {CBB4A661-91CF-465D-A5A0-B2841116FC03}.Debug|x64.Build.0 = Debug|x64 + {CBB4A661-91CF-465D-A5A0-B2841116FC03}.Release|Any CPU.ActiveCfg = Release|x64 + {CBB4A661-91CF-465D-A5A0-B2841116FC03}.Release|Any CPU.Build.0 = Release|x64 {CBB4A661-91CF-465D-A5A0-B2841116FC03}.Release|x64.ActiveCfg = Release|x64 {CBB4A661-91CF-465D-A5A0-B2841116FC03}.Release|x64.Build.0 = Release|x64 + {3E8C092F-7AF9-4498-90BE-912CF9E5E103}.Debug|Any CPU.ActiveCfg = Debug|x64 + {3E8C092F-7AF9-4498-90BE-912CF9E5E103}.Debug|Any CPU.Build.0 = Debug|x64 {3E8C092F-7AF9-4498-90BE-912CF9E5E103}.Debug|x64.ActiveCfg = Debug|x64 {3E8C092F-7AF9-4498-90BE-912CF9E5E103}.Debug|x64.Build.0 = Debug|x64 + {3E8C092F-7AF9-4498-90BE-912CF9E5E103}.Release|Any CPU.ActiveCfg = Release|x64 + {3E8C092F-7AF9-4498-90BE-912CF9E5E103}.Release|Any CPU.Build.0 = Release|x64 {3E8C092F-7AF9-4498-90BE-912CF9E5E103}.Release|x64.ActiveCfg = Release|x64 {3E8C092F-7AF9-4498-90BE-912CF9E5E103}.Release|x64.Build.0 = Release|x64 + {9DCA70EE-EAF5-4F2E-B714-19D00BE1EEE6}.Debug|Any CPU.ActiveCfg = Debug|x64 + {9DCA70EE-EAF5-4F2E-B714-19D00BE1EEE6}.Debug|Any CPU.Build.0 = Debug|x64 {9DCA70EE-EAF5-4F2E-B714-19D00BE1EEE6}.Debug|x64.ActiveCfg = Debug|x64 {9DCA70EE-EAF5-4F2E-B714-19D00BE1EEE6}.Debug|x64.Build.0 = Debug|x64 + {9DCA70EE-EAF5-4F2E-B714-19D00BE1EEE6}.Release|Any CPU.ActiveCfg = Release|x64 + {9DCA70EE-EAF5-4F2E-B714-19D00BE1EEE6}.Release|Any CPU.Build.0 = Release|x64 {9DCA70EE-EAF5-4F2E-B714-19D00BE1EEE6}.Release|x64.ActiveCfg = Release|x64 {9DCA70EE-EAF5-4F2E-B714-19D00BE1EEE6}.Release|x64.Build.0 = Release|x64 + {A84F2AC9-69F1-4C59-BD7C-137F46F5CB3E}.Debug|Any CPU.ActiveCfg = Debug|x64 + {A84F2AC9-69F1-4C59-BD7C-137F46F5CB3E}.Debug|Any CPU.Build.0 = Debug|x64 {A84F2AC9-69F1-4C59-BD7C-137F46F5CB3E}.Debug|x64.ActiveCfg = Debug|x64 {A84F2AC9-69F1-4C59-BD7C-137F46F5CB3E}.Debug|x64.Build.0 = Debug|x64 + {A84F2AC9-69F1-4C59-BD7C-137F46F5CB3E}.Release|Any CPU.ActiveCfg = Release|x64 + {A84F2AC9-69F1-4C59-BD7C-137F46F5CB3E}.Release|Any CPU.Build.0 = Release|x64 {A84F2AC9-69F1-4C59-BD7C-137F46F5CB3E}.Release|x64.ActiveCfg = Release|x64 {A84F2AC9-69F1-4C59-BD7C-137F46F5CB3E}.Release|x64.Build.0 = Release|x64 + {F4FB60CF-0260-4CD1-990E-DC499D68C3B6}.Debug|Any CPU.ActiveCfg = Debug|x64 + {F4FB60CF-0260-4CD1-990E-DC499D68C3B6}.Debug|Any CPU.Build.0 = Debug|x64 {F4FB60CF-0260-4CD1-990E-DC499D68C3B6}.Debug|x64.ActiveCfg = Debug|x64 {F4FB60CF-0260-4CD1-990E-DC499D68C3B6}.Debug|x64.Build.0 = Debug|x64 + {F4FB60CF-0260-4CD1-990E-DC499D68C3B6}.Release|Any CPU.ActiveCfg = Release|x64 + {F4FB60CF-0260-4CD1-990E-DC499D68C3B6}.Release|Any CPU.Build.0 = Release|x64 {F4FB60CF-0260-4CD1-990E-DC499D68C3B6}.Release|x64.ActiveCfg = Release|x64 {F4FB60CF-0260-4CD1-990E-DC499D68C3B6}.Release|x64.Build.0 = Release|x64 EndGlobalSection From cbb3c8d992be251debb9c7230d8b75566846db1b Mon Sep 17 00:00:00 2001 From: croudyj Date: Fri, 4 Oct 2024 13:50:25 -0700 Subject: [PATCH 14/14] Added SampleRenderSettings command. --- cpp/SampleCommands/SampleCommands.vcxproj | 1 + .../SampleCommands.vcxproj.filters | 3 + .../cmdSampleRenderSettings.cpp | 472 ++++++++++++++++++ 3 files changed, 476 insertions(+) create mode 100644 cpp/SampleCommands/cmdSampleRenderSettings.cpp diff --git a/cpp/SampleCommands/SampleCommands.vcxproj b/cpp/SampleCommands/SampleCommands.vcxproj index 33159b03..ce3471ee 100644 --- a/cpp/SampleCommands/SampleCommands.vcxproj +++ b/cpp/SampleCommands/SampleCommands.vcxproj @@ -219,6 +219,7 @@ + diff --git a/cpp/SampleCommands/SampleCommands.vcxproj.filters b/cpp/SampleCommands/SampleCommands.vcxproj.filters index 23d90e25..a50e7b2b 100644 --- a/cpp/SampleCommands/SampleCommands.vcxproj.filters +++ b/cpp/SampleCommands/SampleCommands.vcxproj.filters @@ -864,6 +864,9 @@ Source Files + + Source Files + diff --git a/cpp/SampleCommands/cmdSampleRenderSettings.cpp b/cpp/SampleCommands/cmdSampleRenderSettings.cpp new file mode 100644 index 00000000..98d6036f --- /dev/null +++ b/cpp/SampleCommands/cmdSampleRenderSettings.cpp @@ -0,0 +1,472 @@ + +#include "stdafx.h" + +#pragma warning (push) +#pragma warning (disable: 4996) +#pragma region SampleRenderSettings command + +// NOTE: In the following examples, any variables that end with '_old' are using the old method of +// accessing the objects. These examples are included for comparison with the new method but they +// should not be used. You should only use the examples that have variables ending in "_new" and +// which use ON_3dmRenderSettings with variables called 'rs' and 'rs_write'. + +class CCommandSampleRenderSettings : public CRhinoCommand +{ +public: + virtual UUID CommandUUID() override { static const UUID uuid = { 0x121bc621, 0xca21, 0x44b7, { 0xa1, 0xd7, 0x4b, 0x34, 0x2c, 0xb2, 0x1b, 0x1 } }; return uuid; } + virtual const wchar_t* EnglishCommandName() override { return L"SampleRenderSettings"; } + virtual CRhinoCommand::result RunCommand(const CRhinoCommandContext& context) override; + +private: + bool Sun(CRhinoDoc& doc) const; + bool GroundPlane(CRhinoDoc& doc) const; + bool SafeFrame(CRhinoDoc& doc) const; + bool Skylight(CRhinoDoc& doc) const; + bool LinearWorkflow(CRhinoDoc& doc) const; + bool Dithering(CRhinoDoc& doc) const; + bool RenderChannels(CRhinoDoc& doc) const; + bool PostEffects(CRhinoDoc& doc) const; + bool CurrentEnvironment(CRhinoDoc& doc) const; +}; + +// The one and only CCommandSampleRenderSettings object. +static class CCommandSampleRenderSettings theSampleRenderSettingsCommand; + +CRhinoCommand::result CCommandSampleRenderSettings::RunCommand(const CRhinoCommandContext& context) +{ + auto* doc = context.Document(); + if (nullptr == doc) + return failure; + + if (!Sun(*doc)) + return failure; + + if (!GroundPlane(*doc)) + return failure; + + if (!SafeFrame(*doc)) + return failure; + + if (!Skylight(*doc)) + return failure; + + if (!LinearWorkflow(*doc)) + return failure; + + if (!Dithering(*doc)) + return failure; + + if (!RenderChannels(*doc)) + return failure; + + if (!PostEffects(*doc)) // To test this, make sure you add the Bloom post effect first. + return failure; + + if (!CurrentEnvironment(*doc)) + return failure; + + return success; +} + +// Sun. + +bool CCommandSampleRenderSettings::Sun(CRhinoDoc& doc) const +{ + // Old-style access method was directly in the document. + const auto& sun_old = doc.Sun(); + + // New-style access is through the document's render settings. + const auto& rs = doc.Properties().RenderSettings(); + + // Reading a property the old way. + const auto value_old = sun_old.Latitude(); + + // Reading a property the new way. + const auto value_new = rs.Sun().Latitude(); + + // Writing a property the old way required a call to BeginChange() to get a non-const object. + auto& sun_write_old = sun_old.BeginChange(RhRdkChangeContext::UI); + + // Non-const method was called on the non-const object. + sun_write_old.SetLatitude(51.0); + + // Writing a property the new way requires copying the render settings to a non-const object. + ON_3dmRenderSettings rs_write = rs; + + // Non-const methods must be called on the non-const copy. + rs_write.Sun().SetLatitude(51.0); + + // Writing the old way required a call to EndChange() on the non-const document object. + sun_write_old.EndChange(); + + // Writing the new way requires a call to SetRenderSettings() passing the non-const render settings. + doc.Properties().SetRenderSettings(rs_write); + + return true; +} + +// Ground Plane. + +bool CCommandSampleRenderSettings::GroundPlane(CRhinoDoc& doc) const +{ + // Old-style access method was directly in the document. + const auto& gp_old = doc.GroundPlane(); + + // New-style access is through the document's render settings. + const auto& rs = doc.Properties().RenderSettings(); + + // Reading a property the old way. + const auto value_old = gp_old.Altitude(); + + // Reading a property the new way. + const auto value_new = rs.GroundPlane().Altitude(); + + // Writing a property the old way required a call to BeginChange() to get a non-const object. + auto& gp_write_old = gp_old.BeginChange(RhRdkChangeContext::UI); + + // Non-const method was called on the non-const object. + gp_write_old.SetAltitude(25.0); + + // Writing a property the new way requires copying the render settings to a non-const object. + ON_3dmRenderSettings rs_write = rs; + + // Non-const methods must be called on the non-const copy. + rs_write.GroundPlane().SetAltitude(25.0); + + // Writing the old way required a call to EndChange() on the non-const document object. + gp_write_old.EndChange(); + + // Writing the new way requires a call to SetRenderSettings() passing the non-const render settings. + doc.Properties().SetRenderSettings(rs_write); + + return true; +} + +// Safe Frame. + +bool CCommandSampleRenderSettings::SafeFrame(CRhinoDoc& doc) const +{ + // Old-style access method was directly in the document. + const auto& sf = doc.SafeFrame(); + + // New-style access is through the document's render settings. + const auto& rs = doc.Properties().RenderSettings(); + + // Reading a property the old way. + const auto value_old = sf.ActionFrameXScale(); + + // Reading a property the new way. + const auto value_new = rs.SafeFrame().ActionFrameXScale(); + + // Writing a property the old way required a call to BeginChange() to get a non-const object. + auto& sf_write_old = sf.BeginChange(RhRdkChangeContext::UI); + + // Non-const method was called on the non-const object. + sf_write_old.SetActionFrameXScale(2.0); + + // Writing a property the new way requires copying the render settings to a non-const object. + ON_3dmRenderSettings rs_write = rs; + + // Non-const methods must be called on the non-const copy. + rs_write.SafeFrame().SetActionFrameXScale(2.0); + + // Writing the old way required a call to EndChange() on the non-const document object. + sf_write_old.EndChange(); + + // Writing the new way requires a call to SetRenderSettings() passing the non-const render settings. + doc.Properties().SetRenderSettings(rs_write); + + return true; +} + +// Skylight. + +bool CCommandSampleRenderSettings::Skylight(CRhinoDoc& doc) const +{ + // Old-style access method was directly in the document. + const auto& sl_old = doc.Skylight(); + + // New-style access is through the document's render settings. + const auto& rs = doc.Properties().RenderSettings(); + + // Reading a property the old way. + const auto value_old = sl_old.Enabled(); + + // Reading a property the new way. + const auto value_new = rs.Skylight().Enabled(); + + // Writing a property the old way required a call to BeginChange() to get a non-const object. + auto& sl_write_old = sl_old.BeginChange(RhRdkChangeContext::UI); + + // Non-const method was called on the non-const object. + sl_write_old.SetEnabled(true); + + // Writing a property the new way requires copying the render settings to a non-const object. + ON_3dmRenderSettings rs_write = rs; + + // Non-const methods must be called on the non-const copy. + rs_write.Skylight().SetEnabled(true); + + // Writing the old way required a call to EndChange() on the non-const document object. + sl_write_old.EndChange(); + + // Writing the new way requires a call to SetRenderSettings() passing the non-const render settings. + doc.Properties().SetRenderSettings(rs_write); + + return true; +} + +// Linear Workflow. + +bool CCommandSampleRenderSettings::LinearWorkflow(CRhinoDoc& doc) const +{ + // Old-style access method was directly in the document. + const auto& lw_old = doc.LinearWorkflow(); + + // New-style access is through the document's render settings. + const auto& rs = doc.Properties().RenderSettings(); + + // Reading a property the old way. + const auto value_old = lw_old.PostProcessGamma(); + + // Reading a property the new way. + const auto value_new = rs.LinearWorkflow().PostProcessGamma(); + + // Writing a property the old way required a call to BeginChange() to get a non-const object. + auto& lw_write_old = lw_old.BeginChange(RhRdkChangeContext::UI); + + // Non-const method was called on the non-const object. + lw_write_old.SetPostProcessGamma(2.6f); + + // Writing a property the new way requires copying the render settings to a non-const object. + ON_3dmRenderSettings rs_write = rs; + + // Non-const methods must be called on the non-const copy. + rs_write.LinearWorkflow().SetPostProcessGamma(2.6f); + + // Writing the old way required a call to EndChange() on the non-const document object. + lw_write_old.EndChange(); + + // Writing the new way requires a call to SetRenderSettings() passing the non-const render settings. + doc.Properties().SetRenderSettings(rs_write); + + return true; +} + +// Dithering. + +bool CCommandSampleRenderSettings::Dithering(CRhinoDoc& doc) const +{ + // Old-style access method was directly in the document. + const auto& dit_old = doc.Dithering(); + + // New-style access is through the document's render settings. + const auto& rs = doc.Properties().RenderSettings(); + + // Reading a property the old way. + const auto value_old = dit_old.Method(); + + // Reading a property the new way. + const auto value_new = rs.Dithering().Method(); + + // Writing a property the old way required a call to BeginChange() to get a non-const object. + auto& dit_write_old = dit_old.BeginChange(RhRdkChangeContext::UI); + + // Non-const method was called on the non-const object. + dit_write_old.SetMethod(IRhRdkDithering::Methods::SimpleNoise); + + // Writing a property the new way requires copying the render settings to a non-const object. + ON_3dmRenderSettings rs_write = rs; + + // Non-const methods must be called on the non-const copy. + rs_write.Dithering().SetMethod(ON_Dithering::Methods::SimpleNoise); + + // Writing the old way required a call to EndChange() on the non-const document object. + dit_write_old.EndChange(); + + // Writing the new way requires a call to SetRenderSettings() passing the non-const render settings. + doc.Properties().SetRenderSettings(rs_write); + + return true; +} + +// Render Channels. + +bool CCommandSampleRenderSettings::RenderChannels(CRhinoDoc& doc) const +{ + // Old-style access method was directly in the document. + const auto& rch_old = doc.RenderChannels(); + + // New-style access is through the document's render settings. + const auto& rs = doc.Properties().RenderSettings(); + + // Reading a property the old way. + const auto value_old = rch_old.Mode(); + + // Reading a property the new way. + const auto value_new = rs.RenderChannels().Mode(); + + // Writing a property the old way required a call to BeginChange() to get a non-const object. + auto& rch_write_old = rch_old.BeginChange(RhRdkChangeContext::UI); + + // Non-const method was called on the non-const object. + rch_write_old.SetMode(IRhRdkRenderChannels::Modes::Custom); + + // Writing a property the new way requires copying the render settings to a non-const object. + ON_3dmRenderSettings rs_write = rs; + + // Non-const methods must be called on the non-const copy. + rs_write.RenderChannels().SetMode(ON_RenderChannels::Modes::Custom); + + // Writing the old way required a call to EndChange() on the non-const document object. + rch_write_old.EndChange(); + + // Writing the new way requires a call to SetRenderSettings() passing the non-const render settings. + doc.Properties().SetRenderSettings(rs_write); + + return true; +} + +// Post Effects. + +bool CCommandSampleRenderSettings::PostEffects(CRhinoDoc& doc) const +{ + // Old-style access method was directly in the document. + const auto& post_effects_old = doc.PostEffects(); + + // New-style access is through the document's render settings. + const auto& rs = doc.Properties().RenderSettings(); + + // We will test using the 'radius' property of the bloom post effect. + const auto param_name = SS_PEP_BLOOM_RADIUS; + const auto post_effect_id = uuidPostEffect_Bloom; + + const auto value_to_write = 2.5f; + + // Reading a property the old way. First get the bloom post effect. + const auto* post_effect_old = post_effects_old.PostEffectFromId(post_effect_id); + if (nullptr == post_effect_old) + return false; + + // Reading a property the old way. + CRhRdkVariant value_old; + if (!post_effect_old->GetParameter(param_name, value_old)) + return false; + + // Reading a property the new way. First get the bloom post effect from the const render settings. + const auto* post_effect_new = rs.PostEffects().PostEffectFromId(post_effect_id); + if (nullptr == post_effect_new) + return false; + + // Reading a property the new way. + const auto value_new = post_effect_new->GetParameter(param_name); + + // Writing a property the old way required a call to BeginChange() to get a non-const object. + auto& post_effect_write_old = post_effect_old->BeginChange(RhRdkChangeContext::UI); + + // Non-const method was called on the non-const object. + post_effect_write_old.SetParameter(param_name, value_to_write); + + // Writing a property the new way requires copying the render settings to a non-const object. + ON_3dmRenderSettings rs_write = rs; + + // Writing a property the new way. First get the bloom post effect from the non-const render settings copy. + auto* post_effect_write_new = rs_write.PostEffects().PostEffectFromId(post_effect_id); + if (nullptr == post_effect_write_new) + return false; + + // Non-const methods must be called on the non-const copy. + post_effect_write_new->SetParameter(param_name, value_to_write); + + // Writing the old way required a call to EndChange() on the non-const document object. + post_effect_write_old.EndChange(); + + // Writing the new way requires a call to SetRenderSettings() passing the non-const render settings. + doc.Properties().SetRenderSettings(rs_write); + + return true; +} + +bool CCommandSampleRenderSettings::CurrentEnvironment(CRhinoDoc& doc) const +{ + // Old-style environment usage and purpose. + using ICEU = IRhRdkCurrentEnvironment::Usage; + using ICEP = IRhRdkCurrentEnvironment::Purpose; + + // New-style environment usage and purpose. + using OCEU = ON_3dmRenderSettings::EnvironmentUsage; + using OCEP = ON_3dmRenderSettings::EnvironmentPurpose; + + // Old-style current environment access was directly in the document. + const auto& ce = doc.CurrentEnvironment(); + + // New-style current environment access is through the document's render settings. + const auto& rs = doc.Properties().RenderSettings(); + + // Reading environment on-ness for each usage the old way. + const auto back_on_old = ce.On(ICEU::Background); + const auto refl_on_old = ce.On(ICEU::Reflection); + const auto skyl_on_old = ce.On(ICEU::Skylighting); + + // Reading environment override for each usage the new way. + // When an override is enabled for a particular usage, it enables that usage's id to override + // the background environment's id. + // NOTE: 'Background' is allowed for convenience even though it's not really an override. + // See the comments at the definition of ON_3dmRenderSettings::RenderEnvironmentOverride(). + const auto back_on_new = rs.RenderEnvironmentOverride(OCEU::Background); + const auto refl_on_new = rs.RenderEnvironmentOverride(OCEU::Reflection); + const auto skyl_on_new = rs.RenderEnvironmentOverride(OCEU::Skylighting); + + // Reading environment id for each usage the old way. + const auto back_id_old = ce.Get(ICEU::Background, ICEP::Simple); + const auto refl_id_old = ce.Get(ICEU::Reflection, ICEP::Simple); + const auto skyl_id_old = ce.Get(ICEU::Skylighting, ICEP::Simple); + + // Reading environment id for each usage the new way. Note that the 'Standard' purpose + // has the same meaning as the old-style 'Simple' purpose. + const auto back_id_new = rs.RenderEnvironmentId(OCEU::Background, OCEP::Standard); + const auto refl_id_new = rs.RenderEnvironmentId(OCEU::Reflection, OCEP::Standard); + const auto skyl_id_new = rs.RenderEnvironmentId(OCEU::Skylighting, OCEP::Standard); + + // Writing the old way required a call to BeginChange() to get a non-const object. + auto& ce_write = ce.BeginChange(RhRdkChangeContext::UI); + + // Writing the new way requires copying the render settings to a non-const object. + ON_3dmRenderSettings rs_write = rs; + + // Writing old-style environment on-ness for each usage to the non-const current environment. + // NOTE: It's not possible to set the background 'on' state like this. + ce_write.SetOn(ICEU::Reflection, true); + ce_write.SetOn(ICEU::Skylighting, false); + + // Writing new-style environment override for each usage to the non-const render settings. + // NOTE: It's not possible to set the background like this because it's not an override. + // See the comments at the definition of ON_3dmRenderSettings::SetRenderEnvironmentOverride(). + rs_write.SetRenderEnvironmentOverride(OCEU::Reflection, true); + rs_write.SetRenderEnvironmentOverride(OCEU::Skylighting, false); + + UUID back_id = { }; // Set this UUID to something sensible. + UUID refl_id = { }; // Set this UUID to something sensible. + UUID skyl_id = { }; // Set this UUID to something sensible. + + // Writing old-style environment id for each usage to the non-const current environment. + ce_write.Set(ICEU::Background, back_id); + ce_write.Set(ICEU::Reflection, refl_id); + ce_write.Set(ICEU::Skylighting, skyl_id); + + // Writing new-style environment id for each usage to the non-const render settings. + rs_write.SetRenderEnvironmentId(OCEU::Background, back_id); + rs_write.SetRenderEnvironmentId(OCEU::Reflection, refl_id); + rs_write.SetRenderEnvironmentId(OCEU::Skylighting, skyl_id); + + // Writing the old way required a call to EndChange() on the non-const current environment. + ce_write.EndChange(); + + // Writing the new way requires a call to SetRenderSettings() passing the non-const render settings. + doc.Properties().SetRenderSettings(rs_write); + + return true; +} + +#pragma endregion +#pragma warning (pop)