Create a Inventor environment folder

Create a Inventor environment folder

Anonymous
Not applicable
589 Views
4 Replies
Message 1 of 5

Create a Inventor environment folder

Anonymous
Not applicable

Is it possible to create an iLogic rule that allows you to create a folder and several pads with predefined names?

0 Likes
Accepted solutions (1)
590 Views
4 Replies
Replies (4)
Message 2 of 5

JelteDeJong
Mentor
Mentor

are you looking for something like this?

' define path where environments are created
Dim mainPath As String = "D:\forum"
' definf sube folder name 
Dim subFolder As String = "sub folder"

' ask the name of for a folder name
Dim result As String = InputBox("environment folder name", "environment", "name here")

' cretae strings with the paths to create
Dim environmentPath As String = IO.Path.Combine(mainPath, result)
Dim subPath As String = IO.Path.Combine(environmentPath, subFolder)

' create the paths on drive
IO.Directory.CreateDirectory(environmentPath)
IO.Directory.CreateDirectory(subPath)

' open the main folder
Process.Start(environmentPath)

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 5

Anonymous
Not applicable

Thank you. It helped me understand how it works. I adjusted it a little. Do I need to know how to do to me vytviřílo more subdirectories.

 

' define path where environments are created
Dim mainPath As String = ThisDoc.Path

' ask the name of for a folder name
Dim result As String = "Data CNC"

' definf sube folder name 
Dim subFolder As String = "Sheets"
Dim subFolder As String = "Plastics"
Dim subFolder As String = "MDV"
' cretae strings with the paths to create, vytvoří řetězce s cestami k vytvoření Dim environmentPath As String = IO.Path.Combine(mainPath, result) Dim subPath As String = IO.Path.Combine(environmentPath, subFolder) ' create the paths on drive, vytvořtí cesty na jednotce IO.Directory.CreateDirectory(environmentPath) IO.Directory.CreateDirectory(subPath) ' open the main folder, otevře hlavní složku Process.Start(environmentPath)
0 Likes
Message 4 of 5

JelteDeJong
Mentor
Mentor
Accepted solution

What do you think of this?

' create environment folder
Dim mainPath As String = ThisDoc.Path
Dim environmentPath As String = IO.Path.Combine(mainPath, "Data CNC")
IO.Directory.CreateDirectory(environmentPath)


' definf subfolder name 
Dim subFolders As List(Of String) = New List(Of String)()
subFolders.Add("Sheets")
subFolders.Add("Plastics")
subFolders.Add("MDV")

' create sub folders
For Each subFolder As String In subFolders
    Dim subPath As String = IO.Path.Combine(environmentPath, subFolder)
    IO.Directory.CreateDirectory(subPath)
Next

Process.Start(environmentPath)

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 5 of 5

Anonymous
Not applicable

Thanks. You helped me a lot. I was thinking about it a little bit and I thought of that. But yours is easier.

 

' define path where environments are created
Dim mainPath As String = ThisDoc.Path

' ask the name of for a folder name
Dim result As String = "Data CNC"

' definf sube folder name 
Dim subFolder As String = "MDV"
Dim subFolder1 As String = "plechy"
Dim subFolder2 As String = "plasty"


' cretae strings with the paths to create, vytvoří řetězce s cestami k vytvoření
Dim environmentPath As String = IO.Path.Combine(mainPath, result)
Dim subPath As String = IO.Path.Combine(environmentPath, subFolder)
Dim subPath1 As String = IO.Path.Combine(environmentPath, subFolder1)
Dim subPath2 As String = IO.Path.Combine(environmentPath, subFolder2)


' create the paths on drive, vytvořtí cesty na jednotce
IO.Directory.CreateDirectory(environmentPath)
IO.Directory.CreateDirectory(subPath)
IO.Directory.CreateDirectory(subPath1)
IO.Directory.CreateDirectory(subPath2)



' open the main folder, otevře hlavní složku
Process.Start(environmentPath)
0 Likes