Create Folder In NC Program

Create Folder In NC Program

newgentooling
Contributor Contributor
1,029 Views
4 Replies
Message 1 of 5

Create Folder In NC Program

newgentooling
Contributor
Contributor

Dear Sir,

                We Create The Folder Before Starting The Nc Programming. After Complete The Programming. We Required The Output With Folder.(Refer The Attached Video)

0 Likes
1,030 Views
4 Replies
Replies (4)
Message 2 of 5

karan30782
Advocate
Advocate

Hi ! @newgentooling 

 

You can try this if it can help you ....

 

 

STRING $dir1 = 'ABCV-01'
STRING $dir2 = 'AXCN-02'
STRING $dir3 = 'BGHP-03'
STRING $dir4 = 'BLPR-04'

 

STRING $dirpath = project_pathname(0) + "\ncprograms\" + '$dir1'
MKDIR $dirpath

STRING $dirpath1 = project_pathname(0) + "\ncprograms\" + '$dir2'
MKDIR $dirpath1

STRING $dirpath2 = project_pathname(0) + "\ncprograms\" + '$dir3'
MKDIR $dirpath2

STRING $dirpath3 = project_pathname(0) + "\ncprograms\" + '$dir4'
MKDIR $dirpath3

OLE FILEACTION "OPEN" $dirpath

 

Cheers ,

0 Likes
Message 3 of 5

Pijetro
Advocate
Advocate

I stumbled upon this by accident.

But if you use a forward slash (/) in your output name, you will create a subfolder within the NC program..

 

I hope this helps..

0 Likes
Message 4 of 5

newgentooling
Contributor
Contributor

Dear Sir,

                   Thanks For Your Support. Please ref Attached Sheet, We Required Automatic Folder NC output Program.

0 Likes
Message 5 of 5

karan30782
Advocate
Advocate

Hi !

 

Otherwise you can use it this way also

 

//macro will create required number of folders with required name.
INT $nFolder = INPUT "Enter the number of folders"
INT $count = 0

 

//This will create folder in your toolpath explorer

WHILE $count < $nFolder {
STRING $folder = INPUT "Enter the folder name"
STRING $path = 'NCProgram\' + $folder
IF NOT folder_exists($path) {
CREATE FOLDER "NCProgram" $folder
}

//This will create folder in your ncprograms explorer

$path = 'Toolpath\' + $folder
IF NOT folder_exists($path) {
CREATE FOLDER "Toolpath" $folder
}

$count = $count + 1

//This will create folder in your project directory ncprogram folder
STRING $dirpath = project_pathname(0) + "/ncprograms/" + '$folder'
MKDIR $dirpath

}

0 Likes