这个函数的解释如下
Constructs a Brep using the trimming information of a brep face and a surface. Surface must be roughly the same shape and in the same location as the trimming brep face.
这里面提到,用作UVdata的Surface必须Roughly 和修剪的面是同样的形状,并且在同样的位置。那么究竟要有多么的Roughly,这里面并没有说。好把,这个意思是这个函数可能不成功,下面的返回结果人家就说了,要么返回成功的面,要么返回Null。OK,分析到这里面其实你得到一个Null并不足以为怪。 Parameters trimSourceBrepFace which contains trimmingSource brep.surfaceSourceSurface that trims of BrepFace will be applied to. Return ValueA brep with the shape of surfaceSource and the trims of trimSource or null on failure.
但是问题终究要解决,这里面我们找到了问题所在,那么就从这个提供UV 修剪data的Surface入手,可能我们的原始Surface跟偏移后的Brep不是很Roughly相同形状,相同位置。我们就直接用另外的面来作为Retrim的输入面,试一试,如下图,我们将偏移成功的面作为修剪面提供给Retrim电池,就发现修剪成功了。
好吧,姑且这样解决。
但是好奇心总是让人想探究到底,为啥这个函数可能失败?我们是否能够修复它呢?我们继续跟随代码前进--
这个函数里面的核心语句如下:
Dim ptr As IntPtr = UnsafeNativeMethods.RHC_RhinoRetrimSurface( pConstBrepFace , pConstSurface )
碰到了UnsafeNativeMethods,这个玩意不止一次挡在真实底层代码前面,我们继续看下去发现
<DllImport("rhcommon_c", CallingConvention:=CallingConvention.Cdecl)> _Friend Shared Function RHC_RhinoRebuildCurve(ByVal pCurve As IntPtr, ByVal pCount As Integer, ByVal degree As Integer, <MarshalAs(UnmanagedType.U1)> ByVal keepTangents As Boolean) As IntPtrEnd Function
举报