Kind of looking for anything like ImageMagick (A swiss army knife command line tool for modifying images), except for STLs instead of images.

Something like:swbluto wrote:Is there an app that will do this?
With rescaled.scad containing:openscad -D "fudge=[1.07,1.07,1.00]" -D filename="whatever.stl" -o "whatever-scaled.stl" rescale.scad
Code: Select all
filename = "dummy.stl";
fudge = [1.00,1.00,1.00];
scale(fudge) import(filename);
Probably should look at the STL documentation, but I'd surmise the facet is defining the normal vector (The fact its length is always equal to 1 suggests this.), and the numbers next to the vertex line are the x,y and z positions of the point. So to scale by 7% in the X and Y, all I'd really have to do is multiply all those vertex X & Y numbers by 1.07, right? Should be a piece of cake, just wondering if there's any gotchas I'll encounter in the wooly world of STL files.facet normal 0 -1 -0
outer loop
vertex -18.8263 -2.59997 9
vertex -19.8987 -2.59997 0
vertex -18.8263 -2.59997 0
endloop
endfacet
facet normal -0.0410955 -0.999155 0
outer loop
vertex -18.8263 -2.59997 0
vertex -18.2473 -2.62378 9
vertex -18.8263 -2.59997 9
endloop
endfacet
facet normal -0.0410955 -0.999155 -0
outer loop
vertex -18.2473 -2.62378 9
vertex -18.8263 -2.59997 0
vertex -18.2473 -2.62378 0
endloop
endfacet
You can scale it in S3D, but you must use the GUI as it offers no command line functionality. Not useful when I have to rescale 2000+ models.jsc wrote:Slic3r and Simplify3D can scale your models in any axis independently.
Code: Select all
DirectoryInfo d = new DirectoryInfo(p);
dl("Got directory info:" + d.FullName);
string newln = "";
StringBuilder outlns = new StringBuilder();
foreach (var file in d.GetFiles("*.stl"))
{
string[] con = File.ReadAllLines(file.FullName);
foreach (String ln in con)
{
newln = "";
if (ln.Contains("vertex"))
{
string[] prts = ln.Trim().Split(' ');
if (prts[0].Contains("vertex"))
{
double x, y, z;
Double.TryParse(prts[1], out x);
Double.TryParse(prts[2], out y);
Double.TryParse(prts[3], out z);
double newx = x * STL_SCALEFACTOR;
double newy = y * STL_SCALEFACTOR;
newln = " vertex " + newx + " " + newy + " " + z;
}
}
if (newln.Length > 0)
outlns.AppendLine(newln);
else
outlns.AppendLine(ln);
}
File.WriteAllText(file.FullName, outlns.ToString());
}
Lol. I don't like using 'var' because it makes it harder to read the code during maintenance/improvement/changes later on.insta wrote:You'd have written that code in 14.7 minutes if you used 'var' for everything like you're supposed to
Code: Select all
DirectoryInfo d = new DirectoryInfo(p);
Code: Select all
var directoryInfo = new DirectoryInfo(p);
If it makes you feel any better, I'm pretty sure I just copied and pasted that from a stack overflow thread, lol. Regardless, I would've done it much the same.insta wrote:Way more readable than:Code: Select all
DirectoryInfo d = new DirectoryInfo(p);
Code: Select all
var directoryInfo = new DirectoryInfo(p);