BelfrySCAD / BOSL2

The Belfry OpenScad Library, v2.0. An OpenSCAD library of shapes, masks, and manipulators to make working with OpenSCAD easier. BETA
https://github.com/BelfrySCAD/BOSL2/wiki
BSD 2-Clause "Simplified" License
990 stars 112 forks source link

import (svg) to path #628

Closed 3Dietrich closed 3 years ago

3Dietrich commented 3 years ago

Is your feature request related to a problem? Please describe.

I often use imported .svg and use them for extrution. It would be great if there is a routine to get an path out it. The same with a 2d module. If there is something like that them I am sorry! Please tell me. I didn't find something like that but need it often to use the great functions in BOSL2 (or I can't use BOSL2

Describe the solution you'd like

simple example:

module 2dbase() {  import(something.svg); }
path = 2dbase();
// or:
path = import(something.svg);

//then use e.g.:
skin( [path, circle(10)], z=[0,5] );

Describe alternatives you've considered

well, the alternative is: Not to use BOSL and make (e.g. the skin example) like that

hull() {
  linear_extrude(1) import(something.dvg);
  translate([0, 0, 10]) linear_extrude(1) circle(10);
}

It's a pitty to have no other idea and need to return from BOSL2 back to OpenSCAD original

adrianVmariano commented 3 years ago

Note that OpenSCAD doesn't have file reading commands. You need to look for a program that will convert your SVG file into a point list, or maybe a bezier list, that you can then embed in your scad file.

revarbat commented 3 years ago

Sadly, with OpenSCAD's current limitations, it isn't possible to import a path from an SVG. I believe you CAN import an SVG as 2D geometry, but you can't get a path from the geometry shape. OpenSCAD is silly like that. Despite begging and pleading, it appears unlikely that this will ever change.