The new NodeBox forum is live! Everything from support.nodebox.net moved here: sign in with the same email to pick up your old posts. Something not working? Write to forum-support@nodebox.net.

NodeBox 3From the old forum

fit rect to bound of imported svg

3 replies Last reply

  1. hæ—

    I feel like I'm having a bit of a brain fart over this.

    I'm trying to make a rect fit to the bounds of an imported sag, how would I accomplish this ?

    Copy link
  2. Here is one way...

    • Set the rect position to the centroid of the svg
    • Set the rect width to a lookup on the svg with a key of "bounds.width"
    • Set the rect height to a lookup on the svg with a key of "bounds.height"

    The attached zip file contains a NodeBox document that does this along with an svg of a world map you can use to test it. To keep things tidy I colorized the rect to make the fill transparent with a black stroke width of 1, then combined the rect with the original svg to create a world map with a rectangular frame. Give it a few seconds to render.

    Hope that helps!

    John

    Copy link
  3. ah ! of course, brilliant.

    I was getting part of the way there by using a lookup, but didn't expose the properties of bound in terms of height and width.

    thankyou !

    Copy link

Know something that helps?

Sign in with your email address to reply. No password needed.

Sign in to reply