discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

BOSL2 turtle()

JW
Joe Weinpert
Sun, May 21, 2023 6:24 PM

Is there a way to begin a turtle path at a different point than the default
[0,0] origin?

Joe Weinpert
skidrowacademy.com

Is there a way to begin a turtle path at a different point than the default [0,0] origin? Joe Weinpert skidrowacademy.com
DP
David Phillip Oster
Sun, May 21, 2023 6:41 PM

None of the examples on https://github.com/revarbat/BOSL2/wiki/drawing.scad
have an origin of [0,0].

Example:

include <BOSL2/std.scad>

path = [[0,100], [100,100], [200,0], [100,-100], [100,0]];

rotate([-10,-10,-10])translate([-100,-10,-10])linear_extrude(0.1)stroke(path,
width=20);

On Sun, May 21, 2023 at 11:25 AM Joe Weinpert joe.weinpert@gmail.com
wrote:

Is there a way to begin a turtle path at a different point than the
default [0,0] origin?

Joe Weinpert
skidrowacademy.com


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

None of the examples on https://github.com/revarbat/BOSL2/wiki/drawing.scad have an origin of [0,0]. Example: include <BOSL2/std.scad> path = [[0,100], [100,100], [200,0], [100,-100], [100,0]]; rotate([-10,-10,-10])translate([-100,-10,-10])linear_extrude(0.1)stroke(path, width=20); On Sun, May 21, 2023 at 11:25 AM Joe Weinpert <joe.weinpert@gmail.com> wrote: > Is there a way to begin a turtle path at a different point than the > default [0,0] origin? > > Joe Weinpert > skidrowacademy.com > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JW
Joe Weinpert
Mon, May 22, 2023 2:29 PM

When using turtle() drawing always begins at [0,0] and facing right by
default.  My problem was the need to draw something that was different.

I did figure out the answer, however, by using the turtle() "state" command
to set the beginning point of the path

shape = turtle(
state = [0,1.5], // starting point
["left", // turn to use arcright next
"arcright", .125,
"move", .75,
"arcright", .125,
"move", .75,
"arcleft", .375,
"move", .625,
"right",
"untily", 0,
"right",
"untilx", 1,
"arcright", .375,
"untily", 1.25,
"arcleft", .125,
"untilx", .125,
"arcright", .125]
);

Joe Weinpert
skidrowacademy.com

On Sun, May 21, 2023 at 2:43 PM David Phillip Oster <
davidphilliposter@gmail.com> wrote:

None of the examples on
https://github.com/revarbat/BOSL2/wiki/drawing.scad have an origin of
[0,0].

Example:

include <BOSL2/std.scad>

path = [[0,100], [100,100], [200,0], [100,-100], [100,0]];

rotate([-10,-10,-10])translate([-100,-10,-10])linear_extrude(0.1)stroke(path,
width=20);

On Sun, May 21, 2023 at 11:25 AM Joe Weinpert joe.weinpert@gmail.com
wrote:

Is there a way to begin a turtle path at a different point than the
default [0,0] origin?

Joe Weinpert
skidrowacademy.com


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

