Group Details Private

administrators

 
  • RE: drawBot.misc.DrawBotError: No image found at http:...

    The kitten example is not the url to the actual image data.

    The url to an image needs to be a direct link to the image data, no html, no javascript.

    good luck!

    posted in Bugs
  • RE: drawBot.misc.DrawBotError: No image found at http:...

    hello @ChrisSwift,

    I think the error message is correct: there really isn’t any image at this URL. if you paste it in a browser, you will be redirected to another domain where the image is hosted.

    it works fine if you use the actual image URL:

    image("https://s3.amazonaws.com/f.cl.ly/items/1T3x1y372J371p0v1F2Z/drawBot.jpg", (100, 100))
    

    not sure if this is a DrawBot bug…

    cheers!

    posted in Bugs
  • RE: Overlapping paths

    A wild guess: if you have twice the same outline on top of each other, it is possible a remove overlap can freak out

    Wild guess 2: you had some open paths, which are removed by a remove overlap

    posted in General Discussion
  • RE: Overlapping paths

    @MauriceMeilleur thanks for the points. remove overlap also works as expected with a lineTo-only version of the shape:

    pts = [(-125.0, 275.0), (-125.0, -100.0), (-125.0, -99.99999999999999), (-125.0, -113.80711874576983), (-113.80711874576983, -124.99999999999999), (-100.0, -124.99999999999999), (125.0, -125.0), (125.0, 100.0), (125.0, 100.0), (125.0, 113.80711874576983), (113.80711874576983, 125.0), (100.0, 125.0), (-275.0, 125.0), (-275.0, 275.0), (100.0, 275.0), (99.99999999999999, 275.0), (196.64983122038882, 275.0), (275.0, 196.64983122038882), (275.0, 100.0), (275.0, -275.0), (-100.0, -275.0), (-100.00000000000003, -275.0), (-196.64983122038888, -275.0), (-275.0, -196.64983122038882), (-275.0, -99.99999999999997), (-275.0, 275.0), (-125.0, 275.0)]
    
    B = BezierPath()
    for i, pt in enumerate(pts):
        if i == 0:
            B.moveTo(pt)
        else:
            B.lineTo(pt)
    B.closePath()
    
    # (un)comment this line to test
    # B.removeOverlap()
    
    newPage(800, 800)
    translate(400, 400)
    fill(None)
    stroke(1, 0, 0)
    strokeWidth(8)
    drawPath(B)
    

    I don’t think the lack of curveTos plays a role in the result (but you never know).

    let’s try it the other way around: can you provide a simple example in code of a shape where the whole path is erased when removing overlap? thanks!

    posted in General Discussion
  • RE: Overlapping paths

    hello @MauriceMeilleur,

    I’ve created a simplified version of your shape for testing (see below). remove overlap works as expected, the inner shape is preserved:

    removeOverlapTest.gif

    B = BezierPath()
    B.moveTo((10, 90))
    B.lineTo((90, 90))
    B.lineTo((90, 10))
    B.lineTo((10, 10))
    B.lineTo((10, 90))
    B.lineTo((40, 90))
    B.lineTo((40, 40))
    B.lineTo((60, 40))
    B.lineTo((60, 60))
    B.lineTo((10, 60))
    B.closePath()
    
    newPage(100, 100)
    frameDuration(3)
    fill(None)
    stroke(1, 0, 0)
    drawPath(B)
    
    B.removeOverlap()
    
    newPage(100, 100)
    frameDuration(3)
    fill(None)
    stroke(1, 0, 0)
    drawPath(B)
    
    # saveImage('removeOverlapTest.gif')
    

    it would help if you could post your actual bezier points, so we can see if it’s a problem in the data.

    ps. the color scheme is a nice reminder to add an illustration to the arcTo docs 🙂

    posted in General Discussion
  • Python For Designers online book posted in Tutorials
  • Here's a good tutorial for people just starting out with DrawBot posted in Tutorials
  • RE: determine centerpoint in irregular rectangle / create "composition"

    can I ask you why suddenly everything is now in decimal numbers ?

    think of it as percentages: the x/y point coordinates are defined in relation to the width/height dimensions of the shape, which are variable.

    ps. width/height were used as scale factors – not the best implementation in hindsight, because it also scales the stroke width. this (below) is better, and maybe makes the percentages explanation clearer:

    def myShape(x, y, w, h):
        save()
        translate(x, y)
        newPath()
        moveTo((0.0*w, 0.0*h))
        lineTo((1.0*w, 0.0*h))
        curveTo((0.7*w, 0.3*h), (0.7*w, 0.7*h), (1.0*w, 1.0*h))
        lineTo((0*w, 1.0*h))
        closePath()
        drawPath()
        restore()
    

    cheers!

    posted in General Discussion
  • RE: determine centerpoint in irregular rectangle / create "composition"

    hello David,

    rect(), oval(), etc are regular Python functions. you can create a new shape that behaves the same way by defining a new ‘shape drawing function’ that takes the same arguments (x, y, w, h).

    here’s an example:

    def myShape(x, y, w, h):
        save()
        translate(x, y)
        scale(w, h)
        newPath()
        moveTo((0., 0.0))
        lineTo((1.0, 0.0))
        curveTo((0.7, 0.3), (0.7, 0.7), (1.0, 1.0))
        lineTo((0, 1.0))
        closePath()
        drawPath()
        restore()
    
    newPage(500, 500)
    
    xMiddle = width()/2
    yMiddle = height()/2
    
    shapeWidth, shapeHeight = 354, 242
    
    shapeX = xMiddle - shapeWidth/2
    shapeY = yMiddle - shapeHeight/2
    
    myShape(shapeX, shapeY, shapeWidth, shapeHeight)
    

    notice that the (x,y) point positions are now defined as decimal numbers between 0.0 and 1.0, which are then scaled by the given width & height.

    posted in General Discussion
  • RE: Hi can somebody help me randomize shapes within a loop ?

    He David

    you need to call randint in side the for loop to get a random number each time, instead you asked for a randint once! at the beginning and you are reusing that number

    for i in range(10):
        print(randint(-1000, 1000))
    

    good luck!

    posted in General Discussion