estimating print volumes for large numbers of models

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

estimating print volumes for large numbers of models

jon_bondy
I need to run a single OpenSCAD script about 250 times to generate 250
variant STL files and then estimate print weights/volumes.  I think I
can run the script 250 times.  Has anyone automated the other part,
getting volumes for the STL files?  I know the values are available from
slicers, at least on the screen.

Jon
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: estimating print volumes for large numbers of models

nophead
The weight is a function of the slicer settings and the filament type, so I think you can only get it from a slicer. So the question boils down to can you run the slicer from the command line. I only use Skeinforge and that can certainly do it.

On Sun, 28 Mar 2021 at 12:05, jon <[hidden email]> wrote:
I need to run a single OpenSCAD script about 250 times to generate 250
variant STL files and then estimate print weights/volumes.  I think I
can run the script 250 times.  Has anyone automated the other part,
getting volumes for the STL files?  I know the values are available from
slicers, at least on the screen.

Jon
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: estimating print volumes for large numbers of models

jon_bondy

Right.  So it would require running PrusaSlicer and capturing the text output; not sure that this is possible.

On 3/28/2021 7:25 AM, nop head wrote:
The weight is a function of the slicer settings and the filament type, so I think you can only get it from a slicer. So the question boils down to can you run the slicer from the command line. I only use Skeinforge and that can certainly do it.

On Sun, 28 Mar 2021 at 12:05, jon <[hidden email]> wrote:
I need to run a single OpenSCAD script about 250 times to generate 250
variant STL files and then estimate print weights/volumes.  I think I
can run the script 250 times.  Has anyone automated the other part,
getting volumes for the STL files?  I know the values are available from
slicers, at least on the screen.

Jon

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: estimating print volumes for large numbers of models

cacb
In reply to this post by jon_bondy
On 28.03.2021 13:05, jon wrote:
> I need to run a single OpenSCAD script about 250 times to generate 250
> variant STL files and then estimate print weights/volumes.  I think I
> can run the script 250 times.  Has anyone automated the other part,
> getting volumes for the STL files?  I know the values are available from
> slicers, at least on the screen.

If you export as .OBJ or .OFF, you can compute the volume with AngelCAD.
It is 2 lines of code (assuming "filename.obj" is an existing file):

    polyhedron poly("filename.obj");
    cout << "Volume = " << poly.volume() << endl;


To automate this for any file, save the script below as "volume.as"

void main()
{
    as_args@ args   = GetArgs();
    string filename = args.get_string("filename");
    polyhedron poly(filename);
    cout << filename << " volume = " << poly.volume() << endl;
}

Then run the script compiler from the command line with your file as
input argument:

$ as_csg volume.as -args filename=./testfile.obj

You get console output like below:

as_csg started.
./testfile.obj volume = 25.126359556


Under linux, you could run a bash script to automate for all files in a
folder:

#!/bin/bash
for f in *.OBJ
do
    as_csg volume.as -args filename="$f"
done

for Windows: same thing, different syntax.

Obviously, the above could also be extended to convert each file from
STL to OBJ using polyfix, if you have only STL files.

Carsten Arnholm
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: estimating print volumes for large numbers of models

caggius
The amount of filament used is buried at the bottom of the gcode file by PRUSA - so if you can automate the slicing you can get the meters of filament used by parsing the gcode files.

> On 28 Mar 2021, at 13:48, Carsten Arnholm <[hidden email]> wrote:
>
> On 28.03.2021 13:05, jon wrote:
>> I need to run a single OpenSCAD script about 250 times to generate 250 variant STL files and then estimate print weights/volumes.  I think I can run the script 250 times.  Has anyone automated the other part, getting volumes for the STL files?  I know the values are available from slicers, at least on the screen.
>
> If you export as .OBJ or .OFF, you can compute the volume with AngelCAD. It is 2 lines of code (assuming "filename.obj" is an existing file):
>
>   polyhedron poly("filename.obj");
>   cout << "Volume = " << poly.volume() << endl;
>
>
> To automate this for any file, save the script below as "volume.as"
>
> void main()
> {
>   as_args@ args   = GetArgs();
>   string filename = args.get_string("filename");
>   polyhedron poly(filename);
>   cout << filename << " volume = " << poly.volume() << endl;
> }
>
> Then run the script compiler from the command line with your file as input argument:
>
> $ as_csg volume.as -args filename=./testfile.obj
>
> You get console output like below:
>
> as_csg started.
> ./testfile.obj volume = 25.126359556
>
>
> Under linux, you could run a bash script to automate for all files in a folder:
>
> #!/bin/bash
> for f in *.OBJ
> do
>   as_csg volume.as -args filename="$f"
> done
>
> for Windows: same thing, different syntax.
>
> Obviously, the above could also be extended to convert each file from STL to OBJ using polyfix, if you have only STL files.
>
> Carsten Arnholm
> _______________________________________________
> OpenSCAD mailing list
> To unsubscribe send an email to [hidden email]
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: estimating print volumes for large numbers of models

jon_bondy
You are correct!  So all I need to do now is figure out how to run
PrusaSlicer from the command line (in Windows).  There are obscure hints
about this on the web, but no clear instructions from Prusa that I could
locate.

