Inkscape.org
Creating New Extensions Triangle or polygon tool I'd like to have
  1. #1
    hildybingen hildybingen @hildybingen

    Non-coder here. May I suggest an extension I'd like to have? I envision an aid to constructing triangles-- and maybe even polygons with more than four sides--where you could enter the exact length of each side and have the triangle or polygon constructed for you. Maybe there could also be a way to enter whatever angles you know, if you know any. The shape tools are great for polygons with equal sides, but otherwise require tedious work-arounds if you want exact measurements.

  2. #2
    Paddy_CAD Paddy_CAD @Paddy_CAD

    I for one would use such a tool occasionally.  My workaround draws a square and sets the exact height and width from the selector toolbar.  Then I draw my polygon and use rotations and scaling with snaps and guides to stretch it to the desired size and orientation.  By now I can do this quite quickly.

    Precise Polygons
  3. #3
    Paddy_CAD Paddy_CAD @Paddy_CAD

    Obviously that's a decagon, not a decahedron.

  4. #4
    hildybingen hildybingen @hildybingen

    Thanks, Paddy. A friend told me how to go in and alter the XML with the measurements of the sides, but for people who don't know how to do that and just want to use a good drawing program, such an extension might help. Also, I don't think there's anything about angles in the XML, is there? If angles could be included in the extension, it would be nice.

  5. #5
    Paddy_CAD Paddy_CAD @Paddy_CAD

    Like you, I don't have programming skills to offer, but I can share the various workarounds I've developed, or adopted from others.  I use Guidelines for precise angles.  [double-click] to set the angle numerically.  [shift-click-drag] to rotate the guide on-screen, snapping to nodes or intersections.

    Inkscape's roots lie in web illustration and graphic design and not the razor-sharp precision of a CAD application.  That said, we're not completely neglected and there are some excellent drafting tools inside the box, but I expect they'll remain secondary to the artistic tools.  Probably rightly so, given the target audience.  Many users would be repelled by a design-by-numbers paradigm.  

  6. #6
    Polygon Polygon @Polygon🌶

    @Paddy_CAD I wonder how you scale or generate from a certain point with the Polygon-tool? AffinityDesigner has a ´n ingenious PointTransform-Tool which lets you scale from any point - to any point - with parametric shapes.

  7. #7
    Paddy_CAD Paddy_CAD @Paddy_CAD

    "A rose by any other name would smell as sweet"

    Inkscape has similar functions but not in a single tool.  I've attached a tutorial which might seem long-winded but with a little practice this is a quick sequence of operations.

    Tutorial Scaled Polygon
  8. #8
    inklinea inklinea @inklinea⛰️

    I don't think it would be difficult to make an extension, the forumulas and a similar working example is here:

    https://www.mathopenref.com/polygonsides.html

  9. #9
    Polygon Polygon @Polygon🌶

    Thanks for your effort. From my experience Inkscape scales just from the bounding box - I can scale to match the guides in a few steps - but you need to check closely it´s still aligned and most likely it´s not. So please zoom in at the corners and check.

    Look how easy this could be:

  10. #10
    inklinea inklinea @inklinea⛰️
    *

    I modified something I am currently working on to make an extension which does what you want.

    However, I have not specified the units the extension works with.

    If you have a document in px it will prob work in px, and if in mm, prob mm.

    If your document size and viewbox are different, then its a bit hit and miss.

    [ Link removed - see the link in the post below ]

    It appears under 'Render > Polygon Side" in the extension menu

  11. #11
    hildybingen hildybingen @hildybingen
    *

    Yesterday I wrote a message thanking you folks for all your good thinking on my little issue. For some reason it never showed up in these postings.  I've just learned that I should keep a backup of messages I write!

    I'm wowed at your instructionals, Polygon and Paddy_Cad, and bowled over that Inklinea has already come up with an extension. I tried it out and it works nicely for equilateral polygons. Thanks so much.

    However, I don't think any of these solutions do what I was looking for, namely a way to easily construct an irregular triangle or polygon from specific side lengths and/or angles.  Seems that the interface would have to have a way to enter, for instance, "side 1," "side 2," "side 3," and so on.

  12. #12
    inklinea inklinea @inklinea⛰️

    I've published the extension at https://inkscape.org/~inklinea/%E2%98%85polygon-side

    I've corrected ( mostly ) for units.

    I also enjoyed making it :)

    You might find the tool you need at https://www.geogebra.org/

    There is a quadrilateral maker there etc. 

  13. #13
    Polygon Polygon @Polygon🌶

    @inklinea  what a great extension - thanks for sharing.

    For this Maelstrom I once needed 20 polygons with a specific amount of corners and exact edge length. Easy in AffinityDesigner not so in Inkscape at that time. ;-)

  14. #14
    zksmk zksmk @zksmk
    hildybingen

    However, I don't think any of these solutions do what I was looking for, namely a way to easily construct an irregular triangle or polygon from specific side lengths and/or angles. Seems that the interface would have to have a way to enter, for instance, "side 1," "side 2," "side 3," and so on.

    You can always use FOSS CAD software like Solvespace, Freecad or Librecad. You can do this stuff in them super easily, and then just export to svg

  15. #15
    hildybingen hildybingen @hildybingen

    Thanks, zksmk. It's nice to have recommendations for other software, should I ever need to learn computer assisted design. I was just looking for a nice perk within Inkscape. As I mentioned, I can use the XML work-around for the few times I need exact measurement. It's easier than learning another program. Just thought this might be not too difficult to make as an extension and might be something other folks would find useful. I surely don't have the skills to code it, though. I'm ready to drop the subject. Thanks to everyone for your ideas.

  16. #16
    zksmk zksmk @zksmk

    Oh, no worries, I'm aware what you were doing. I just thought you'd (or somebody else with a similar problem reading this thread) find it easier to use SolveSpace for this task than doing XML editing {SV is a tiny 6mb program and this particular task is self-explanatory through the ui, literally zero learning needed}. I wasn't saying the extension idea was bad. You're good.

  17. #17
    Maren Hachmann Maren Hachmann @Moini
    *
    Polygon

    Look how easy this could be:

    I can imagine an even easier solution. Just add the edge length to the tool controls bar. It's probably just a feature request away.

    Edit: I think many people have been missing that option, so it's not unreasonable to ask for it.

  18. #18
    hildybingen hildybingen @hildybingen

    Wonderful idea, Maren! How do I ask?

  19. #19
    Maren Hachmann Maren Hachmann @Moini

    @hildybingen Visit https://inkscape.org/report (our bug tracker on GitLab) and fill in the form with the requested information.

  20. #20
    hildybingen hildybingen @hildybingen

    I've misspoken more than once here. It wasn't the XML I edited; it was the .SVG file. And it was the coordinates of the vertices I plugged in, not the desired side lengths. I found the coordinates by plugging my desired side lengths into the formula here: https://www.calculator.net/triangle-calculator.html

    I think I converted the triangle to a path and made the sides unequal before I started.

    A friend told me how to do this process. I should have consulted my notes before I spouted off.

    I have no idea whether anything similar could be used for an unequal polygon beyond a triangle.

     

  21. #21
    Maren Hachmann Maren Hachmann @Moini

    So, the Polygon tool produces polygons with equal side lengths per default (unless the 'randomize' option is > 0). It's not unreasonable to want to set that side length.

  22. #22
    inklinea inklinea @inklinea⛰️
    *

    SVG path 'Z' can always be used to make the final side.

    For the irregular polygons if we assume that each angle is going to be advancing from the previous one. So it does not produce zig-zags and the sides do not cross.

    Also that the angle specified could be in a range, otherwise you could end up with a virtual straight line with one very long last line.

    I think in python a random range feature would be good for the angle. Just put in n-1 side lengths of your choice. 

    Python could then generate multiple polygons for you and you choose the one you want.

    Actually, another option might be to make sure that all the points are on the circumference of a circle.

  23. #23
    inklinea inklinea @inklinea⛰️

    If you want all the sides to be specified, would be interesting to make a random series of angles inside. 

    I might have a look at that option, like rods connected with elastic bands at the corners.

  24. #24
    inklinea inklinea @inklinea⛰️

    Well, I had a look into this. In fact someone helped me by supplying a mathematical method for constructing an irregular convex polygon given a list of sides 

    However the maths so well beyond my brainpower. Maybe in the future, but at the moment no. 

  25. #25
    hildybingen hildybingen @hildybingen

    Thanks for thinking about it....

  26. #26
    hildybingen hildybingen @hildybingen

    Imagine my surprise when I was looking through the Render extensions yesterday and happened on Triangle. It's exactly what I was looking for in the first place. It would be lovely if the same thing could be done for other non-equilateral polygons, but the current extension certainly fits the bill for my needs right now. I'm a little embarrassed that I didn't notice this before. I don't suppose it could have sneaked in there sometime in an update 😉, since I haven't reinstalled Inkscape in a few months.

    Thought all you kind people who went to some lengths to make suggestions might want to know about this!

     

Inkscape Inkscape.org Inkscape Forum Creating New Extensions Triangle or polygon tool I'd like to have