Applying line and face style to a swept point. (Or, how to draw a blue dohnut)

31 views
Skip to first unread message

Gareth

unread,
Aug 7, 2011, 4:07:09 PM8/7/11
to Sketch Users
I'm trying to draw solids by sweeping points, but I can't seem to
figure out how to apply a style.

From the documentation, you can sweep a line to make a series of
polygones and you add the style with square brackets (the
[fillcolor=white]) bit

def n_cyl_segs 20 def n_views 5 def I [1,0,0]
def endopts [fillcolor=lightgray]
repeat { n_views, rotate(180/n_views, [I]) then translate([I] * 2.1) }
sweep[endopts]{ n_cyl_segs<>, rotate(360/n_cyl_segs, [0,1,0]) }
line[fillcolor=white](1,-1)(1,1)

I'm I'm not sure where it put the style when starting from a point:

def n_toroid_segs 20
def n_circle_segs 16
def r_minor 1
def r_major 1.5
sweep { n_toroid_segs, rotate(360 / n_toroid_segs, [0,1,0]) }
sweep { n_circle_segs, rotate(360 / n_circle_segs, (r_major,
0,0)) }
(r_major + r_minor, 0)

For example, I tried:

sweep { n_toroid_segs, rotate(360 / n_toroid_segs, [0,1,0]) }
sweep { n_circle_segs, rotate(360 / n_circle_segs, (r_major,
0,0)) }
(r_major + r_minor, 0)[fillcolor=blue]

But that didn't work. How do I do this?

Gene

unread,
Aug 9, 2011, 5:07:40 PM8/9/11
to Sketch Users
Sorry for the slow response. I've been moving to France.

The inner sweep body is a point, which generates a line. The outer
sweep works on this line to make the toroid.

So you'd want to check out the manual Section 3.2.6.2 Swept lines.
This says

"Options of unclosed line sweeps are copied to each output polygon.
Options of the swept line are ignored."

So you want to put the options on the outer sweep, and you get this:

sweep [color=black,fillcolor=blue] { n_toroid_segs, rotate(360 /
n_toroid_segs,[0,1,0]) }
sweep { n_circle_segs, rotate(360 / n_circle_segs, (r_major,
0,0)) }
(r_major + r_minor, 0)

All the best,
Gene

Gareth

unread,
Aug 10, 2011, 7:14:00 AM8/10/11
to sketch...@googlegroups.com
Many thanks!

> --
> You received this message because you are subscribed to the Google Groups "Sketch Users" group.
> To post to this group, send email to sketch...@googlegroups.com.
> To unsubscribe from this group, send email to sketch-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sketch-users?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages