[PythonCAD] Comments, bug report

David Turvene dturvene at comcast.net
Thu Feb 3 06:56:14 CET 2005

I recently loaded PythonCad v22 and am really pleased with it.  It's 
powerful and easy to use.  I especially like the rich set of 
customizations (however, see the bugfix below).


Thoughts (probably all very familiar)
1) I'm having a hard time adjusting the dimension values to anything 
"real-world".  It appears the values come directly from the pixel offset 
from the screen edge.   One idea is to put a customizable scaling factor 
in the various dimension calculate() methods.
2) I saw an email train about construction lines being offset from a 
reference con line but I had a hard time figuring out how to make them 
the same precise distance.  I ended up laying out a number of lines then 
hand-editting in the XML file to be an exact offset.
3) Add a call stack trace to exception handling code - see the 
DumpException call below.

In fact thoughts #1 and #2 could be two parts to a general scaling 
calculation design.  For example: describe how many con lines to fill 
the screen and the "real world" distance between them.  That becomes 
your scaling factor.  If you zoom out, you will need to add more con 
lines; call the same function but the scaling factor is immutable (or at 
least should be hard to change.)

Bug:  When I took some examples from the default prefs.py file into my 
local one, I got an type exception.  Here's the patch I did to fix it.

--- /opt/PythonCAD-DS1-R22/PythonCAD/Generic/preferences.py    
2004-11-17 11:58:36.000000000 -0500
+++ /usr/lib/python2.3/site-packages/PythonCAD/Generic/preferences.py    
2005-02-03 00:44:24.455793872 -0500
@@ -957,7 +957,16 @@ def _set_textstyles(prefmod):
             _r, _g, _b = _color.getColors()
             _color = color.get_color(_r, _g, _b)
-            _textstyle = text.TextStyle(_name, _family, _size, _style, 
_weight, _color)
+            ## 050201:DST - fixed call to TextStyle class
+            ## _textstyle = text.TextStyle(_name, _family, _size, 
_style, _weight, _color)
+            _textstyle = text.TextStyle(_name,
+                                        family=_family,
+                                        size=_size,
+                                        style=_style,
+                                        weight=_weight,
+                                        color=_color)
             if _textstyle not in _textstyles:
@@ -1141,5 +1150,7 @@ variable being set to True.
                         if hasattr(_mod, _key):
-                except: # should print the error out
-                    sys.stderr.write("Syntax error in %s\n" % _user_prefs)
+                except:
+                    from UtilsLocal import DumpException
+                    DumpException('Syntax error in %s\n' % _user_prefs)

More information about the PythonCAD mailing list