parent
85214a4359
commit
2509e59b51
|
@ -230,17 +230,20 @@ def getcolor(color):
|
||||||
#for k,v in svgcolors.iteritems():
|
#for k,v in svgcolors.iteritems():
|
||||||
# if (k.lower() == color.lower()): pass
|
# if (k.lower() == color.lower()): pass
|
||||||
|
|
||||||
def transformCopyShape(shape,matrix):
|
def transformCopyShape(shape,m):
|
||||||
m=matrix
|
"""apply transformation matrix m on given shape
|
||||||
#factor=matrix.submatrix(2).isOrthogonal()
|
since OCCT 6.8.0 transformShape can be used to apply certian non-orthogonal
|
||||||
#if factor != 0.0:
|
transformations on shapes. This way a conversion to BSplines in
|
||||||
if m.A11*m.A11+m.A12*m.A12 == m.A21*m.A21+m.A22*m.A22 and \
|
transformGeometry can be avoided."""
|
||||||
m.A11*m.A21+m.A12*m.A22 == 0:
|
if abs(m.A11**2+m.A12**2 -m.A21**2-m.A22**2) < 1e-8 and \
|
||||||
newshape=shape.copy()
|
abs(m.A11*m.A21+m.A12*m.A22) < 1e-8: #no shear
|
||||||
newshape.transformShape(matrix)
|
try:
|
||||||
return newshape
|
newshape=shape.copy()
|
||||||
else:
|
newshape.transformShape(m)
|
||||||
return shape.transformGeometry(matrix)
|
return newshape
|
||||||
|
except Part.OCCError: # older versions of OCCT will refuse to work on
|
||||||
|
pass # non-orthogonal matrices
|
||||||
|
return shape.transformGeometry(m)
|
||||||
|
|
||||||
def getsize(length,mode='discard',base=1):
|
def getsize(length,mode='discard',base=1):
|
||||||
"""parses length values containing number and unit
|
"""parses length values containing number and unit
|
||||||
|
|
Loading…
Reference in New Issue
Block a user