Is it possible to open a file in a zip file?


#1

I made a zip file called “test.zip” of a small rhino file called “test.3dm” and put it on C:
Then I tried this to see if it would open it:

import rhinoscriptsyntax as rs
rs.Command ("-_Open c:\test.zip\test.3dm _Enter" )

But I get an “Rhino Plug-in Error: Unable to load plug-in…”


(Dale Fugier) #2

That’s not going to work. You will need to open the zip file, and extract the archive, and then pass the name of the archive to the open command.


#3

OK, thanks!


#4

you could do it via some .Net libraries. for example:


#5

@Goswin That became to complex for me… :smile:

I figure I’d have to check the host computer for .net version and abort if lower than 4.5, make a directory, extract the files there, open, delete and so on.
I guess it will be better for me to just release the files under Creative Commons.

But thank you for the feedback, I appreciate that a lot!


#6

I’m using Ionic.zip.dll for creating zips and extracting.
Very easy and free library!

Because I’m using .net 4.0 it made life easier for me


#7

Thanks, but would this require the user to install the library?

I know that Rhino can open a file within a zip. One has to paste the adress into the open dialog box, and then Rhino will find the files within the zip. But I am not able to do so with the -open command.

But it doesn’t really matter, the intent was only to protect the 3D mini file from free distribution.
I would have liked to put a code on the zip file, and then put that code within the plugin, but it becomes too complex I presume.

Thanks anyway @jordy1989


#8

Oops. Read it wrong. Though you were using a rhinocommon (.net library)
If you were using a C# or Vb.Net you could have used the library and add it to the plugin folder.
Dont know how it works with Scripting. Think you need to Import the dll and add it to your scriptfolder?

P.S. You can create a new filename type and protect it from being read and create a command that, if a filetype with that name is being read, it will be decrypted.


#9

I don’t know, and it is not very important, but thanks for looking into it!