
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Im working on a macro to Save my project into a designated directory on my PC based on the Model Name in PMill, The following macro gets me 99% of the way there I just have an extra "}" Character at the end of the save path that I cannot figure out why it is even there in the first place. Maybe its just something simple I have overlooked.
If my Model Name was 6H680 the location comes out a
'C:/Users/jroth/Desktop/Powermill Projects/7XXXX/72XXX/72028/72028 HSG PLT}}}'
STRING LIST models = {}
FOREACH md IN FOLDER('model') {
IF position($md.name, "Planes") == -1 {
INT k = add_last($models, $md.name)
}
}
STRING ModelName = ''
IF size($models) == 1 {
$ModelName = $models[0]
} ELSE {
$ModelName = INPUT ENTITY MODEL "Choose model"
}
//Disect Model Name
STRING PATH1 = Substring("$ModelName", 0, 1)
STRING PATH2 = Substring("$ModelName", 1, 1)
STRING PATH3 = Substring("$ModelName", 0, 5)
STRING X4 = "XXXX"
STRING X3 = "XXX"
//Output path
STRING PATH0 = "C:\Users\jroth\Desktop\Powermill Projects\$PATH1+$X4\$PATH1+$PATH2+$X3\$PATH3\$ModelName"
STRING SaveAs = $PATH0
//if project already exist, just save it.
IF dir_exists($saveas) {
PROJECT SAVE
//if project doesn't exist, save it as modelname in model location
} ELSE {
BOOL NameCheck = FALSE
STRING $Question = "Is this path and modelname correct?" +CRLF+ $saveas
$NameCheck = QUERY $Question
IF $NameCheck {
PROJECT SAVE AS $saveas
STRING $Message = "Project has been saved in" +CRLF+ $saveas
MESSAGE INFO $Message
}
}
Solved! Go to Solution.