View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0001524 | Draft | Bug | public | 2014-05-01 09:51 | 2014-05-11 18:08 |
| Reporter | wandererfan | Assigned To | yorik | ||
| Priority | normal | Severity | minor | Reproducibility | always |
| Status | closed | Resolution | fixed | ||
| Platform | x64 | OS | Ubuntu | OS Version | 12.04 LTS |
| Product Version | 0.14 | ||||
| Target Version | 0.14 | ||||
| Summary | 0001524: Draft - Units in InputFields for Optional Schemas | ||||
| Description | InputEntry fields in DraftGui are hard coded to "mm" unit of measure. They should be initialized to the default for the user preferred schema. | ||||
| Tags | No tags attached. | ||||
| FreeCAD Information | |||||
|
|
Same for Arch module actually... Here is a list of the files that have hard-coded millimeters: Draft/DraftGui.py L180: self.FORMAT = "%." + str(self.DECIMALS) + "f mm" Arch/ArchStructure.py L307: self.FORMAT = "%." + str(self.DECIMALS) + "f mm" Arch/ArchWall.py L160: self.FORMAT = "%." + str(self.DECIMALS) + "f mm" Arch/ArchWindow.py L386: self.FORMAT = "%." + str(self.DECIMALS) + "f mm" Arch/ArchWindow.py L813: self.FORMAT = "%." + str(self.DECIMALS) + "f mm" Maybe all these cases could become a Draft function... |
|
|
self.FORMAT = DraftGui.makeFormatSpec(self.DECIMALS,'Length') makes a format string for lengths based on current schema. DraftGui might not be the right place for it, but that's where it is now. |
|
|
Perfect, I think you did all the Draft part right? I'll adapt the Arch (I'm in the middle of a refactor of some arch tools anyway). Maybe there is a better place than DraftGui for this, but the important is that it exists... We can always change that later. |
|
|
Yes, I think I found everything in Draft. Took a quick intro look at Arch, but didn't do anything there. |
|
|
displayExternal.txt (765 bytes)
def displayExternal(internValue,decimals=4,dim='Length'):
'''return an internal value (ie mm) Length or Angle converted for display according
to Units Schema in use.'''
from FreeCAD import Units
if dim == 'Length':
qty = FreeCAD.Units.Quantity(1.0,FreeCAD.Units.Length)
pref = qty.getUserPreferred()
conversion = pref[1]
uom = pref[2]
elif dim == 'Angle':
qty = FreeCAD.Units.Quantity(1.0,FreeCAD.Units.Angle)
pref=qty.getUserPreferred()
conversion = pref[1]
uom = pref[2].decode('latin-1')
else:
conversion = 1.0
uom = "??"
fmt = "{0:."+ str(decimals) + "f} "+ uom
displayExt = fmt.format(float(internValue) / float(conversion))
return displayExt
|
|
|
I've attached a more robust version of displayExternal. I had hoped not to do any actual Units calculation in Draft, but maybe there is no getting around it. |
|
|
Added, thanks! |
|
FreeCAD: master 213a09c1 2014-05-04 13:48:03 Details Diff |
issue 0001524 - Units in Draft Gui - basic working version for points,radii entry - logic added to Trimex, Offset, Rotate |
Affected Issues 0001524 |
|
| mod - src/Mod/Draft/DraftGui.py | Diff File | ||
| mod - src/Mod/Draft/DraftTools.py | Diff File | ||
|
FreeCAD: master dea3fa6c 2014-05-05 23:47:54 Committer: yorik Details Diff |
issue 0001524 Add UNITS to Draft Shapestring |
Affected Issues 0001524 |
|
| mod - src/Mod/Draft/Draft.py | Diff File | ||
| mod - src/Mod/Draft/DraftGui.py | Diff File | ||
|
FreeCAD: master f37a15c1 2014-05-06 01:54:31 Committer: yorik Details Diff |
issue 0001524 UNITS for Draft Dimension |
Affected Issues 0001524 |
|
| mod - src/Mod/Draft/Draft.py | Diff File | ||
|
FreeCAD: master 8e1ebcd6 2014-05-08 15:49:10 Details Diff |
Draft: issue 0001524 - Added Wandererfan's fix to displayExternal |
Affected Issues 0001524 |
|
| mod - src/Mod/Draft/DraftGui.py | Diff File | ||
|
FreeCAD: master 1fffc978 2014-05-08 21:15:52 Details Diff |
Draft: small fix to units parsing - issue 0001524 |
Affected Issues 0001524 |
|
| mod - src/Mod/Draft/DraftGui.py | Diff File | ||
|
FreeCAD: master 2798de1a 2014-05-11 19:40:39 Details Diff |
Arch: Big cleanup - fixes 0001524 * Removed redundant code in Arch objects * Supports wandererfan's Units code in Draft module * Cleanup of the IFC exporter * Better support of extruded profiles in IFC export |
Affected Issues 0001524 |
|
| mod - src/Mod/Arch/ArchCommands.py | Diff File | ||
| mod - src/Mod/Arch/ArchComponent.py | Diff File | ||
| mod - src/Mod/Arch/ArchFrame.py | Diff File | ||
| mod - src/Mod/Arch/ArchStructure.py | Diff File | ||
| mod - src/Mod/Arch/ArchWall.py | Diff File | ||
| mod - src/Mod/Arch/ArchWindow.py | Diff File | ||
| mod - src/Mod/Arch/Arch_rc.py | Diff File | ||
| mod - src/Mod/Arch/Resources/ui/archprefs-import.ui | Diff File | ||
| mod - src/Mod/Arch/ifcWriter.py | Diff File | ||
| mod - src/Mod/Arch/importIFC.py | Diff File | ||
| mod - src/Mod/Draft/Draft.py | Diff File | ||
| mod - src/Mod/Draft/DraftVecUtils.py | Diff File | ||
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2014-05-01 09:51 | wandererfan | New Issue | |
| 2014-05-01 09:51 | wandererfan | Status | new => assigned |
| 2014-05-01 09:51 | wandererfan | Assigned To | => wandererfan |
| 2014-05-01 15:22 | yorik | Note Added: 0004599 | |
| 2014-05-03 15:51 | yorik | Project | FreeCAD => Draft |
| 2014-05-05 12:48 | wandererfan | Changeset attached | => FreeCAD Master master 213a09c1 |
| 2014-05-06 00:30 | wandererfan | Note Added: 0004631 | |
| 2014-05-07 14:38 | yorik | Changeset attached | => FreeCAD Master master dea3fa6c |
| 2014-05-07 14:38 | yorik | Changeset attached | => FreeCAD Master master f37a15c1 |
| 2014-05-07 22:13 | yorik | Note Added: 0004640 | |
| 2014-05-07 23:31 | wandererfan | Note Added: 0004642 | |
| 2014-05-08 12:37 | wandererfan | File Added: displayExternal.txt | |
| 2014-05-08 12:38 | wandererfan | Note Added: 0004644 | |
| 2014-05-08 13:50 | yorik | Note Added: 0004645 | |
| 2014-05-08 14:18 | yorik | Changeset attached | => FreeCAD Master master 8e1ebcd6 |
| 2014-05-08 19:38 | yorik | Changeset attached | => FreeCAD Master master 1fffc978 |
| 2014-05-11 18:08 | yorik | Changeset attached | => FreeCAD Master master 2798de1a |
| 2014-05-11 18:08 | yorik | Assigned To | wandererfan => yorik |
| 2014-05-11 18:08 | yorik | Status | assigned => closed |
| 2014-05-11 18:08 | yorik | Resolution | open => fixed |
FreeCAD