Triangle Generator Extension

Bug #226001 reported by inductiveload
2
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
inductiveload

Bug Description

I have written an extension to render at triangle, based on one of the following options:
1)From three sides
2)From two sides and the included angle
3)From two sides and an opposite angle
4)From one side, one adjacent, and one opposite side
5)From one sides and the two adjacent angles

These are the only possible ways to define a triangle by side lengths and angles. All measurments are in px.

This extension will also print a warning if an invalid set of values is given, such as triangle with sides of 100, 100, 500. If ambiguous values that can produce two triangles are given, both triangles are generated.

Revision history for this message
inductiveload (inductiveload) wrote :
Revision history for this message
Rygle (rygle) wrote :

Nice work inductive! 3 comments at this stage

First, to get this to work in 0.46 devel or later, you have to add the xml namespace lines to the top;
replace;
===
<inkscape-extension>
===
with
===
<?xml version="1.0" encoding="UTF-8"?>
<inkscape-extension xmlns="http://www.inkscape.org/namespace/inkscape/extension">
===

Second, once I do that, it gets this error using default values and the third mode (sides a,b, angle a);
===
Traceback (most recent call last):

  File "D:\Download\Multimedia\Image\Inkscape\compiling\SVN\trunk\inkscape\share\extensions\triangle.py", line 197, in <module>

    e.affect()

  File "D:\Download\Multimedia\Image\Inkscape\compiling\SVN\trunk\inkscape\share\extensions\inkex.py", line 154, in affect

    self.effect()

  File "D:\Download\Multimedia\Image\Inkscape\compiling\SVN\trunk\inkscape\share\extensions\triangle.py", line 155, in effect

    error=false

NameError: global name 'false' is not defined
===

Third, I noticed there's no GPL2 or better statement in the .py file like in your grid extensions. Are you happy for that to go in?

Once we get those sorted out, we (I) will also add entries to /share/extensions/Makefile.am and /po/POTFILES.in

Sas might also like to check the xml. He had some very slight corrections to the two grid*.inx files. You can see the latest versions of them here;
http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/extensions/

Changed in inkscape:
assignee: nobody → julianbeard
importance: Undecided → Medium
status: New → In Progress
importance: Medium → Wishlist
Revision history for this message
sas (sas-sas) wrote :

> Sas might also like to check the xml.

I checked it, and it's OK (once the first line has been replaced with the namespaced version, of course).

Revision history for this message
Rygle (rygle) wrote :

Inductiveload - Didn't mean to sound critical before. You've done a great job on these extensions. Thanks.

It's only really that one bug that needs fixing when you get around to it, and I assume you'd be happy with the GPL 2 license, as it's in your other extensions. Is that so?

Revision history for this message
inductiveload (inductiveload) wrote :

OK, i think the "error = false" is just a capitalisation thing: should be "False". Seemed to work before though. Maybe it's a platform thing, but I'd have thought these extensions were independent of that.

As for the licence, I copied it in from the grid .py file, so I think it's the same. I'm not too bothered by that, too be honest - on Wikimedia Commons, I just relase stuff into the public domain - I'd rather people were able to use it than I get credit.

Sorry about the XML header, I forgot to put that in before I uploaded. I also saw from SAS's edits that i shouldn't put max and min parameters on booleans...obvious I suppose, but there aren't any on this extension. The next one in the pipeline has lots though - it's a bit of a monster!

Don't worry about sounding too critical, these mistakes are elementary things by me. Thanks for helping me get these out - I have no clue how all this Inkscape SVN stuff works yet, I'm still trying to hack my way around in Python! I'm new too all this (including programming in general - I've only done tacked-on computing courses at uni), so I'm grateful for your patience.

Revision history for this message
Rygle (rygle) wrote :

OK. Committed to trunk @ SVN revision 18516. 2 Extensions with XML header in the .inx and entries to /share/extensions/Makefile.am and /po/POTFILES.in - I think that should cover everything.

Great work, especially for being new to this. I'm pretty new myself. Are you some kind of mathematician? You seem interested in maths anyway...

My bad about the GPL thing. I looked at the very top of the .py file and saw your copyright and the triangle, and then skipped down to the line where the error was and missed the GPL statements, but as you know they are there.

If you want to have a go at understanding the SVN thing, the link above can help you, and if you click on a given file you can see the diffs/changes on that file going back quite a while on some files.

If you're on Windows, I recommend downloading a program called TortoiseSVN and looking at the following page;
http://wiki.inkscape.org/wiki/index.php/Win32Port

If not, try something here - http://wiki.inkscape.org/wiki/index.php/CompilingInkscape
or here - http://wiki.inkscape.org/wiki/index.php/WorkingWithSVN - don't know if there's a graphical SVN program for Linux/Mac, but hopefully there is!

I'm out of town for a few days, so don't expect any more commits until at least Thursday.

Revision history for this message
bbyak (buliabyak) wrote :

is in trunk now

Changed in inkscape:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.