Beispiel #1
0
 def cross_curves2(self):
     self.curves = list()
     import nurbs_tools
     params1 = self.cos1.build_param_list(self.railSamples)
     params2 = self.cos2.build_param_list(self.railSamples)
     if self.untwist:
         self.cos2.param_list.reverse()
     sc1 = self.compute_scale(self.var_scale1, self.cos1.edge)
     sc2 = self.compute_scale(self.var_scale2, self.cos2.edge)
     #if self.untwist:
     #c2 = self.cos2.get_cross_curves(self.railSamples, 1.0, True)
     #sc2.reverse()
     blends = list()
     for i in range(self.railSamples):
         pt1 = self.cos1.edgeOnFace.valueAt(self.cos1.param_list[i])
         pt2 = self.cos2.edgeOnFace.valueAt(self.cos2.param_list[i])
         c1 = self.cos1.get_cross_curve_toward_point(
             self.cos1.param_list[i], pt2, 1e-1, False)
         c2 = self.cos2.get_cross_curve_toward_point(
             self.cos2.param_list[i], pt1, 1e-1, False)
         b = nurbs_tools.blendCurve(c1, c2)
         b.cont1 = self.cont1
         b.cont2 = self.cont2
         if sc1:
             b.scale1 = sc1[i].y
         else:
             b.scale1 = self.scale1
         if sc2:
             b.scale2 = sc2[i].y
         else:
             b.scale2 = self.scale2
         b.compute()
         blends.append(b.shape())
         self.curves.append(b)
     return (blends)
Beispiel #2
0
 def blend_curves(self):
     blend_curves = list()
     import nurbs_tools
     offset_curve_1 = self.cos1.get_offset_curve2d(0.1)
     offset_curve_2 = self.cos2.get_offset_curve2d(0.1)
     sc1 = self.compute_scale(self.var_scale1, self.cos1.edge)
     sc2 = self.compute_scale(self.var_scale2, self.cos2.edge)
     self.cos1.build_param_list(self.railSamples)
     self.cos2.build_param_list(self.railSamples)
     if self.untwist:
         self.cos2.param_list.reverse()
         sc2.reverse()
     for i in range(self.railSamples):
         c1 = self.cos1.get_cross_curve(offset_curve_1,
                                        self.cos1.param_list[i])
         c2 = self.cos2.get_cross_curve(offset_curve_2,
                                        self.cos2.param_list[i])
         b = nurbs_tools.blendCurve(c1, c2)
         b.cont1 = self.cont1
         b.cont2 = self.cont2
         b.param1 = b.edge1.LastParameter
         b.param2 = b.edge2.LastParameter
         if sc1:
             b.scale1 = sc1[i].y
         else:
             b.scale1 = self.scale1
         if sc2:
             b.scale2 = sc2[i].y
         else:
             b.scale2 = self.scale2
         b.compute()
         blend_curves.append(b.shape())
         self.curves.append(b)
     return (blend_curves)
Beispiel #3
0
 def cross_curves(self):
     self.curves = list()
     import nurbs_tools
     c1 = self.cos1.get_cross_curves(self.railSamples, 1.0)
     c2 = self.cos2.get_cross_curves(self.railSamples, 1.0)
     sc1 = self.compute_scale(self.var_scale1, self.cos1.edge)
     sc2 = self.compute_scale(self.var_scale2, self.cos2.edge)
     if self.untwist:
         c2 = self.cos2.get_cross_curves(self.railSamples, 1.0, True)
         sc2.reverse()
     blends = list()
     for i in range(self.railSamples):
         b = nurbs_tools.blendCurve(c1[i], c2[i])
         b.cont1 = self.cont1
         b.cont2 = self.cont2
         if sc1:
             b.scale1 = sc1[i].y
         else:
             b.scale1 = self.scale1
         if sc2:
             b.scale2 = sc2[i].y
         else:
             b.scale2 = self.scale2
         b.compute()
         blends.append(b.shape())
         self.curves.append(b)
     return (blends)
Beispiel #4
0
 def compute(self, fp):
     e1 = _utils.getShape(fp, "Edge1", "Edge")
     e2 = _utils.getShape(fp, "Edge2", "Edge")
     if e1 and e2:
         bc = nurbs_tools.blendCurve(e1, e2)
         bc.param1 = e1.FirstParameter + fp.Parameter1 * (e1.LastParameter -
                                                          e1.FirstParameter)
         bc.param2 = e2.FirstParameter + fp.Parameter2 * (e2.LastParameter -
                                                          e2.FirstParameter)
         bc.cont1 = self.getContinuity(fp.Continuity1)
         bc.cont2 = self.getContinuity(fp.Continuity2)
         bc.scale1 = fp.Scale1
         bc.scale2 = fp.Scale2
         bc.maxDegree = fp.DegreeMax
         bc.compute()
         return bc
     return None
Beispiel #5
0
    def update_shape(self):
        e1 = _utils.getShape(self.Object, "Edge1", "Edge")
        e2 = _utils.getShape(self.Object, "Edge2", "Edge")
        if e1 and e2:
            bc = nurbs_tools.blendCurve(e1, e2)
            v = Part.Vertex(self.m1.point)
            proj = v.distToShape(self.m1.snap_shape)[1][0][1]
            bc.param1 = e1.Curve.parameter(proj)
            #bc.param1 = (pa1 - self.m1.snap_shape.FirstParameter) / (self.m1.snap_shape.LastParameter - self.m1.snap_shape.FirstParameter)
            bc.scale1 = self.t1.parameter
            bc.cont1 = self.Object.Proxy.getContinuity(self.c1.text[0])

            v = Part.Vertex(self.m2.point)
            proj = v.distToShape(self.m2.snap_shape)[1][0][1]
            bc.param2 = e2.Curve.parameter(proj)
            #bc.param2 = (pa2 - self.m2.snap_shape.FirstParameter) / (self.m2.snap_shape.LastParameter - self.m2.snap_shape.FirstParameter)
            bc.scale2 = self.t2.parameter
            bc.cont2 = self.Object.Proxy.getContinuity(self.c2.text[0])
            bc.maxDegree = self.Object.DegreeMax
            bc.compute()
            self.Object.Shape = bc.Curve.toShape()
            return bc