Benutzer-Werkzeuge

Webseiten-Werkzeuge


knowledgebase:trace2scad

Dies ist eine alte Version des Dokuments!


trace2scad

Trace2scad ist ein Open-Source basierter Code der als Shellanwendung auf jedem (Linux) Rechner eingesetzt werden kann. Dieses einfache Script erlaubt es Bilder und Grafiken aus verschiedenen Quellen in ein für openSCAD lesbares Format umzuwandeln. Das Script findet Ihr hier.

==== Diese Seite befindet sich noch in Bearbeitung ==== === Installation === Im Browser das gesamte Sript kopieren und in einen Editor eurer Wahl einsetzen. Das Skript muss nicht verändert werden, wer gern mit Code spielt und diesen verbessern will ist gerne wilkommen. Das Skript muss jetzt als Systemshelldatei gespeichert werden (Linuy → trace2scad.sh). Über das Terminal können jetzt die notwendigen zusätzlichen Programme installiert werden: sudo apt-get install potrace Das Programm könnt ihr jetzt einfach in eurem Terminal aufrufen mit ./trace2scad. === Bedienung === Trace2scad ist rein über das Terminal bedienbar, syntax: ./trace2scad (optionen) {Bild} Die Optionen werden im Folgenden erläutert: * -a: * -c * -e * -f * -g * -h * -l * -o * -p * -s * -t * -v * -x * -y aus Trace2scad Dokumentation: The command line options are: -a Force alignment of the model based on image bounds (also –align). Normally, the model is centered based on the bounding box computed from the generated models, but that means position of the object within the original image is lost. Thus, overlaying multiple trace2scad models from the same original image will not align them. To ensure alignment, -a is automatically set if you are generating models for more than one layer. -c number Set the target model complexity (also –complex). The model will be iteratively simplified until the total number of points in the polygons is no more than number. -e number Set the maximum line-combining error in pixels (also –pixerr). When the model is converted to line segments, very often there will be cases where a sequence of multiple line segments could be converted into a single line segment with minimal error. This option sets the maximum distance, in pixels, that a discarded point can be from the line that replaces it. The default value is a very conservative 1.0; larger values will tend to greatly simplify the model while „smoothing“ minor bumps that often happen due to pixel-level aliasing of the original image. For high-resolution images, -e 2 to -e 10 can really help smooth things with minimal ill effect. This feature was added in version 20150415. -f number Set the highpass filter radius (also –filter). If set to 0, the image will simply be thresholded to find edges and large dark areas will be modeled as solids. If set greater than 0, the effect is to convert constant-brightness regions into outlines with an edge thickness proportional to the number. Generally, a value between 2 and 4 is appropriate for outlining. -g number Set the image gamma (also –gamma). This allows simple adjustment of the tonal spread of the image before filtering and thresholding. -h Print the command line help message to stderr and exit. -l levelspec Set the level threshold or thresholds (also –level). A level directly determines the cut-off between model and void. The number should be a decimal value between 0 and 1 (exclusive); for example, „-l 0.5“ would set a single threshold of 0.5. However, this command line option can also be used to specify multiple levels to create a contoured 3D model by union. Such a 3D contour, for example, can be used as the model for a Lithophane. You can give a single integer value (with no „.“) to request creation of that many levels with level thresholds equally spaced between 0 and 1. For example, „-l 4“ would create four levels. If you want direct control over the individual levels used, you can instead list them with „,“ between the threshold values: „-l 0.875,0.625,0.375,0.125“ produces the same result as „-l 4“ – creating four levels. If more than one level is specified, -a is implied to ensure that the levels will align correctly. -o file Set the file name for the OpenSCAD output to file. Normally, the output file name is derived from the input filename by replacing any characters after „.“ with „.scad“ – but that can be a problem if the image is coming from a read-only directory, etc. When you specify a different name using -o, the name is used precisely as entered, without adding the suffix „.scad.“ -p prefix Set the name prefix to use for the generated OpenSCAD model (also –prefix). By default, the name prefix is derived from the image file name by removing the portion of the name after ., but that might not result in an appropriate name. For example, files can have - in their names, but OpenSCAD modules can't. The resulting model can be instantiated by prefix();; an individual layer of the model can be instantiated by prefix_number(); where number is the level number starting at 1. -s number Set the sub-pixel resolution (also –subres). This is really a potrace parameter, determining the fraction of a pixel to which analysis is performed. Larger values are more precise, but values between 2 and 10 generally suffice. -t number Set the „turd“ size (also –turd). This is really a potrace parameter, and the name isn't my fault. Any traced region smaller than number pixels is essentially discarded from the model. -v Enable verbose output to stderr (also –verbose). There are some other messages that go to stdout, but these can be isolated because they go to stderr. Enabling verbosity also has the side effect of leaving temporary files holding the intermediate stages in processing, so it would be appropriate to think of it as primarily a debugging option. -x number Set the maximum X axis pixel resolution of the image (also –xres). This value doesn't have as straightforward an effect on the model as one might expect, but larger values tend to create somewhat more complex models. The iterative complexity scaling is actually implemented by reducing this value and reprocessing. -y number Set the maximum Y axis pixel resolution of the image (also –yres). Just like X, but for the Y axis…. inputimagefile The inputimagefile can be in any format understood by ImageMagick convert. The portion of the name after . is stripped to create the default prefix for OpenSCAD model component names. The output file name is also generated from inputimagefile by removing the portion of the name after . and replacing it with .scad. For example, test.jpg would produce OpenSCAD code names starting with test and would place the output in a file named test.scad.

knowledgebase/trace2scad.1511262914.txt.gz · Zuletzt geändert: 2017/11/21 12:15 von rolex