On 3/28/2021 10:19 AM, Bob Carter wrote:
> The amount of filament used is buried at the bottom of the gcode file by PRUSA - so if you can automate the slicing you can get the meters of filament used by parsing the gcode files.
>
>> On 28 Mar 2021, at 13:48, Carsten Arnholm <[hidden email]> wrote:
>>
>> On 28.03.2021 13:05, jon wrote:
>>> I need to run a single OpenSCAD script about 250 times to generate 250 variant STL files and then estimate print weights/volumes.  I think I can run the script 250 times.  Has anyone automated the other part, getting volumes for the STL files?  I know the values are available from slicers, at least on the screen.
>>
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: estimating print volumes for large numbers of models

mondo
In reply to this post by jon_bondy

In Cura if you look in the g-code (first three lines)

;FLAVOR:Marlin
;TIME:7304
;Filament used: 3.88246m

Easy enough to calculate the cost of the job from that. I've never bothered, but it is possible to enter cost in the filament details, ans afaik it will give the cost of the filament for the job.

You can readily run Cura from the command line something like CuraEngine slice [-v] [-p] [-j <settings.json>] [-s <settingkey>=<value>] [-g] [-e] [-o <output.gcode>] [-l <model.stl>] [–next]

On 28/03/2021 13:12, jon wrote:

Right.  So it would require running PrusaSlicer and capturing the text output; not sure that this is possible.

On 3/28/2021 7:25 AM, nop head wrote:
The weight is a function of the slicer settings and the filament type, so I think you can only get it from a slicer. So the question boils down to can you run the slicer from the command line. I only use Skeinforge and that can certainly do it.

On Sun, 28 Mar 2021 at 12:05, jon <[hidden email]> wrote:
I need to run a single OpenSCAD script about 250 times to generate 250
variant STL files and then estimate print weights/volumes.  I think I
can run the script 250 times.  Has anyone automated the other part,
getting volumes for the STL files?  I know the values are available from
slicers, at least on the screen.

Jon

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: estimating print volumes for large numbers of models

cacb
In reply to this post by caggius
On 2021-03-28 16:19, Bob Carter wrote:
> The amount of filament used is buried at the bottom of the gcode file
> by PRUSA - so if you can automate the slicing you can get the meters
> of filament used by parsing the gcode files.

If you are using a filament based printer, yes. Then you may have to
iterate over slicer settings also, maybe. It all depends on what is
meant by "print volume".

Carsten Arnholm
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: estimating print volumes for large numbers of models

blobule
In reply to this post by jon_bondy

Hi Jon,

I've done this in OpenSCAD, in 2016 :-)

See this original post from this list:  http://forum.openscad.org/Volume-and-Center-of-mass-td15421.html#a15458

In particular, I made this directly possible (automatic adjustment of a model parameter to get a desired volume):

My suggestion to add this in OpenSCAD was never accepted ( https://github.com/openscad/openscad/pull/1713 ).

At this point, I have stopped wasting my time trying to convince anyone that computing volumes, center of mass and bounding box in openscad is useful.

Every time I see a request like yours, I hope the devs will change their views on adding this feature.

In the mean time, I build my own Openscad clone, Luacad, based on.. lua. Simpler to code, more features, parallel evaluation, sharable persistent caches, ... I am happy with it. I don't have time to make it fully public, as this requires quite a lot of time and effort. I just wish the openscad dev would realize the true potential of advanced features like volume/center of mass/bounding box, and focus much less on the user interface, themes, and color schemes :-) 

For your specific problem, I'll be happy to help. I could make my openscad-with-probe version working and see if it can tackle your problem.

If you only care about scaling an object to a specific volume, thats easy. Get the volume once, then scale by cubic root of the ratio of desired volume over measured volume (ex: a cube with volume 8 is scaled x2 from a cube of volume 1).

If you want to search for a single parameter that changes the model in a more complex way, and if the relationship is monotonic, then you can binary search inside openscad and find the correct value. That what I did for the bottles.

For more parameters, this gets not-so-obvious.... maybe run openscad with command line parameters, get the volume, and use an outside solver to get the solution... not easy but would be cool :-)

Sincerely,

Sébastien


Le 2021-03-28 à 07 h 05, jon a écrit :
I need to run a single OpenSCAD script about 250 times to generate 250 variant STL files and then estimate print weights/volumes.  I think I can run the script 250 times.  Has anyone automated the other part, getting volumes for the STL files?  I know the values are available from slicers, at least on the screen.

Jon
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]

_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: estimating print volumes for large numbers of models

jon_bondy
Thanks for your offer of help.

What I am really looking for is the printed weight, so that I can
estimate shipping costs, print times, and print costs.  It seems that
you are working on the volume of the entire object, and interesting
problem, but not the one I need to solve at the moment.

Jon

On 3/31/2021 11:12 AM, Sébastien Roy wrote:

>
> Hi Jon,
>
> I've done this in OpenSCAD, in 2016 :-)
>
> See this original post from this list:
> http://forum.openscad.org/Volume-and-Center-of-mass-td15421.html#a15458
>
> In particular, I made this directly possible (automatic adjustment of
> a model parameter to get a desired volume):
>
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]
Reply | Threaded
Open this post in threaded view
|

estimating print volumes for large numbers of models

CasaDelGato
On Wed Mar 31 09:05:28 PDT 2021 [hidden email] said:
>What I am really looking for is the printed weight, so that I can
>estimate shipping costs, print times, and print costs. 

Run the resulting model through a 3D print slicer and see the estimate of Filament usage.


--

Try my Sensible Email package!  https://sourceforge.net/projects/sensibleemail/
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to [hidden email]