discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

OpenSCAD Power Shell Progress Bar

F
fractorr
Sun, Feb 17, 2019 7:00 PM

I have started using OpenSCAD command a lot and sometimes generate hundreds
of stl files using arguments.  I thought it would be nice to be have a
progress bar when generating a large number of stl's.  This is what I came
up with and this is only tested on Windows 10 using Power Shell, just
thought I would share it, I generate $cmds with PHP.

$cmds = @(
'-o some_file_1.stl some_scad_file.scad -D arg1=1 - arg2=1 -D arg3=1',
'-o some_file_2.stl some_scad_file.scad -D arg1=2 - arg2=2 -D arg3=2',
'-o some_file_3.stl some_scad_file.scad -D arg1=3 - arg2=3 -D arg3=3',
'-o some_file_4.stl some_scad_file.scad -D arg1=4 - arg2=4 -D arg3=4',
'-o some_file_5.stl some_scad_file.scad -D arg1=5 - arg2=5 -D arg3=5'
)

for($C = 0; $C -lt $cmds.Count; $C++ )
{Write-Progress -Activity Updating -Status 'Progress->' -PercentComplete
(($C+1)/$cmds.Count*100) -CurrentOperation OuterLoop; `

Start-Process -FilePath "openscad.com" -ArgumentList $cmds[$c] -Wait

-NoNewWindow -RedirectStandardOutput nul

}

--
Sent from: http://forum.openscad.org/

I have started using OpenSCAD command a lot and sometimes generate hundreds of stl files using arguments. I thought it would be nice to be have a progress bar when generating a large number of stl's. This is what I came up with and this is only tested on Windows 10 using Power Shell, just thought I would share it, I generate $cmds with PHP. $cmds = @( '-o some_file_1.stl some_scad_file.scad -D arg1=1 - arg2=1 -D arg3=1', '-o some_file_2.stl some_scad_file.scad -D arg1=2 - arg2=2 -D arg3=2', '-o some_file_3.stl some_scad_file.scad -D arg1=3 - arg2=3 -D arg3=3', '-o some_file_4.stl some_scad_file.scad -D arg1=4 - arg2=4 -D arg3=4', '-o some_file_5.stl some_scad_file.scad -D arg1=5 - arg2=5 -D arg3=5' ) for($C = 0; $C -lt $cmds.Count; $C++ ) {Write-Progress -Activity Updating -Status 'Progress->' -PercentComplete (($C+1)/$cmds.Count*100) -CurrentOperation OuterLoop; ` Start-Process -FilePath "openscad.com" -ArgumentList $cmds[$c] -Wait -NoNewWindow -RedirectStandardOutput nul } -- Sent from: http://forum.openscad.org/