Example #1
0
 def distance_on_curve(self, distance, close_parameter, estimate_parameter, check_seam=True):
     '''returns the parameter if there is a parameter
     on the curve with a distance length from u
     raises OutOfBoundary if no such parameter exists
     '''
     from OCC.GCPnts import GCPnts_AbscissaPoint
     ccc = GCPnts_AbscissaPoint(self.adaptor, distance, close_parameter, estimate_parameter, 1e-5)
     with assert_isdone(ccc, 'couldnt compute distance on curve'):
         return ccc.Parameter()
Example #2
0
 def distance_on_curve(self, distance, close_parameter, estimate_parameter):
     '''returns the parameter if there is a parameter
     on the curve with a distance length from u
     raises OutOfBoundary if no such parameter exists
     '''
     gcpa = GCPnts_AbscissaPoint(self.adaptor, distance, close_parameter,
                                 estimate_parameter, 1e-5)
     with assert_isdone(gcpa, 'couldnt compute distance on curve'):
         return gcpa.Parameter()
Example #3
0
    def length(self, lbound=None, ubound=None, tolerance=1e-5):
        '''returns the curve length
        if either lbound | ubound | both are given, than the lenght of the curve will be measured
        over that interval
        '''
        _min, _max = self.domain()
        if _min < self.adaptor.FirstParameter():
            raise ValueError('the lbound argument is lower than the first parameter of the curve: %s ' % (self.adaptor.FirstParameter()))
        if _max > self.adaptor.LastParameter():
            raise ValueError('the ubound argument is greater than the last parameter of the curve: %s ' % (self.adaptor.LastParameter()))

        lbound = _min if lbound is None else lbound
        ubound = _max if ubound is None else ubound
        return GCPnts_AbscissaPoint().Length(self.adaptor, lbound, ubound, tolerance)
def length_from_edge(edg):
    curve_adapt = BRepAdaptor_Curve(edg)
    length = GCPnts_AbscissaPoint().Length(curve_adapt,
                                           curve_adapt.FirstParameter(),
                                           curve_adapt.LastParameter(), 1e-6)
    return length