[VarDef,gOffset,0] [VarDef,gBytes,0] [VarDef,gNewLine,[StrMerge,[StrFromAsc,13],[StrFromAsc,10]]] [VarDef,gFilePath,""] [RoutineDef,WriteMem, [MemResize,ZB_TextOutputMem,[MemGetSize,ZB_TextOutputMem]+256] [VarSet,gBytes,[MemWriteString,ZB_TextOutputMem,pStr,gOffset,0]] [VarSet,gOffset,gOffset+gBytes] [MemResize,ZB_TextOutputMem,gOffset] ,pStr]//end routine [RoutineDef,SaveFile, //get file name [VarSet,gFilePath,[FileNameAsk,"TEXT(*.txt)|*.TXT||",SubTool_Y_Sizes.txt ,"Please Save File..."]] [If,[StrLength,gFilePath], [VarSet,lBytes,[MemSaveToFile,ZB_TextOutputMem,gFilePath,1]]//1 means will overwrite existing file ] [If,lBytes > 0, //OK we have written some bytes [Note,"File written successfully",,3] ,//else no bytes written [Note,"A error occured while writing file",,3] ] ]//end routine [IButton,"Show Y Size","Get and display SubTool Y Sizes", [If,[IExists,Tool:SubTool:Append],//checks to see if a 3D tool ,[Note,"Please Select a SubTool Mesh",,2,4737096] [Exit] ] [VarDef,ySizeStr,""] [MemDelete, ZB_TextOutputMem]//just makes sure this isn't around [MemCreate,ZB_TextOutputMem,256]//create memblock for text [VarSet,gOffset,0] [VarSet,gBytes,0] [VarSet,message,[StrMerge,"SubTool Y value: ",#gNewLine,#gNewLine]] [RoutineCall,WriteMem,#message]//saves the message to memory block [Note,message,,-1]//a display duration of -1 will combine with other notes [VarSet,activeST,[SubToolGetActiveIndex]] [Loop,[SubToolGetCount], [SubToolSelect,n] [VarSet,subToolName,[FileNameExtract,[GetActiveToolPath],2]] [VarSet,ySize,[IGet,Tool:Geometry:Y Size]]//get value [VarSet,ySizeStr,[Val,ySize]] //convert to string [VarSet,ySizeStr,[StrExtract,ySizeStr,0,[StrFind,".",ySizeStr]+2]]//reduce to 2 decimal places [VarSet,message,[StrMerge,subToolName," ",ySizeStr, #gNewLine]]//construct message [RoutineCall,WriteMem,#message]//saves the message to memory block [Note,message,,-1]//will display message ,n] [NoteIButton,"Save as Text"][NoteIButton,"OK"] [VarSet,result,[Note,""]]//this note is needed to display everything [If,result == 1,//Save as Text [RoutineCall,SaveFile] ,//else OK - do nothing ] [MemDelete, ZB_TextOutputMem]//delete the memblock as no longer needed [SubToolSelect,activeST] ]