OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19591 (Git)
Build type: Release
Branch: master
Hash: 27771fc6ee93170b6ecb978ff4da438a5b9cfe97
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
i get the old behavior: a segment of a surface has the same normal as source surface (seen here by it's blue color)
the closest following version i have to test on is
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19697 (Git)
Build type: Release
Branch: master
Hash: 8832356802011bf5d70e9d6f0efa89c47bc70a91
Python version: 3.7.3
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)
and here, the surface segment has a flipped normal compared to the source surface (seen here by its black color)
i already do a lot of orientation checking, so if this change is intended, i could adapt my code to fix it.
Code: Select all
def execute(self, fp):
'''Do something when doing a recomputation, this method is mandatory'''
# get surface
surface=fp.NL_Surface.Shape.Surface
# get cutting points from curve
curve=fp.NL_Curve.Shape.Curve
p0 = curve.StartPoint
p1 = curve.EndPoint
# determine u or v segmentation and get parameter span from cutting points
param0=surface.parameter(p0)
print ('param0: ', param0)
param1=surface.parameter(p1)
print ('param1: ', param1)
if ((param0[0]<0.001 and param1[0]<0.001) or (param0[0]>0.999 and param1[0]>0.999)): # if u is constant 0 or constant 1 along curve
segdir = 'v'
if param0[1] < param1[1]:
t0=param0[1]
t1=param1[1]
if param0[1] > param1[1]:
t0=param1[1]
t1=param0[1]
if ((param0[1]<0.001 and param1[1]<0.001) or (param0[1]>0.999 and param1[1]>0.999)): # if v is constant 0 or constant 1 along curve
segdir = 'u'
if param0[0] < param1[0]:
t0=param0[0]
t1=param1[0]
if param0[0] > param1[0]:
t0=param1[0]
t1=param0[0]
# filter out t0<0 and t1>1 that may occur when the xyz position is projected to uv
if t0<0:
t0=0
if t1>1:
t1=1
# create surface segment. this works very nicely most of the time, but!
#sometimes .segment returns [[vector],[vector],[vector],[vector]] instead of a whole grid.
print ('sgdir: ', segdir)
print ('t0 ', t0)
print ('t1 ', t1)
if segdir=='u':
surface.segment(t0,t1,0,1)
if segdir=='v':
surface.segment(0,1,t0,t1) #
this is the same file. going back and forth between freeCAD versions shows consistent behavior: always flipped in one version, and always correct in the older version.
file attached. requires silk addon to recompute.
any help in clarifying the situation with segment() greatly appreciated. if this counts as a bug, i'm not sure where to report it.