From 3e8e59480baa1ecf4756ed259357b3999457469e Mon Sep 17 00:00:00 2001 From: fraguada Date: Fri, 17 Nov 2023 15:18:30 +0100 Subject: [PATCH] update rhino3dm cs sample --- rhino3dm/cs/SampleCSViewports/Program.cs | 12 +++++++++++- .../cs/SampleCSViewports/SampleCSViewports.csproj | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/rhino3dm/cs/SampleCSViewports/Program.cs b/rhino3dm/cs/SampleCSViewports/Program.cs index 087c094f..e698fad9 100644 --- a/rhino3dm/cs/SampleCSViewports/Program.cs +++ b/rhino3dm/cs/SampleCSViewports/Program.cs @@ -1,9 +1,13 @@ -using Rhino.DocObjects; +using System.ComponentModel; +using Rhino.DocObjects; using Rhino.FileIO; File3dm file3dm = File3dm.Read("../../models/Rhino_Logo_Mesh8_NamedViews.3dm"); + + Console.WriteLine("--- Views ---"); +Console.WriteLine("nº of views: {0}", file3dm.AllViews.Count); for ( var i = 0; i < file3dm.AllViews.Count; i ++ ) { var view = file3dm.AllViews[i]; Console.WriteLine(view.Name); @@ -11,12 +15,18 @@ } Console.WriteLine("--- Named Views ---"); +Console.WriteLine("nº of named views: {0}", file3dm.AllNamedViews.Count); for ( var i = 0; i < file3dm.AllNamedViews.Count; i ++ ) { var view = file3dm.AllNamedViews[i]; Console.WriteLine(view.Name); ViewPortInfo(view.Viewport); } +// Add view to file +ViewInfo vi = new ViewInfo(); +vi.Name = "Added from rhino3dm"; +file3dm.AllViews.Add(vi); + void ViewPortInfo(ViewportInfo vp) { //Console.WriteLine("IsValidCameraFrame: {0}",vp.IsIsValidCameraFrame); diff --git a/rhino3dm/cs/SampleCSViewports/SampleCSViewports.csproj b/rhino3dm/cs/SampleCSViewports/SampleCSViewports.csproj index ab539e91..e3d4e399 100644 --- a/rhino3dm/cs/SampleCSViewports/SampleCSViewports.csproj +++ b/rhino3dm/cs/SampleCSViewports/SampleCSViewports.csproj @@ -7,8 +7,8 @@ enable - - + +