iLogic save to directory

iLogic save to directory

b.ziegler
Enthusiast Enthusiast
1,649 Views
5 Replies
Message 1 of 6

iLogic save to directory

b.ziegler
Enthusiast
Enthusiast

Good Morning,

I have two questions here.  The first pertains to actual coding help.

 

I have inherited an iLogic program that exports dxfs of all of the sheet metal parts in an assembly.  it currently exports them to a subfolder that it creates under the assembly folder.  

What we would like to do now is have it save to a different folder.

 

So currently it saves to <project folder>\assemblies\<asm name> DXF Files

We would like it to save to <project folder>\DXFs\<asm names> DXFs

 

The section of the code that saves the files is:

oFolder = oPath & "\" & oAsmName & " DXF Files"
' Create DXF Folder
If Not System.IO.Directory.Exists(oFolder) Then
	System.IO.Directory.CreateDirectory(oFolder)
End If

 I would be perfectly happy if a dialog box popped up and we had to navigate to the new directory.

 

Thank you for any help you can provide here.

 

The second question is: how does one go about learning iLogic?

0 Likes
Accepted solutions (1)
1,650 Views
5 Replies
Replies (5)
Message 2 of 6

JhoelForshav
Mentor
Mentor
Accepted solution

Hi @b.ziegler 

 

try changing the code you just posted to this 🙂

 

Dim oDialog As New FolderBrowserDialog
oDialog.Description = "Select directory to save DXF files"
oDialog.RootFolder = System.Environment.SpecialFolder.MyComputer
Dim oRes As DialogResult = oDialog.ShowDialog()
If oRes = DialogResult.OK Then
	oFolder = oDialog.SelectedPath
Else
	MessageBox.Show("No folder selected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
	Exit Sub
End If
Message 3 of 6

b.ziegler
Enthusiast
Enthusiast

Very Nice

Thank you, I appreciate your help

Message 4 of 6

b.ziegler
Enthusiast
Enthusiast

I tweaked the code Slightly so that the folder location dialog defaults to the root directory of the project.  This makes it much more convenient and less clicking through our file system.

 

The added line is in bold

' Folder Location
Dim oDialog As New FolderBrowserDialog
oDialog.Description = "Select directory to save DXF files"
oDialog.RootFolder = System.Environment.SpecialFolder.MyComputer
oDialog.SelectedPath = oPath
Dim oRes As DialogResult = oDialog.ShowDialog()
If oRes = DialogResult.OK Then
	oFolder = oDialog.SelectedPath
Else
	MessageBox.Show("No folder selected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
	Exit Sub
End If

 Thank you for your help @JhoelForshav 

0 Likes
Message 5 of 6

rdsmith8R6TS
Explorer
Explorer

I have this bit of code running inside another code that I have compiled from other sources. This code has an option to save the current file or all open files. I want to keep this feature but this new bit of code asks for the save directory of each file. Is there anyway to just choose the save directory for all files at once?

0 Likes
Message 6 of 6

rdsmith8R6TS
Explorer
Explorer

I managed to fix my own issue. If anyone is interested please feel free to use this code.

0 Likes