[PythonCAD] dimensioning

Art Haas ahaas at airmail.net
Tue Jun 12 23:37:23 CEST 2007


On Tue, Jun 12, 2007 at 07:30:39AM -0500, Art Haas wrote:
> Hi.
> 
> I'll see if I can duplicate this, and if so fix it ASAP.

This was interesting. The core problem was that there are two ways to
set the units in a drawing - one with the setUnits() method and the
other by setOption('UNITS', xxx). The trouble various places used
setOption() to do the dirty work, but it didn't go through.

The small patch below fixed things for me. Please apply and let me know
that it works for you as well.

The next challenge is to figure out the other bug you described.

Art

Index: PythonCAD/Generic/image.py
===================================================================
--- PythonCAD/Generic/image.py	(revision 2760)
+++ PythonCAD/Generic/image.py	(working copy)
@@ -721,6 +721,8 @@
         self.__units.setUnit(unit)
         if unit != _ou:
             self.sendMessage('units_changed', _ou)
+            self.__options['UNITS'] = unit
+            self.sendMessage('option_changed', 'UNITS', _ou)
             self.modified()
 
     units = property(getUnits, setUnits, None,
@@ -1651,6 +1653,9 @@
               key == 'DIM_SECONDARY_FONT_FAMILY'):
             if value not in self.__fonts:
                 self.__fonts[value] = True
+        elif key == 'UNITS':
+            self.setUnits(value)
+            return # bail out
         else:
             pass
         self.__options[key] = value

-- 
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