ilogic - create a .zip file

ilogic - create a .zip file

Anonymous
Not applicable
1,255 Views
3 Replies
Message 1 of 4

ilogic - create a .zip file

Anonymous
Not applicable

has anyone ever used ilogic to create a .zip?

 

Currently we export pdf and dxf upon file release and was wondering if anyone has done similar and managed to create a zip file of their exported docs?

 

thx in advance

0 Likes
1,256 Views
3 Replies
Replies (3)
Message 2 of 4

ekinsb
Alumni
Alumni

iLogic provides a somewhat simplified interface to the Inventor API and Visual Basic.  However, because it's using the .NET engine you have full access to the capabilities of the .NET framework, which does support creating zip archives.  Here's a rule that zips up the contents of the folder "C:\Temp\AnswerDay" and creates the archive "C:\Temp\AnswerDay.zip"

 

AddReference "System.IO.Compression"
AddReference "System.IO.Compression.FileSystem"

If System.IO.File.Exists("C:\Temp\AnswerDay.zip")
    System.IO.File.Delete("C:\Temp\AnswerDay.zip")
End If

System.IO.Compression.ZipFile.CreateFromDirectory("C:\Temp\AnswerDay", "C:\Temp\AnswerDay.zip")

Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 4

Anonymous
Not applicable

hi brian

 

that seems to work, it does create the zip file, but throws an error afterwards

 

" the process cannot access the file "C:\temp\xxxx.zip" because it is being used by another process.

 

any ideas on how to resolve and remove the error?

 

many thanks for your input!

0 Likes
Message 4 of 4

adam.nagy
Autodesk Support
Autodesk Support

"but throws an error afterwards"

 

When exactly does the error appear?

 

Are you trying to do something with the zip afterwards in your code?

 

Could you please try to narrow down the issue to a minimal sample?



Adam Nagy
Autodesk Platform Services
0 Likes