When using turtle() drawing always begins at [0,0] and facing right by default. My problem was the need to draw something that was different. I did figure out the answer, however, by using the turtle() "state" command to set the beginning point of the path shape = turtle( state = [0,1.5], // starting point ["left", // turn to use arcright next "arcright", .125, "move", .75, "arcright", .125, "move", .75, "arcleft", .375, "move", .625, "right", "untily", 0, "right", "untilx", 1, "arcright", .375, "untily", 1.25, "arcleft", .125, "untilx", .125, "arcright", .125] ); Joe Weinpert skidrowacademy.com On Sun, May 21, 2023 at 2:43 PM David Phillip Oster < davidphilliposter@gmail.com> wrote: > None of the examples on > https://github.com/revarbat/BOSL2/wiki/drawing.scad have an origin of > [0,0]. > > Example: > > include <BOSL2/std.scad> > > path = [[0,100], [100,100], [200,0], [100,-100], [100,0]]; > > rotate([-10,-10,-10])translate([-100,-10,-10])linear_extrude(0.1)stroke(path, > width=20); > > > On Sun, May 21, 2023 at 11:25 AM Joe Weinpert <joe.weinpert@gmail.com> > wrote: > >> Is there a way to begin a turtle path at a different point than the >> default [0,0] origin? >> >> Joe Weinpert >> skidrowacademy.com >> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
DP
David Phillip Oster
Mon, May 22, 2023 4:18 PM

Thanks for teaching me about the state parameter to turtle(). Now that
I see your answer, it is clear that I misread your question.

Thanks for teaching me about the *state* parameter to *turtle()*. Now that I see your answer, it is clear that I misread your question.
RD
Revar Desmera
Tue, May 23, 2023 1:18 AM

Another option is to do your path starting at the origin, then use move() to translate the entire path.
ie: path = move([10,5], p=turtle(...));  Which is pretty much how you have to do it with turtle3d().

  • Revar

On May 22, 2023, at 7:29 AM, Joe Weinpert joe.weinpert@gmail.com wrote:

When using turtle() drawing always begins at [0,0] and facing right by default.  My problem was the need to draw something that was different.

I did figure out the answer, however, by using the turtle() "state" command to set the beginning point of the path

shape = turtle(
state = [0,1.5], // starting point
["left", // turn to use arcright next
"arcright", .125,
"move", .75,
"arcright", .125,
"move", .75,
"arcleft", .375,
"move", .625,
"right",
"untily", 0,
"right",
"untilx", 1,
"arcright", .375,
"untily", 1.25,
"arcleft", .125,
"untilx", .125,
"arcright", .125]
);

Joe Weinpert
skidrowacademy.com http://skidrowacademy.com/

On Sun, May 21, 2023 at 2:43 PM David Phillip Oster <davidphilliposter@gmail.com mailto:davidphilliposter@gmail.com> wrote:

None of the examples on https://github.com/revarbat/BOSL2/wiki/drawing.scad have an origin of [0,0].

Example:

include <BOSL2/std.scad>
path = [[0,100], [100,100], [200,0], [100,-100], [100,0]];
rotate([-10,-10,-10])translate([-100,-10,-10])linear_extrude(0.1)stroke(path, width=20);

On Sun, May 21, 2023 at 11:25 AM Joe Weinpert <joe.weinpert@gmail.com mailto:joe.weinpert@gmail.com> wrote:

Is there a way to begin a turtle path at a different point than the default [0,0] origin?

Joe Weinpert
skidrowacademy.com http://skidrowacademy.com/


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Another option is to do your path starting at the origin, then use `move()` to translate the entire path. ie: `path = move([10,5], p=turtle(...));` Which is pretty much how you have to do it with `turtle3d()`. - Revar > On May 22, 2023, at 7:29 AM, Joe Weinpert <joe.weinpert@gmail.com> wrote: > > When using turtle() drawing always begins at [0,0] and facing right by default. My problem was the need to draw something that was different. > > I did figure out the answer, however, by using the turtle() "state" command to set the beginning point of the path > > shape = turtle( > state = [0,1.5], // starting point > ["left", // turn to use arcright next > "arcright", .125, > "move", .75, > "arcright", .125, > "move", .75, > "arcleft", .375, > "move", .625, > "right", > "untily", 0, > "right", > "untilx", 1, > "arcright", .375, > "untily", 1.25, > "arcleft", .125, > "untilx", .125, > "arcright", .125] > ); > > > Joe Weinpert > skidrowacademy.com <http://skidrowacademy.com/> > > > > > On Sun, May 21, 2023 at 2:43 PM David Phillip Oster <davidphilliposter@gmail.com <mailto:davidphilliposter@gmail.com>> wrote: >> None of the examples on https://github.com/revarbat/BOSL2/wiki/drawing.scad have an origin of [0,0]. >> >> Example: >> >> include <BOSL2/std.scad> >> path = [[0,100], [100,100], [200,0], [100,-100], [100,0]]; >> rotate([-10,-10,-10])translate([-100,-10,-10])linear_extrude(0.1)stroke(path, width=20); >> >> >> On Sun, May 21, 2023 at 11:25 AM Joe Weinpert <joe.weinpert@gmail.com <mailto:joe.weinpert@gmail.com>> wrote: >>> Is there a way to begin a turtle path at a different point than the default [0,0] origin? >>> >>> Joe Weinpert >>> skidrowacademy.com <http://skidrowacademy.com/> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org <mailto:discuss-leave@lists.openscad.org> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org