How Open 3dm and small save use OpenNURBS.NET?


#1

There are many 3dm file (v4), How these 3DM (V4) files convert to V5 use OpenNURBS.NET, and use small save ?


(Dale Fugier) #2

Do you have Rhino 5? If so, you could easily write a script to do this. Here is an example:

https://github.com/mcneel/rhinoscript/blob/master/BatchSaveSmall.rvb


#3

Thank you!
But small save is a part of in my Winform program ,so I want to use OpenNURBS.NET.


(Dale Fugier) #4

Saving small is essentially saving all Breps without cached meshes (i.e. render and analysis). Does this help?


#5

Yes!This is what I want.
do you have examples?


(Dale Fugier) #6

You will need to start by building Rhino3dmIO.

Have you done this?


#7

No RenderMeshe or AnalysisMeshes in Rhino3dmIO.

Only RMA.OpenNURBS.OnBinaryArchive have
public bool EnableSave3dmAnalysisMeshes(bool enable)
public bool EnableSave3dmRenderMeshes(bool enable)

my code:

            OpenFileDialog ofd = new OpenFileDialog();

        if (ofd.ShowDialog() != System.Windows.Forms.DialogResult.OK)
        {
            ofd.Dispose();
            return;
        }

        string fn = ofd.FileName;
        OnFileHandle ofh = OnUtil.OpenFile(fn, "wb");

        OnBinaryArchive oba = new OnBinaryFile(IOn.archive_mode.wirte3dm,ofh);//no work
     
        OnXModel oxm = new OnXModel();
        oxm.Read(fn);//OK

        oxm.Write(oba,5);//Return false.  why?

        oba.EnableSave3dmRenderMeshes(false);
        oba.EnableSave3dmAnalysisMeshes(false);
//test
        oxm.Write(@"d:\temp\"+ofd.SafeFileName, 5);//Return true,OK
        oxm.Write(oba,5);//Return false
        ofh.Dispose();
        oxm.Dispose();
        oba.Dispose();
        ofd.Dispose();
......

#8

Hi dale
My problem not solved , Please help me please ,thank you!


(Dale Fugier) #9

I will try to work you up a sample. It might take me a few days to get to it.

Thanks,

– Dale


(Dale Fugier) #10

If you are using the old opennurbs.net DLL, then keep in mind that this was produced before Rhino 5 was released. Thus, the library is only capable of reading and writing files prior to version 5. You cannot use the old opennurbs.dll to read or write Rhino 5 3DM files.

Looking at the new Rhino3dmIO toolkit, it do not see a way of destroying meshes that are cached on Breps. Also, there are no equvalents to EnableSave3dmRenderMeshes(), EnableSave3dmAnalysisMeshes() and EnableSaveUserData(). I will see these are added to the “to-do” list.


#11

So,I need wait for the new Rhino3dmIO toolkit? :frowning:


(Dale Fugier) #12

Yes I believe so. Not unless @stevebaer has any ideas…


(Steve Baer) #13

You should be able to compile Rhino3dmIo toolkit right now if you have the both visual c# and c++ . We will also be delivering a nuget package for Rhino3dmIo very soon.


(Steve Baer) #14

@Alain, where are we with respect to releasing nuget packages? Are you just waiting on me?


(Alain Cormier) #15

Hi @Steve, Sorry I missed this thread. The packages are available and to add them to your solution just search for “Rhino3dmIO” in the online packages under nuget.org in VS (Tools -> Library Package Manager -> Manage NuGet Pagkages For Solution …)


RhinoCommon, Rhino3dmIO, OpenNURBS.NET - what are the differences?
(Steve Baer) #16

Looks like Rhno3dmIo is available on nuget, so you should just be able to use the library in your project.


#17

Thank @Alain, @stevebaer, @dale
I can to compile Rhino3dmIo toolkit ,but there are no equvalents to EnableSave3dmRenderMeshes(), EnableSave3dmAnalysisMeshes() and EnableSaveUserData() in Rhino3dmIo toolkit.


(Steve Baer) #18

Ok, we’ll look into adding these functions to RhinoCommon and updating the nuget packages. If you are using nuget, hopefully you’ll get a notification of the update.


(Menno Deij - van Rijswijk) #19

NuGet will not send “push” style notifications. You have to update manually in VS using Manage NuGet packages, click updates. This can be done on an individual project or for a complete solution.


(Steve Baer) #20

I just added an overload to File3dm.Write in Rhino3dmIo on github that takes options for saving meshes and user data. @Alain, can you push out a new nuget build when you get a chance? Thanks.