From ahaas at airmail.net Wed Jan 7 08:26:44 2004 From: ahaas at airmail.net (Art Haas) Date: Wed Jan 7 08:26:52 2004 Subject: [PythonCAD] First set of changes for the new year Message-ID: <20040107132644.GB757@artsapartment.org> Hi. One of the items I wanted to add into PythonCAD has been the use of weak references, and they are now in. The Subpart class now uses them when it stores references to objects. Adding them into the code was relatively simple, and I haven't found a problem yet, so we'll give them a chance and see how things work out. I've also added a small change to the file saving code that should decrease the entity storage in the dictionary used for mapping object id() to an integer index. The change is to store only objects used in other objects in the dictionary. I'd mentioned in an earlier mail that I thought making this change would be good, and it was in that it flushed out a bug present in storing construction circles. One more change made to the code was to remove nearly every xrange() call and replace with range(). I've seen on the python-dev mailing list that xrange() is not popular and seems to be heading towards deprecation, so out it went. Python itself seems to be revising the way lists are made in that various PEPs (Python Enhancement Proposals) suggest alternatives to range()/xrange(), so the range() usage may some day be changed again. I'm now trying to get started working on an undo/redo system, and it looks like adding this much-needed feature will take some time. More details to follow when I have a better idea as to how things are going. The code with the weak reference, file saving, and xrange() removal changes are synced up to public repository, so a 'svn update' should get them for you. Art -- Man once surrendering his reason, has no remaining guard against absurdities the most monstrous, and like a ship without rudder, is the sport of every wind. -Thomas Jefferson to James Smith, 1822 From ahaas at airmail.net Tue Jan 13 13:48:42 2004 From: ahaas at airmail.net (Art Haas) Date: Tue Jan 13 13:48:51 2004 Subject: [PythonCAD] Working on undo/redo stuff Message-ID: <20040113184842.GB15377@artsapartment.org> Hi. Not much mail moving through the list these days, so I thought I'd post a message. I'm working on adding undo/redo stuff, and things are going along slowly. I've spent time seeing how this sort of stuff is implemented in other programs like Gnumeric and Kspread (spreadsheets), Gimp (Graphics), and an old version of qcad. In a nutshell here's how undo/redo works ... 1) Save the relevant info in your program that you are going to change. 2) Make the changes 3) Append the pre-change info on an 'undo' list. No-duh, huh? To undo something, just pop the last thing off the list and use that info to restore the program to the previous state, then append the info on a 'redo' list. To redo an action, just pop the last item off the 'redo' list, execute it, then push the info onto the 'undo' list. Adding an undo/redo ability for things like changing an entities color or linetype is straightforward, but things get more complex when entities are deleted, and that is where I am getting bogged down. I haven't figured a good way to store the undo/redo stuff so that it is not tied to the existance of a particular object. By this I mean the id() of the object, as the entities may/will get deleted during some action, and then new entities will be created in the undo operation, so the undo history of the old entity is now lost. One solution to this problem is to not delete the entity so the history of that object is still useable, but this could lead to significant increases of memory usage. If a better solution does not present itself than this may be the approach taken. Time will tell. Comments and suggestions welcomed for other approaches welcomed. Art -- Man once surrendering his reason, has no remaining guard against absurdities the most monstrous, and like a ship without rudder, is the sport of every wind. -Thomas Jefferson to James Smith, 1822 From blanding at localnet.com Tue Jan 13 16:15:20 2004 From: blanding at localnet.com (blanding@localnet.com) Date: Tue Jan 13 16:48:45 2004 Subject: [PythonCAD] Working on undo/redo stuff In-Reply-To: <20040113184842.GB15377@artsapartment.org> References: <20040113184842.GB15377@artsapartment.org> Message-ID: <15204.165.170.128.65.1074028520.squirrel@webmail.localnet.com> > > Adding an undo/redo ability for things like changing an entities color > or linetype is straightforward, but things get more complex when > entities are deleted, and that is where I am getting bogged down. I In my CoCreate 3D CAD, undo/redo only applies to model geometry changes, not to things such as color. If you were to follow a similar approach in 2D, you would ignore things like line type and color, but only keep track of things like stretching, filleting, etc. > haven't figured a good way to store the undo/redo stuff so that it is > not tied to the existance of a particular object. By this I mean the > id() of the object, as the entities may/will get deleted during some > action, and then new entities will be created in the undo operation, so > the undo history of the old entity is now lost. I'm thinking if you delete an object, just store its parameters in the undo stack so that it can be recreated if needed. Maybe in a dxf style format or something like that. --Doug Blanding From ahaas at airmail.net Tue Jan 13 18:08:22 2004 From: ahaas at airmail.net (Art Haas) Date: Tue Jan 13 18:16:27 2004 Subject: [PythonCAD] Working on undo/redo stuff In-Reply-To: <20040113210819.9566.qmail@web60802.mail.yahoo.com> References: <20040113184842.GB15377@artsapartment.org> <20040113210819.9566.qmail@web60802.mail.yahoo.com> Message-ID: <20040113230822.GA6141@artsapartment.org> On Tue, Jan 13, 2004 at 01:08:19PM -0800, phrostie wrote: > i realize that pythoncad is very developmental, but is there any chance of > somekind of dumy deb package that would pull in all the dependencies? > > i had it working at one time, but have reinstalled my system since then and > can't seem to get it to run. I don't do the Debian packaging myself, but when I check for Debian packaging of PythonCAD (thanks Cedric!), I get the following: $ apt-cache show pythoncad Package: pythoncad Priority: optional Section: graphics Installed-Size: 2272 Maintainer: Cédric Delfosse Architecture: all Version: 0.1.11-1 Depends: python (>= 2.3), python2.3, python (<< 2.4), python-gtk2 (>= 1.99.16) Filename: pool/main/p/pythoncad/pythoncad_0.1.11-1_all.deb Size: 297350 MD5sum: 92de73bde0101d0d08183d10d1bea525 Description: Computer Aided Drafting (CAD) program PythonCAD is a scriptable (with the Python language) and easy to use drafting program. . Homepage: http://www.pythoncad.org I do 'apt-get update' every day or two, so this is pretty current. Looking at the dependencies above things look alright; maybe zlib could be added but that package is so important to many other programs I'd be surprised if it isn't already your machine. What happens when you try to get a Debian-ized installation of PythonCAD like so ... $ apt-get install pythoncad Art -- Man once surrendering his reason, has no remaining guard against absurdities the most monstrous, and like a ship without rudder, is the sport of every wind. -Thomas Jefferson to James Smith, 1822 From ahaas at airmail.net Tue Jan 13 18:16:19 2004 From: ahaas at airmail.net (Art Haas) Date: Tue Jan 13 18:16:29 2004 Subject: [PythonCAD] Working on undo/redo stuff In-Reply-To: <15204.165.170.128.65.1074028520.squirrel@webmail.localnet.com> References: <20040113184842.GB15377@artsapartment.org> <15204.165.170.128.65.1074028520.squirrel@webmail.localnet.com> Message-ID: <20040113231619.GB6141@artsapartment.org> On Tue, Jan 13, 2004 at 04:15:20PM -0500, blanding@localnet.com wrote: > > > > Adding an undo/redo ability for things like changing an entities color > > or linetype is straightforward, but things get more complex when > > entities are deleted, and that is where I am getting bogged down. I > > In my CoCreate 3D CAD, undo/redo only applies to model geometry changes, > not to things such as color. If you were to follow a similar approach in > 2D, you would ignore things like line type and color, but only keep > track of things like stretching, filleting, etc. I want to keep track of things like color changes or linetype changes. I thought ME-10 did that as well, in addition to keeping track of geometry changes like splitting, stretching, and moving. > > > haven't figured a good way to store the undo/redo stuff so that it is > > not tied to the existance of a particular object. By this I mean the > > id() of the object, as the entities may/will get deleted during some > > action, and then new entities will be created in the undo operation, so > > the undo history of the old entity is now lost. > > I'm thinking if you delete an object, just store its parameters in the > undo stack so that it can be recreated if needed. Maybe in a dxf style > format or something like that. > That may be how things end up being coded, but instead of just pounding away at the keyboard I want to try and figure out if there is a better way of solving this problem. There might not be, or things may reach a point where any solution, even a possibly sub-optimal one, is better than no solution at all. I've been digging into Gnumeric's undo stuff today (a _great_ program - I am in awe of Jody Goldberg and the Gnumeric developers!), and it is starting to make a little sense. Art -- Man once surrendering his reason, has no remaining guard against absurdities the most monstrous, and like a ship without rudder, is the sport of every wind. -Thomas Jefferson to James Smith, 1822 From ahaas at airmail.net Wed Jan 14 12:57:48 2004 From: ahaas at airmail.net (Art Haas) Date: Wed Jan 14 12:57:57 2004 Subject: [PythonCAD] Updated subversion at the public repository Message-ID: <20040114175748.GA21025@artsapartment.org> Hi. The public repo is now running Subversion 0.36.0. If you are running an older version you probably should consider upgrading, though I know of no incompatibilities between this latest release and prior releases. I'm installing this version on my local machine as well. Art -- Man once surrendering his reason, has no remaining guard against absurdities the most monstrous, and like a ship without rudder, is the sport of every wind. -Thomas Jefferson to James Smith, 1822 From gossner at arcom.com.au Thu Jan 15 08:07:55 2004 From: gossner at arcom.com.au (Peter Gossner) Date: Thu Jan 15 08:04:09 2004 Subject: [PythonCAD] Updated subversion at the public repository In-Reply-To: <20040114175748.GA21025@artsapartment.org> References: <20040114175748.GA21025@artsapartment.org> Message-ID: <20040115233755.75bb034e.gossner@arcom.com.au> On Wed, 14 Jan 2004 11:57:48 -0600 "Art Haas" wrote: >Hi. > >The public repo is now running Subversion 0.36.0. If you are running an >older version you probably should consider upgrading, though I know of >no incompatibilities between this latest release and prior releases. >I'm installing this version on my local machine as well. > Cool. Thanks. I hope to be able to start contributing (even docs < API ?) Soonish (a couple of weeks) We are having a Linux Conf here at the moment (Adelaide South Australia) With lots of _great Python_ (and gnome / debian ....) stuff... my head is stuffed full and there are two days to go.. Pete -- Mesage Composed: Thu Jan 15 13:07:34 UTC 2004 Calendar events: Jan 16 Set uid bit patent issued, to Dennis Ritchie, 1979 Jan 16 Prohibition begins, 1920 < http://www.gnu.org/software/tetum/ > < http://bigbutton.com.au/~gossner > < gossner@arcom.com.au > >Art >-- >Man once surrendering his reason, has no remaining guard against >absurdities the most monstrous, and like a ship without rudder, is the >sport of every wind. > >-Thomas Jefferson to James Smith, 1822 > >_______________________________________________ >PythonCAD mailing list >PythonCAD@python.org >http://mail.python.org/mailman/listinfo/pythoncad From ahaas at airmail.net Thu Jan 15 08:27:07 2004 From: ahaas at airmail.net (Art Haas) Date: Thu Jan 15 08:27:19 2004 Subject: [PythonCAD] Updated subversion at the public repository In-Reply-To: <20040115233755.75bb034e.gossner@arcom.com.au> References: <20040114175748.GA21025@artsapartment.org> <20040115233755.75bb034e.gossner@arcom.com.au> Message-ID: <20040115132707.GA7985@artsapartment.org> On Thu, Jan 15, 2004 at 11:37:55PM +1030, Peter Gossner wrote: > On Wed, 14 Jan 2004 11:57:48 -0600 "Art Haas" > wrote: > >Hi. > > > >The public repo is now running Subversion 0.36.0. If you are running an > >older version you probably should consider upgrading, though I know of > >no incompatibilities between this latest release and prior releases. > >I'm installing this version on my local machine as well. > > > Cool. > Thanks. > I hope to be able to start contributing (even docs < API ?) > Soonish (a couple of weeks) > We are having a Linux Conf here at the moment (Adelaide South Australia) > With lots of _great Python_ (and gnome / debian ....) stuff... my head > is stuffed full and there are two days to go.. Great! Thanks in advance - enjoy the conference! Art -- Man once surrendering his reason, has no remaining guard against absurdities the most monstrous, and like a ship without rudder, is the sport of every wind. -Thomas Jefferson to James Smith, 1822 From pachiburke at terra.es Wed Jan 14 18:41:57 2004 From: pachiburke at terra.es (Rafael Villar Burke) Date: Thu Jan 15 08:30:21 2004 Subject: [PythonCAD] Working on undo/redo stuff Message-ID: <1074123717.3774.6.camel@pachi-portatil> El mar, 13-01-2004 a las 19:48, Art Haas escribi?: > Hi. > Adding an undo/redo ability for things like changing an entities color > or linetype is straightforward, but things get more complex when > entities are deleted, and that is where I am getting bogged down. I > haven't figured a good way to store the undo/redo stuff so that it is > not tied to the existance of a particular object. By this I mean the > id() of the object, as the entities may/will get deleted during some > action, and then new entities will be created in the undo operation, so > the undo history of the old entity is now lost. One solution to this > problem is to not delete the entity so the history of that object is > still useable, but this could lead to significant increases of memory > usage. If a better solution does not present itself than this may be the > approach taken. Time will tell. Perhaps if the objects deleted still exist in memory (possibly cached in disk at least till a certain number or undo/redo steps is surpassed) but are somehow marked not to be renderable or selectable. Most CAD programs have a "purge" command just to remove those objects that are no longer used, but are still in the drawing database. In AutoCAD, for instance, when you delete a block (a group of objects or a sort of named selection), it still remains in the drawing database, and you can reinsert it using its name again, unless you purge the drawing. Maybe if erased elements reside in a different base tree (as if they were proper drawings themselves) and have an "erasable" attribute that convert them into 'cacheable' parts of the drawing, things can get easier... Art, thank you so much for your superb work. -- Pachi pachiburke en terra.es From CSomerlot at Brwncald.com Wed Jan 28 15:15:31 2004 From: CSomerlot at Brwncald.com (Somerlot, Chris) Date: Wed Jan 28 15:18:19 2004 Subject: [PythonCAD] Printing Message-ID: I saw on the website that printing is a high priority. My research on the matter shows little pre-existing python code to deal with printing, mostly because of "cross-platform issues". What about using something like the ReportLab library to export to a pdf or svg intermediate file? From ahaas at airmail.net Wed Jan 28 16:34:53 2004 From: ahaas at airmail.net (Art Haas) Date: Wed Jan 28 16:35:01 2004 Subject: [PythonCAD] Printing In-Reply-To: References: Message-ID: <20040128213453.GB31427@artsapartment.org> On Wed, Jan 28, 2004 at 12:15:31PM -0800, Somerlot, Chris wrote: > I saw on the website that printing is a high priority. My research on the > matter shows little pre-existing python code to deal with printing, mostly > because of "cross-platform issues". What about using something like the > ReportLab library to export to a pdf or svg intermediate file? > I haven't heard of this library - what does it do? -- Man once surrendering his reason, has no remaining guard against absurdities the most monstrous, and like a ship without rudder, is the sport of every wind. -Thomas Jefferson to James Smith, 1822 From CSomerlot at Brwncald.com Wed Jan 28 17:06:45 2004 From: CSomerlot at Brwncald.com (Somerlot, Chris) Date: Wed Jan 28 17:07:19 2004 Subject: [PythonCAD] Printing Message-ID: > > On Wed, Jan 28, 2004 at 12:15:31PM -0800, Somerlot, Chris wrote: > > I saw on the website that printing is a high priority. My > research on > > the matter shows little pre-existing python code to deal with > > printing, mostly because of "cross-platform issues". What > about using > > something like the ReportLab library to export to a pdf or svg > > intermediate file? > > > > I haven't heard of this library - what does it do? > http://www.reportlab.org/rl_toolkit.html Provides a toolkit for creation of PDF files (and I've read elsewhere, has been updated to be able to create SVG files as well). From pachiburke at terra.es Thu Jan 29 11:28:28 2004 From: pachiburke at terra.es (Rafael Villar Burke) Date: Sat Jan 31 10:44:53 2004 Subject: [PythonCAD] Printing in python Message-ID: PyX http://pyx.sourceforge.net/ seems a good reference if PostScript graphics are adopted. The best thing about postscript printing is that the format is well suppported and has quite a lot of nice related utilities such as ps2pdf. There's also a somehow related project named as Cairo www.cairographics.org for cross-device output support of vector graphics. In this project is very actively involved James Henstridge (main pyGTK developer), which maintains python bindings, but I ignore to wich extent the project is already in an usable state. -- Pachi