Merge pull request #1478 from openscad/rotate_extrude-angle

Angle parameter for rotate_extrude
This commit is contained in:
Marius Kintel 2015-11-20 01:37:43 -05:00
commit ea50b90c69
22 changed files with 381 additions and 77 deletions

View file

@ -1,8 +1,8 @@
echo(version=version());
// rotate_extrude() always rotates the 2D shape 360 degrees
// around the Z axis. Note that the 2D shape must be either
// completely on the positive or negative side of the X axis.
// rotate_extrude() rotates a 2D shape around the Z axis.
// Note that the 2D shape must be either completely on the
// positive or negative side of the X axis.
color("red")
rotate_extrude()
translate([10, 0])
@ -23,6 +23,26 @@ color("green")
polygon( points=[[0,0],[8,4],[4,8],[4,12],[12,16],[0,20]] );
// By default rotate_extrude forms a full 360 degree circle,
// but a partial rotation can be performed by using the angle parameter.
// Positive angles create an arc starting from the X axis, going counter-clockwise.
// Negative angles generate an arc in the clockwise direction.
color("magenta")
translate([40,40]){
rotate_extrude(angle=180)
translate([12.5,0])
square(5);
translate([7.5,0])
rotate_extrude(angle=180)
translate([5,0])
square(5);
translate([-7.5,0])
rotate_extrude(angle=-180)
translate([5,0])
square(5);
}
// Written in 2015 by Torsten Paul <Torsten.Paul@gmx.de>
//
// To the extent possible under law, the author(s) have dedicated all

View file

@ -761,12 +761,21 @@ Response GeometryEvaluator::visit(State &state, const LinearExtrudeNode &node)
return ContinueTraversal;
}
static void fill_ring(std::vector<Vector3d> &ring, const Outline2d &o, double a)
static void fill_ring(std::vector<Vector3d> &ring, const Outline2d &o, double a, bool flip)
{
for (unsigned int i=0;i<o.vertices.size();i++) {
ring[i][0] = o.vertices[i][0] * sin(a);
ring[i][1] = o.vertices[i][0] * cos(a);
ring[i][2] = o.vertices[i][1];
if (flip) {
unsigned int l = o.vertices.size()-1;
for (unsigned int i=0 ;i<o.vertices.size();i++) {
ring[i][0] = o.vertices[l-i][0] * sin(a);
ring[i][1] = o.vertices[l-i][0] * cos(a);
ring[i][2] = o.vertices[l-i][1];
}
} else {
for (unsigned int i=0 ;i<o.vertices.size();i++) {
ring[i][0] = o.vertices[i][0] * sin(a);
ring[i][1] = o.vertices[i][0] * cos(a);
ring[i][2] = o.vertices[i][1];
}
}
}
@ -790,12 +799,15 @@ static void fill_ring(std::vector<Vector3d> &ring, const Outline2d &o, double a)
*/
static Geometry *rotatePolygon(const RotateExtrudeNode &node, const Polygon2d &poly)
{
if (node.angle == 0) return NULL;
PolySet *ps = new PolySet(3);
ps->setConvexity(node.convexity);
double min_x = 0;
double max_x = 0;
int fragments = 0;
BOOST_FOREACH(const Outline2d &o, poly.outlines()) {
double min_x = 0;
double max_x = 0;
BOOST_FOREACH(const Vector2d &v, o.vertices) {
min_x = fmin(min_x, v[0]);
max_x = fmax(max_x, v[0]);
@ -806,16 +818,49 @@ static Geometry *rotatePolygon(const RotateExtrudeNode &node, const Polygon2d &p
return NULL;
}
}
int fragments = Calc::get_fragments_from_r(max_x - min_x, node.fn, node.fs, node.fa);
fragments = fmax(Calc::get_fragments_from_r(max_x - min_x, node.fn, node.fs, node.fa) * std::abs(node.angle) / 360, 1);
}
bool flip_faces = (min_x >= 0 && node.angle > 0 && node.angle != 360) || (min_x < 0 && (node.angle < 0 || node.angle == 360));
if (node.angle != 360) {
PolySet *ps_start = poly.tessellate(); // starting face
Transform3d rot(Eigen::AngleAxisd(M_PI/2, Vector3d::UnitX()));
ps_start->transform(rot);
// Flip vertex ordering
if (!flip_faces) {
BOOST_FOREACH(Polygon &p, ps_start->polygons) {
std::reverse(p.begin(), p.end());
}
}
ps->append(*ps_start);
delete ps_start;
PolySet *ps_end = poly.tessellate();
Transform3d rot2(Eigen::AngleAxisd(node.angle*M_PI/180, Vector3d::UnitZ()) * Eigen::AngleAxisd(M_PI/2, Vector3d::UnitX()));
ps_end->transform(rot2);
if (flip_faces) {
BOOST_FOREACH(Polygon &p, ps_end->polygons) {
std::reverse(p.begin(), p.end());
}
}
ps->append(*ps_end);
delete ps_end;
}
BOOST_FOREACH(const Outline2d &o, poly.outlines()) {
std::vector<Vector3d> rings[2];
rings[0].resize(o.vertices.size());
rings[1].resize(o.vertices.size());
fill_ring(rings[0], o, -M_PI/2); // first ring
fill_ring(rings[0], o, (node.angle == 360) ? -M_PI/2 : M_PI/2, flip_faces); // first ring
for (int j = 0; j < fragments; j++) {
double a = ((j+1)%fragments*2*M_PI) / fragments - M_PI/2; // start on the X axis
fill_ring(rings[(j+1)%2], o, a);
double a;
if (node.angle == 360)
a = -M_PI/2 + ((j+1)%fragments*2*M_PI) / fragments; // start on the -X axis, for legacy support
else
a = M_PI/2 - (j+1)*(node.angle*M_PI/180) / fragments; // start on the X axis
fill_ring(rings[(j+1)%2], o, a, flip_faces);
for (size_t i=0;i<o.vertices.size();i++) {
ps->append_poly();
@ -829,6 +874,7 @@ static Geometry *rotatePolygon(const RotateExtrudeNode &node, const Polygon2d &p
}
}
}
return ps;
}

View file

@ -61,13 +61,15 @@ AbstractNode *RotateExtrudeModule::instantiate(const Context *ctx, const ModuleI
node->fn = c.lookup_variable("$fn")->toDouble();
node->fs = c.lookup_variable("$fs")->toDouble();
node->fa = c.lookup_variable("$fa")->toDouble();
ValuePtr file = c.lookup_variable("file");
ValuePtr layer = c.lookup_variable("layer", true);
ValuePtr convexity = c.lookup_variable("convexity", true);
ValuePtr origin = c.lookup_variable("origin", true);
ValuePtr scale = c.lookup_variable("scale", true);
ValuePtr angle = c.lookup_variable("angle", true);
if (!file->isUndefined()) {
printDeprecation("Support for reading files in rotate_extrude will be removed in future releases. Use a child import() instead.");
node->filename = lookup_file(file->toString(), inst->path(), c.documentPath());
@ -77,6 +79,8 @@ AbstractNode *RotateExtrudeModule::instantiate(const Context *ctx, const ModuleI
node->convexity = (int)convexity->toDouble();
origin->getVec2(node->origin_x, node->origin_y);
node->scale = scale->toDouble();
node->angle = 360;
angle->getFiniteDouble(node->angle);
if (node->convexity <= 0)
node->convexity = 2;
@ -84,6 +88,9 @@ AbstractNode *RotateExtrudeModule::instantiate(const Context *ctx, const ModuleI
if (node->scale <= 0)
node->scale = 1;
if ((node->angle <= -360) || (node->angle > 360))
node->angle = 360;
if (node->filename.empty()) {
std::vector<AbstractNode *> instantiatednodes = inst->instantiateChildren(evalctx);
node->children.insert(node->children.end(), instantiatednodes.begin(), instantiatednodes.end());
@ -108,6 +115,7 @@ std::string RotateExtrudeNode::toString() const
;
}
stream <<
"angle = " << this->angle << ", "
"convexity = " << this->convexity << ", "
"$fn = " << this->fn << ", $fa = " << this->fa << ", $fs = " << this->fs << ")";

View file

@ -11,6 +11,7 @@ public:
convexity = 0;
fn = fs = fa = 0;
origin_x = origin_y = scale = 0;
angle = 360;
}
virtual Response accept(class State &state, Visitor &visitor) const {
return visitor.visit(state, *this);
@ -20,7 +21,7 @@ public:
int convexity;
double fn, fs, fa;
double origin_x, origin_y, scale;
double origin_x, origin_y, scale, angle;
Filename filename;
std::string layername;
};

View file

@ -0,0 +1,40 @@
$fa=15;
$fs=4;
module face(x) {
translate([x,0]) difference() {
square(10,center=true);
square(5,center=true);
}
}
module face2() {
translate([5,0]) square(5);
}
// test negative partial angles and geometries on -X side
rotate_extrude(angle=45) face(10);
rotate_extrude(angle=45) face(-10);
rotate_extrude(angle=-45) face(21);
rotate_extrude(angle=-45) face(-21);
// test small angles, angle < $fa, render a single segment
rotate([0,0,90]) {
rotate_extrude(angle=5) face(10);
rotate_extrude(angle=5) face(-10);
rotate_extrude(angle=-5) face(21);
rotate_extrude(angle=-5) face(-21);
}
// show nothing
rotate_extrude(angle=0) face(5); // 0 angle
// various angles treated as full circle
translate([-40,40]) rotate_extrude() face2(); // unspecified
translate([0,40]) rotate_extrude(angle=0/0) face2(); // NaN
translate([40,40]) rotate_extrude(angle=1/0) face2(); // Infinity
translate([-40,0]) rotate_extrude(angle=-1/0) face2(); // -Infinity
translate([40,0]) rotate_extrude(angle=360) face2(); // 360
translate([-40,-40]) rotate_extrude(angle=-360) face2(); // -360
translate([0,-40]) rotate_extrude(angle=1000) face2(); // > 360
translate([40,-40]) rotate_extrude(angle=-1000) face2(); // < -360

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -3,25 +3,25 @@ group() {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -10], [0, 0, 0, 1]]) {
group() {
difference() {
rotate_extrude(convexity = 3, $fn = 0, $fa = 12, $fs = 2) {
import(file = "example007.dxf", layer = "dorn", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 3, $fn = 0, $fa = 12, $fs = 2) {
import(file = "example007.dxf", layer = "dorn", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
group() {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
group() {
intersection() {
multmatrix([[1, 0, 0, 0], [0, 0, -1, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]]) {
linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example007.dxf", layer = "cutout1", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "example007.dxf", layer = "cutout1", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
}
}
multmatrix([[0, -1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 0, -1, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) {
multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]]) {
linear_extrude(height = 100, center = false, convexity = 2, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example007.dxf", layer = "cutout2", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "example007.dxf", layer = "cutout2", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
}
}
@ -29,21 +29,21 @@ group() {
}
}
}
multmatrix([[0, -1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
group() {
intersection() {
multmatrix([[1, 0, 0, 0], [0, 0, -1, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]]) {
linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example007.dxf", layer = "cutout1", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "example007.dxf", layer = "cutout1", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
}
}
multmatrix([[0, -1, 0, 0], [1, 0, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 0, -1, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) {
multmatrix([[6.12323e-17, -1, 0, 0], [1, 6.12323e-17, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 6.12323e-17, -1, 0], [0, 1, 6.12323e-17, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -50], [0, 0, 0, 1]]) {
linear_extrude(height = 100, center = false, convexity = 2, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example007.dxf", layer = "cutout2", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "example007.dxf", layer = "cutout2", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
}
}

View file

@ -1,26 +1,26 @@
group() {
group();
% linear_extrude(height = 22, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "body", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "example009.dxf", layer = "body", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
% group() {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) {
linear_extrude(height = 2, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, -12], [0, 0, 0, 1]]) {
linear_extrude(height = 2, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "example009.dxf", layer = "plate", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
}
}
intersection() {
linear_extrude(height = 20, center = true, convexity = 10, twist = -57.5288, slices = 4, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "fan_top", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "example009.dxf", layer = "fan_top", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
rotate_extrude(convexity = 10, $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "fan_side", origin = [0, -40], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 10, $fn = 0, $fa = 12, $fs = 2) {
import(file = "example009.dxf", layer = "fan_side", origin = [0, -40], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
}
}

View file

@ -15,12 +15,12 @@ group() {
square(size = [6, 10], center = true);
}
}
multmatrix([[-0.5, -0.86602540378, 0, 0], [0.86602540378, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[-0.5, -0.866025, 0, 0], [0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 36], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [6, 10], center = true);
}
}
multmatrix([[-0.5, 0.86602540378, 0, 0], [-0.86602540378, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[-0.5, 0.866025, 0, 0], [-0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 36], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [6, 10], center = true);
}
@ -41,12 +41,12 @@ group() {
square(size = [6, 15], center = true);
}
}
multmatrix([[-0.5, -0.86602540378, 0, 0], [0.86602540378, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[-0.5, -0.866025, 0, 0], [0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 88.5], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [6, 15], center = true);
}
}
multmatrix([[-0.5, 0.86602540378, 0, 0], [-0.86602540378, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[-0.5, 0.866025, 0, 0], [-0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 88.5], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [6, 15], center = true);
}
@ -60,7 +60,7 @@ group() {
group() {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 102], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[0, 0, -1, 0], [-1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) {
multmatrix([[2.22045e-16, 2.22045e-16, -1, 0], [-1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) {
linear_extrude(height = 6, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
group() {
union() {
@ -101,9 +101,9 @@ group() {
}
}
}
multmatrix([[-0.5, -0.86602540378, 0, 0], [0.86602540378, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[-0.5, -0.866025, 0, 0], [0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 102], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[0, 0, -1, 0], [-1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) {
multmatrix([[2.22045e-16, 2.22045e-16, -1, 0], [-1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) {
linear_extrude(height = 6, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
group() {
union() {
@ -144,9 +144,9 @@ group() {
}
}
}
multmatrix([[-0.5, 0.86602540378, 0, 0], [-0.86602540378, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[-0.5, 0.866025, 0, 0], [-0.866025, -0.5, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 102], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[0, 0, -1, 0], [-1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 0, 1]]) {
multmatrix([[2.22045e-16, 2.22045e-16, -1, 0], [-1, 0, -2.22045e-16, 0], [0, 1, 2.22045e-16, 0], [0, 0, 0, 1]]) {
linear_extrude(height = 6, center = true, convexity = 10, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
group() {
union() {
@ -191,7 +191,7 @@ group() {
}
% multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 12], [0, 0, 0, 1]]) {
group() {
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
square(size = [25, 68], center = false);
multmatrix([[1, 0, 0, 0], [0, 1, 0, 68], [0, 0, 1, 0], [0, 0, 0, 1]]) {
intersection() {

View file

@ -1,7 +1,7 @@
group() {
group();
color([1, 0, 0, 1]) {
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
@ -9,16 +9,39 @@ group() {
}
color([0, 1, 1, 1]) {
multmatrix([[1, 0, 0, 40], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(convexity = 2, $fn = 80, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 80, $fa = 12, $fs = 2) {
text(text = " J", size = 10, spacing = 1, font = "", direction = "ltr", language = "en", script = "Latn", halign = "left", valign = "baseline", $fn = 80, $fa = 12, $fs = 2);
}
}
}
color([0, 0.501961, 0, 1]) {
multmatrix([[1, 0, 0, 0], [0, 1, 0, 30], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(convexity = 2, $fn = 80, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 80, $fa = 12, $fs = 2) {
polygon(points = [[0, 0], [8, 4], [4, 8], [4, 12], [12, 16], [0, 20]], paths = undef, convexity = 1);
}
}
}
color([1, 0, 1, 1]) {
multmatrix([[1, 0, 0, 40], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 180, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, 12.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
multmatrix([[1, 0, 0, 7.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 180, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
multmatrix([[1, 0, 0, -7.5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = -180, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
}
}
}

View file

@ -16,12 +16,12 @@ group() {
intersection();
linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2);
linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2);
import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 0);
import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 0);
import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 0);
import(file = "", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 0);
group();
cube(size = [1, 1, 1], center = false);
sphere($fn = 0, $fa = 12, $fs = 2, r = 1);
@ -32,7 +32,7 @@ group() {
polygon(points = undef, paths = undef, convexity = 1);
projection(cut = false, convexity = 0);
render(convexity = 1);
surface(file = "", center = false, invert = false);
surface(file = "", center = false, invert = false, timestamp = 0);
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]);
multmatrix([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]);
multmatrix([[-1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]);

View file

@ -1,7 +1,7 @@
group() {
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
cube(size = [1, 1, 1], center = false);
}
linear_extrude(height = 10, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {

View file

@ -1,17 +1,17 @@
group() {
group() {
linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
multmatrix([[1, 0, 0, -250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
linear_extrude(file = "localfile.dxf", layer = "", origin = [0, 0], height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2);
linear_extrude(file = "localfile.dxf", layer = "", origin = [0, 0], timestamp = 1447128393, height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2);
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, 350], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(file = "localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(file = "localfile.dxf", layer = "", origin = [0, 0], scale = 1, timestamp = 1447128393, angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
}
multmatrix([[1, 0, 0, 250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[200, 0, 0, 0], [0, 200, 0, 0], [0, 0, 50, 0], [0, 0, 0, 1]]) {
surface(file = "localfile.dat", center = false, invert = false);
surface(file = "localfile.dat", center = false, invert = false, timestamp = 1447128393);
}
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, -200], [0, 0, 1, 0], [0, 0, 0, 1]]) {

View file

@ -1,17 +1,17 @@
group() {
group() {
linear_extrude(height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2) {
import(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2);
import(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 1, $fn = 0, $fa = 12, $fs = 2, timestamp = 1447128393);
}
multmatrix([[1, 0, 0, -250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
linear_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2);
linear_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], timestamp = 1447128393, height = 100, center = false, convexity = 1, scale = [1, 1], $fn = 0, $fa = 12, $fs = 2);
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, 350], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(file = "localfiles_dir/localfile.dxf", layer = "", origin = [0, 0], scale = 1, timestamp = 1447128393, angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
}
multmatrix([[1, 0, 0, 250], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
multmatrix([[200, 0, 0, 0], [0, 200, 0, 0], [0, 0, 50, 0], [0, 0, 0, 1]]) {
surface(file = "localfiles_dir/localfile.dat", center = false, invert = false);
surface(file = "localfiles_dir/localfile.dat", center = false, invert = false, timestamp = 1447128393);
}
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, -200], [0, 0, 1, 0], [0, 0, 0, 1]]) {

View file

@ -0,0 +1,166 @@
group() {
rotate_extrude(angle = 45, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
square(size = [10, 10], center = true);
square(size = [5, 5], center = true);
}
}
}
}
rotate_extrude(angle = 45, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, -10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
square(size = [10, 10], center = true);
square(size = [5, 5], center = true);
}
}
}
}
rotate_extrude(angle = -45, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 21], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
square(size = [10, 10], center = true);
square(size = [5, 5], center = true);
}
}
}
}
rotate_extrude(angle = -45, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, -21], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
square(size = [10, 10], center = true);
square(size = [5, 5], center = true);
}
}
}
}
multmatrix([[2.22045e-16, -1, 0, 0], [1, 2.22045e-16, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 5, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
square(size = [10, 10], center = true);
square(size = [5, 5], center = true);
}
}
}
}
rotate_extrude(angle = 5, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, -10], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
square(size = [10, 10], center = true);
square(size = [5, 5], center = true);
}
}
}
}
rotate_extrude(angle = -5, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 21], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
square(size = [10, 10], center = true);
square(size = [5, 5], center = true);
}
}
}
}
rotate_extrude(angle = -5, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, -21], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
square(size = [10, 10], center = true);
square(size = [5, 5], center = true);
}
}
}
}
}
rotate_extrude(angle = 0, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
square(size = [10, 10], center = true);
square(size = [5, 5], center = true);
}
}
}
}
multmatrix([[1, 0, 0, -40], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
}
multmatrix([[1, 0, 0, 40], [0, 1, 0, 40], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
}
multmatrix([[1, 0, 0, -40], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
}
multmatrix([[1, 0, 0, 40], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
}
multmatrix([[1, 0, 0, -40], [0, 1, 0, -40], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, -40], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
}
multmatrix([[1, 0, 0, 40], [0, 1, 0, -40], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 15, $fs = 4) {
group() {
multmatrix([[1, 0, 0, 5], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [5, 5], center = false);
}
}
}
}
}

View file

@ -1,17 +1,17 @@
group() {
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
cube(size = [1, 1, 1], center = false);
}
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
circle($fn = 0, $fa = 12, $fs = 2, r = 10);
}
}
multmatrix([[1, 0, 0, 50], [0, 1, 0, -20], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
rotate_extrude(convexity = 4, $fn = 0, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 4, $fn = 0, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
circle($fn = 0, $fa = 12, $fs = 2, r = 10);
@ -27,12 +27,12 @@ group() {
multmatrix([[1, 0, 0, 50], [0, 1, 0, 50], [0, 0, 1, 0], [0, 0, 0, 1]]) {
difference() {
difference() {
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
circle($fn = 0, $fa = 12, $fs = 2, r = 10);
}
}
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
circle($fn = 0, $fa = 12, $fs = 2, r = 8);
}
@ -44,14 +44,14 @@ group() {
}
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, -60], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(convexity = 2, $fn = 1, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 1, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, 20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
circle($fn = 1, $fa = 12, $fs = 2, r = 10);
}
}
}
multmatrix([[1, 0, 0, 0], [0, 1, 0, 60], [0, 0, 1, 0], [0, 0, 0, 1]]) {
rotate_extrude(convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
rotate_extrude(angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2) {
multmatrix([[1, 0, 0, -20], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]) {
square(size = [10, 10], center = false);
}

View file

@ -1,3 +1,3 @@
group() {
rotate_extrude(file = "../../../dxf/open-polyline.dxf", layer = "", origin = [0, 0], scale = 1, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
rotate_extrude(file = "../../../dxf/open-polyline.dxf", layer = "", origin = [0, 0], scale = 1, timestamp = 1447128393, angle = 360, convexity = 2, $fn = 0, $fa = 12, $fs = 2);
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB