Re: [sketch-users:171] Draw cube in 2 lines[sketch]

62 views
Skip to first unread message
Message has been deleted
Message has been deleted

Alex

unread,
Feb 22, 2011, 11:16:52 AM2/22/11
to sketch...@googlegroups.com
Here's my method (it has 3 lines if you ignore the translation). It
first creates a square then "extrudes" it:

https://github.com/alexdu/sketch-lib/blob/master/lib/box.sk

(source from http://alexdu.github.com/sketch-lib/ )

On Tue, Feb 22, 2011 at 5:07 PM, M3n0 <menil....@gmail.com> wrote:
> I just started using sketch and I was convinced that I could make a cube in
> only two lines. I think I have a good idea but my implementation is not
> good:
>
> def p0(0,0,0) def p1(1,0,0) def p2(1,1,0) def p3(0,1,0)
> repeat { 5, rotate(180/5, [0,1,1]) then translate([0,1,1] * 2.1) }
> sweep[cull=false]{2<>, rotate (90, (0,0,0), [0,1,0]) then
> translate([0,0,1])}{polygon(p0)(p1)(p2)(p3)}
>
> The idea was to make a square (polygon p0p1p2p3) and just once to rotate
> that square by 90 degrees and translate to the Z-axis but I get a cube that
> is not closed (I think)
> Can anyone help me "close" my cube? The repeat function is there just to see
> the cubes from other angles. I still consider my code in two lines :)
>
> --
> 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.
>

Alex

unread,
Feb 22, 2011, 11:35:42 AM2/22/11
to sketch...@googlegroups.com
It's part of a library, it's not standalone. The styles are defined in
defaults.sk. "e_xtrastyle" is named like this because I wanted to mark
it as private (and it couldn't begin with an underscore).

See this page for details on how to use the library:

http://alexdu.github.com/sketch-lib/

You can look in defaults.sk and extrastyle.sk and copy the styles from there.

On Tue, Feb 22, 2011 at 5:24 PM, M3n0 <menil....@gmail.com> wrote:
> Hmmm I can't seem to compile. Can you explain what does the option
>  "e_xtrastyle" do? I get an error when compiling.

Message has been deleted

Alex

unread,
Feb 22, 2011, 11:55:44 AM2/22/11
to sketch...@googlegroups.com
Yes, scroll down on that page for links :)

I've found Kjell's pages to be very helpful in learning Sketch.

On Tue, Feb 22, 2011 at 5:42 PM, M3n0 <menil....@gmail.com> wrote:
> This is great, thx. Can you give me any more sketch related links, so I can
> learn more?
> btw. You still haven't solved my problem on closing the cube. Is it
> possible?

Menil Vukovic

unread,
Feb 22, 2011, 12:00:27 PM2/22/11
to sketch...@googlegroups.com
Even though I'm a bigger fan of PSTricks, PGF/TikZ seems much more faster and better way to resolve a problem. Found the links. Thanks again.
______
Menil V.
Reply all
Reply to author
Forward
0 new messages