## Draftからsvg変換の線幅が0.35固定となっている。

Japanese forum
3939yoshi
Posts: 19
Joined: Thu Mar 02, 2017 5:24 am

### Re: Draftからsvg変換の線幅が0.35固定となっている。

このみの問題ですが。

DraftGui.py内です。

Code: Select all

def displayExternal(internValue,decimals=None,dim='Length',showUnit=True,unit=None):
'''return an internal value (ie mm) Length or Angle converted for display according
to Units Schema in use. Unit can be used to force the value to express in a certain unit'''
if dim == 'Length':
if not unit:
if (decimals == None) and showUnit:
return q.UserString
conversion = q.getUserPreferred()[1]
uom = q.getUserPreferred()[2]
else:
uom = unit
internValue = q.getValueAs(unit)
conversion = 1
elif dim == 'Angle':
else:
conversion = 1.0
if decimals == None:
decimals = 2
uom = "??"
if not showUnit:
uom = ""
fmt = "{0:."+ str(decimals) + "f} "+ uom
displayExt = fmt.format(float(internValue) / float(conversion))
displayExt = displayExt.replace(".",QtCore.QLocale().decimalPoint())
return displayExt

Code: Select all

def displayExternal(internValue,decimals=None,dim='Length',showUnit=True,unit=None):
'''return an internal value (ie mm) Length or Angle converted for display according
to Units Schema in use. Unit can be used to force the value to express in a certain unit'''
if dim == 'Length':
if not unit:
if (decimals == None) and showUnit:
return q.UserString
conversion = q.getUserPreferred()[1]
uom = q.getUserPreferred()[2]
else:
uom = unit
internValue = q.getValueAs(unit)
conversion = 1
elif dim == 'Angle':
uom = ""
internValue = uq.Value
conversion = 1
else:
conversion = 1.0
if decimals == None:
decimals = 2
uom = "??"
if not showUnit:
uom = ""
fmt = "{0:."+ str(decimals) + "f} "
displayExt = fmt.format(float(internValue) / float(conversion))
if '.' in displayExt :
displayExt = displayExt.rstrip("0 ")
displayExt = displayExt.rstrip(".")
displayExt = displayExt.replace(".",QtCore.QLocale().decimalPoint()) + uom
return displayExt

3939yoshi
Posts: 19
Joined: Thu Mar 02, 2017 5:24 am

### Re: Draftからsvg変換の線幅が0.35固定となっている。

「寸法線や角度寸法線の数値表示に於いて、小数点以下の余分な 0 を取り除く修正です。」の修正です。エラーが発生していたので修正しました。

Code: Select all

def displayExternal(internValue,decimals=None,dim='Length',showUnit=True,unit=None):
'''return an internal value (ie mm) Length or Angle converted for display according
to Units Schema in use. Unit can be used to force the value to express in a certain unit'''
if dim == 'Length':
if not unit:
if (decimals == None) and showUnit:
return q.UserString
conversion = q.getUserPreferred()[1]
uom = q.getUserPreferred()[2]
else:
uom = unit
internValue = q.getValueAs(unit)
conversion = 1
elif dim == 'Angle':
else:
conversion = 1.0
if decimals == None:
decimals = 2
uom = "??"
if not showUnit:
uom = ""
fmt = "{0:."+ str(decimals) + "f} "+ uom
displayExt = fmt.format(float(internValue) / float(conversion))
displayExt = displayExt.replace(".",QtCore.QLocale().decimalPoint())
return displayExt

Code: Select all

def displayExternal(internValue,decimals=None,dim='Length',showUnit=True,unit=None):
'''return an internal value (ie mm) Length or Angle converted for display according
to Units Schema in use. Unit can be used to force the value to express in a certain unit'''
if dim == 'Length':
if not unit:
if (decimals == None) and showUnit:
return q.UserString
conversion = q.getUserPreferred()[1]
uom = q.getUserPreferred()[2]
else:
uom = unit
internValue = q.getValueAs(unit)
conversion = 1
elif dim == 'Angle':
uom = ""
internValue = uq.Value
conversion = 1
if decimals is None:
decimals = 2
else:
conversion = 1.0
if decimals == None:
decimals = 2
uom = "??"
if not showUnit:
uom = ""
fmt = "{0:."+ str(decimals) + "f}"
displayExt = fmt.format(float(internValue) / float(conversion))
if '.' in displayExt :
displayExt = displayExt.rstrip("0 ")
displayExt = displayExt.rstrip(".")
displayExt = displayExt.replace(".",QtCore.QLocale().decimalPoint()) + uom
return displayExt

### Who is online

Users browsing this forum: No registered users and 1 guest