[PythonCAD] newb - closed polyline

Art Haas ahaas at airmail.net
Thu May 10 22:03:31 CEST 2007


On Thu, May 10, 2007 at 09:09:25AM -0700, Carl Trachte wrote:
> I've got the latest source from the subversion repository and I'm using it
> with Python 2.4 in Cygwin.
> 
> What I can do is draw an open polyline, then draw a segment that snaps to
> the two polyline endpoints (the snap works as you, Art, described, and
> colors the snapped point location box a different color than the other
> points - in my case it's default blue versus default yellow).
> 
> What I haven't yet figured out is how to make the segment part of the
> polyline.

Right now you can't. There isn't a way (yet) to combine the two entities
into a single polyline.

I've also poked around the code and know why the behavior you've
described happens. The code for drawing the Polylines is in the
'gtkentities.py' file, specifically the polyline_button_press_cb()
function. There is a test to see if a point is found near the x/y
coordinates where the mouse was clicked. When the polyline is being
created, though, any new point being added to Layer for the polyline
doesn't get created until after the final mouse click happens, so
the test "fails" in that the soon-to-be added point doesn't yet exist. A
possible fix is to examine the coordinates of the to-be-created
Polyline and see if the latest mouseclick lands near enough so that
those coordinates will be used.

> Thancad (a Tkinter based Python CAD app) was actually designed for this sort
> of thing.  I corresponded with its author briefly.  It's not a bad tool for
> what I'm doing, but development on it has, as far as I know, stopped back in
> 2004.

I'd heard of this program but haven't followed it.

> Is this the sort of thing worth trying to incorporate into PythonCAD, or is
> PythonCAD's audience less of a GIS crowd, and more of a circuit board
> drawing group?

I'm hoping that PythonCAD eventually appeals to any and every crowd
needing CAD software.

> Thanks for suffering more questions.

No problem. Keep 'em coming.

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


More information about the PythonCAD mailing list