Create folder within toolpath explorer's folder

Create folder within toolpath explorer's folder

karan30782
Advocate Advocate
891 Views
6 Replies
Message 1 of 7

Create folder within toolpath explorer's folder

karan30782
Advocate
Advocate

Hi all !

 

I'm tring to make a macro which will create some folders eg. ROUGH & FINISH in each folder which are already available in toolpath explorer.

Like I have 3 folders named Electrode 01,Electrode 02,Electrode 03.

I need to create ROUGH & FINISH folders in all 3 folders , which I already have.

please have a look on my macro and  point me in right direction.

 

 

REAL lengthx = ""
REAL lengthy = ""
REAL lengthz = ""
STRING limits = ""
STRING R = 'ROUGH'
STRING F = 'FINISH'


FOREACH ll IN FOLDER ('LEVEL') {
UNDRAW LEVEL ALL DRAW LEVEL $ll.name
EDIT LEVEL $ll.name SELECT SURFACE
FORM BLOCK
EDIT BLOCK RESETLIMIT "0"
DELETE BLOCK
EDIT BLOCK RESET
DRAW BLOCK
DELETE SCALE
$lengthx = $widget("RoughBlock.LimitFrame.LenX").value
$lengthy = $widget("RoughBlock.LimitFrame.LenY").value
$lengthz = $widget("RoughBlock.LimitFrame.LenZ").value
$limits = $ll.name + " _ " + round($lengthx, 0) + " X " + round($lengthy, 0) + " X " +  round($lengthZ, 0)

BLOCK ACCEPT

IF NOT folder_exists("Toolpath\" + $limits ) {
	CREATE FOLDER "Toolpath" $limits + '\' + '$R'
        CREATE FOLDER "Toolpath" $limits + '\' + '$F'

}
}

 

Thank you !

0 Likes
Accepted solutions (1)
892 Views
6 Replies
Replies (6)
Message 2 of 7

icse
Advisor
Advisor

exchange this:

//you whant to create the subfolder only if the main folder exists(removed the not)
IF folder_exists("Toolpath\" + $limits ) {	
	string $path = 'Toolpath\' + $limits
	CREATE FOLDER ${path} ${R}
    CREATE FOLDER ${path} ${S}
}
0 Likes
Message 3 of 7

karan30782
Advocate
Advocate

Not working ..... BRO

0 Likes
Message 4 of 7

icse
Advisor
Advisor

can you show me the error message?

0 Likes
Message 5 of 7

karan30782
Advocate
Advocate

It doesn't show any error ,but not any folder nor sub folder created.

 

1.JPG

 

0 Likes
Message 6 of 7

icse
Advisor
Advisor
Accepted solution

ah now i see... i thougth the base folders are already existant as you wrote in your original post.

 

try this then:

 

REAL lengthx = ""
REAL lengthy = ""
REAL lengthz = ""
STRING limits = ""
STRING R = 'ROUGH'
STRING F = 'FINISH'


FOREACH ll IN FOLDER ('LEVEL') {
	UNDRAW LEVEL ALL DRAW LEVEL $ll.name
	EDIT LEVEL $ll.name SELECT SURFACE
	FORM BLOCK
	EDIT BLOCK RESETLIMIT "0"
	DELETE BLOCK
	EDIT BLOCK RESET
	DRAW BLOCK
	DELETE SCALE
	$lengthx = $widget("RoughBlock.LimitFrame.LenX").value
	$lengthy = $widget("RoughBlock.LimitFrame.LenY").value
	$lengthz = $widget("RoughBlock.LimitFrame.LenZ").value
	$limits = $ll.name + " _ " + round($lengthx, 0) + " X " + round($lengthy, 0) + " X " +  round($lengthZ, 0)
	
	BLOCK ACCEPT
	
	CREATE FOLDER 'Toolpath' ${limits}
	IF folder_exists("Toolpath\" + $limits ) {	
		string $path = 'Toolpath\' + $limits
		CREATE FOLDER ${path} ${R}
		CREATE FOLDER ${path} ${F}
	}
}

 

Message 7 of 7

karan30782
Advocate
Advocate

It's fantastically working !

 

 

Thank you !!

0 Likes