def create(self, context): parent = None if context.active_object and is_one_of_points(context.active_object): parent = context.active_object if len(context.selected_objects ) == 1 and context.selected_objects[0].fp_type == self.FP_TYPE: parent = context.selected_objects[0] bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) obj = bpy.context.object Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) if parent: obj.parent = parent obj.fp_expression = self.DEFAULT_EXPRESSION obj.fp_angle = self.DEFAULT_ANGLE obj.fp_count = self.COUNT obj.lock_location = (True, True, True) obj.show_name = True obj.select = False mat = bpy.data.materials.new('ЗаливкаТочки') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat) return obj
def create(self, context): parent = context.active_object points_parent = [ obj for obj in bpy.data.objects if obj.fp_id > 0 and obj.fp_id in parent.fp_deps ] dep_id = tuple([d.fp_id for d in points_parent] + [0]) bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) obj = bpy.context.object Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) obj.fp_deps = dep_id obj.parent = parent obj.fp_expression = self.DEFAULT_EXPRESSION obj.lock_location = (True, True, True) obj.show_name = True obj.select = False mat = bpy.data.materials.new('ЗаливкаТочкиРазделениеКривойБезье') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat)
def create(self, context): circle = bpy.data.curves.new( name="Окружность", type="CURVE") # Create new curve datablock circle.dimensions = self.CIRCLE_DIMS circle.bevel_depth = self.CIRCLE_BEVEL_DEPTH circle.bevel_resolution = 12 circle.fill_mode = self.CIRCLE_FILL_MODE circle_mat = bpy.data.materials.new( 'ОбводкаДуги') # Create new material circle_mat.diffuse_color = self.STROKE_COLOR circle.materials.append(circle_mat) # Add material to the obj obj = bpy.data.objects.new('Окружность', circle) # Create new obj with datablock context.scene.objects.link(obj) # Link obj to the scene obj.parent = context.active_object obj.location = (0, 0, 0) # Place obj to a location obj.lock_location = (True, True, True) obj.show_name = True Counter.register(obj, self.FP_TYPE) # Register new obj for i in range(self._splines): spline = circle.splines.new('BEZIER') spline.bezier_points.add(1) for j in range(2): spline.bezier_points[j].co = (0, 0, 0) spline.bezier_points[j].handle_left = (0, 0, 0) spline.bezier_points[j].handle_right = (0, 0, 0) obj.fp_angles = (0.0, 360.0) obj.fp_expression = '1.5' circle.resolution_u = 64 obj.select = True
def create(self, context): parent = context.active_object dep_id = tuple([ d.fp_id for d in context.selected_objects if not d.fp_id == parent.fp_id ] + [0]) bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) obj = context.object Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) obj.parent = parent obj.fp_deps = dep_id obj.fp_expression = self.DEFAULT_EXPRESSION obj.lock_location = (True, True, True) obj.show_name = True obj.select = False mat = bpy.data.materials.new('ЗаливкаТочкиОтражениеЛинии') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat) draw_line = Line() parent.select = True obj.select = True draw_line.create(context)
def create(self, context): parent = context.active_object dep_id = tuple(parent.fp_deps30) bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) line_length = [0] * 29 obj = bpy.context.object Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) obj.fp_deps30 = dep_id obj.parent = parent obj.fp_expression = self.DEFAULT_EXPRESSION obj.lock_location = (True, True, True) obj.show_name = True obj.select = False obj.fp_line_length = line_length mat = bpy.data.materials.new('ЗаливкаТочкиРазделениеСложнойКривой') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat)
def MakePolyLine(self, cList, objects): curve = bpy.data.curves.new(name="Деталь", type='CURVE') curve.dimensions = '3D' curve.resolution_u = 2 curve.dimensions = self.CURVE_DIMS curve.bevel_depth = self.CURVE_BEVEL_DEPTH curve.bevel_resolution = 12 curve.fill_mode = self.CURVE_FILL_MODE curve_mat = bpy.data.materials.new('ОбводкаДетали') curve_mat.diffuse_color = self.STROKE_COLOR curve.materials.append(curve_mat) objectdata = bpy.data.objects.new("Деталь", curve) for item in objects: prop = objectdata.fp_deps_c.add() prop.name = 'new' prop.value = str(item.fp_id) objectdata.location = (0, 0, 0) #object origin objectdata.show_name = True bpy.context.scene.objects.link(objectdata) Counter.register(objectdata, self.FP_TYPE) polyline = curve.splines.new('POLY') polyline.points.add(len(cList) - 1) for num in range(len(cList)): polyline.points[num].co = tuple(cList[num]) + (1, ) polyline.order_u = len(polyline.points) - 1 polyline.use_endpoint_u = True
def create(self, context): curve = bpy.data.curves.new(name="Дуга", type="CURVE") curve.dimensions = self.CURVE_DIMS curve.bevel_depth = self.CURVE_BEVEL_DEPTH curve.bevel_resolution = 12 curve.fill_mode = self.CURVE_FILL_MODE curve_mat = bpy.data.materials.new('ОбводкаДуги') curve_mat.diffuse_color = self.STROKE_COLOR curve.materials.append(curve_mat) obj = bpy.data.objects.new("Дуга", curve) context.scene.objects.link(obj) obj.parent = context.active_object obj.location = (0, 0, 0) obj.lock_location = (True, True, True) obj.show_name = True Counter.register(obj, self.FP_TYPE) for i in range(self._splines): spline = curve.splines.new('BEZIER') spline.bezier_points.add(1) for j in range(2): spline.bezier_points[j].co = (0, 0, 0) spline.bezier_points[j].handle_left = (0, 0, 0) spline.bezier_points[j].handle_right = (0, 0, 0) obj.fp_angles = (0.0, 90.0) obj.fp_expression = '1.0' curve.resolution_u = 64
def create(self, context): if all(is_one_of_arc(item) for item in context.selected_objects): count_create_point = 2 elif all( is_one_of_bezier_curve(item) for item in context.selected_objects): count_create_point = 9 elif all(is_one_of_lines(item) for item in context.selected_objects): count_create_point = 1 elif ((is_one_of_lines(context.selected_objects[0]) and is_one_of_bezier_curve(context.selected_objects[1])) or (is_one_of_lines(context.selected_objects[1]) and is_one_of_bezier_curve(context.selected_objects[0]))): count_create_point = 3 elif ((is_one_of_lines(context.selected_objects[0]) and is_one_of_arc(context.selected_objects[1])) or (is_one_of_lines(context.selected_objects[1]) and is_one_of_arc(context.selected_objects[0]))): count_create_point = 2 elif ((is_one_of_arc(context.selected_objects[0]) and is_one_of_bezier_curve(context.selected_objects[1])) or (is_one_of_arc(context.selected_objects[1]) and is_one_of_bezier_curve(context.selected_objects[0]))): count_create_point = 6 parents = [ obj for obj in bpy.data.objects if obj.fp_id > 0 and ( obj.fp_id == context.selected_objects[0].fp_id or obj.fp_id == context.selected_objects[1].fp_id) ] dep_id = tuple([parents[0].fp_id] + [parents[1].fp_id] + [0]) count = 0 while count < count_create_point: bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) obj = context.object Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) obj.fp_deps = dep_id obj.fp_number = count obj.lock_location = (True, True, True) obj.show_name = True obj.select = False mat = bpy.data.materials.new('ЗаливкаТочкиПересеченияФигур') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat) count += 1
def create(self, context): dep_id = tuple([d.fp_id for d in context.selected_objects] + [0]) bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) obj = context.object Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) obj.fp_deps = dep_id obj.lock_location = (True, True, True) obj.show_name = True obj.select = False mat = bpy.data.materials.new('ЗаливкаТочкиПересеченияЛинииОси') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat) obj.location = self.DEFAULT_LOCATION
def create(self, context): dep_id = tuple([d.fp_id for d in context.selected_objects] + [0]) line1_points = [ obj for obj in bpy.data.objects if obj.fp_id > 0 and obj.fp_id in context.selected_objects[0].fp_deps ] line2_points = [ obj for obj in bpy.data.objects if obj.fp_id > 0 and obj.fp_id in context.selected_objects[1].fp_deps ] locations1 = [get_point_abs_location(point) for point in line1_points] locations2 = [get_point_abs_location(point) for point in line2_points] center = line_to_line({ "x": locations1[0][0], "y": locations1[0][1] }, { "x": locations1[1][0], "y": locations1[1][1] }, { "x": locations2[0][0], "y": locations2[0][1] }, { "x": locations2[1][0], "y": locations2[1][1] }) bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) obj = context.object obj.fp_deps = dep_id Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) obj.location = (center["points"][0]["x"], center["points"][0]["y"], 0) obj.lock_location = (True, True, True) obj.show_name = True mat = bpy.data.materials.new('ЗаливкаТочки') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat) return obj
def create(self, context, source_points=None): if not source_points: source_points = context.selected_objects locations = tuple( get_point_abs_location(point) for point in source_points) center = ((locations[1][0] - locations[0][0]) / 2 + locations[0][0], (locations[1][1] - locations[0][1]) / 2 + locations[0][1], 0.0) vectors = [Vector(location) for location in locations] curvedata = bpy.data.curves.new(name='Curve', type='CURVE') curvedata.dimensions = self.CURVE_DIMS curvedata.bevel_depth = self.CURVE_BEVEL_DEPTH curvedata.fill_mode = self.CURVE_FILL_MODE line_mat = bpy.data.materials.new('ОбводкаЛинии') line_mat.diffuse_color = self.STROKE_COLOR curvedata.materials.append(line_mat) objectdata = bpy.data.objects.new(self.BASE_NAME, curvedata) Counter.register(objectdata, self.FP_TYPE) objectdata.name = self.BASE_NAME + '.' + Counter.get_counter_suffix( objectdata) objectdata.fp_deps = tuple([so.fp_id for so in source_points] + [0]) objectdata.location = center objectdata.lock_location = (True, True, True) objectdata.show_name = True bpy.context.scene.objects.link(objectdata) polyline = curvedata.splines.new("POLY") polyline.points.add(len(vectors) - 1) for num in range(len(vectors)): x, y, z = vectors[num] polyline.points[num].co = (x - center[0], y - center[1], 0, 0.001) objectdata.fp_count = self.COUNT return objectdata
def create(self, count, context): number = 1 parent = context.active_object parent = [ obj for obj in bpy.data.objects if obj.fp_id > 0 and obj.fp_id in parent.fp_deps ] dep_id = tuple([parent[1].fp_id] + [0, 0]) nameParent = parent[0].name nameSelect = parent[1].name while number <= expression_to_value(count): bpy.data.objects[nameSelect].select = True bpy.data.objects[nameParent].select = True bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) obj = context.object Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) obj.parent = parent[0] obj.fp_deps = dep_id obj.fp_expression = count obj.fp_number = number number += 1 obj.lock_location = (True, True, True) obj.show_name = True obj.select = False mat = bpy.data.materials.new('ЗаливкаТочкиРазделениеЛинии') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat)
def create(self, context): curve = bpy.data.curves.new(name="КриваяБезье", type="CURVE") curve.dimensions = self.CURVE_DIMS curve.bevel_depth = self.CURVE_BEVEL_DEPTH curve.bevel_resolution = 12 curve.fill_mode = self.CURVE_FILL_MODE curve_mat = bpy.data.materials.new('ОбводкаКривойБезье') curve_mat.diffuse_color = self.STROKE_COLOR curve.materials.append(curve_mat) obj = bpy.data.objects.new("КриваяБезье", curve) obj.location = (0, 0, 0) obj.lock_location = (True, True, True) obj.show_name = True context.scene.objects.link(obj) Counter.register(obj, self.FP_TYPE) obj.fp_deps = tuple([item.fp_id for item in context.selected_objects] + [0]) spline = curve.splines.new('BEZIER') spline.bezier_points.add(1) curve.resolution_u = 64 locations = [ get_point_abs_location(item) for item in bpy.data.objects if item.fp_id > 0 and item.fp_id in obj.fp_deps ] obj.location = [(locations[0][j] + locations[1][j]) / 2 for j in range(3)] for index, loc in enumerate(locations): point_loc = [loc[i] - obj.location[i] for i in range(3)] obj.data.splines[0].bezier_points[index].co = point_loc obj.data.splines[0].bezier_points[index].handle_left = [ (point_loc[i] - 1.0 if i == 1 else point_loc[i]) for i in range(3) ] obj.data.splines[0].bezier_points[index].handle_right = [ (point_loc[i] + 1.0 if i == 1 else point_loc[i]) for i in range(3) ]
def create(self, context): locations = [] f_ids = [] self.create_countur(context.selected_objects) deps = [] curve = bpy.data.curves.new(name="Деталь", type='CURVE') curve.dimensions = '3D' curve.resolution_u = 2 curve.dimensions = self.CURVE_DIMS curve.bevel_depth = self.CURVE_BEVEL_DEPTH curve.bevel_resolution = 12 curve.fill_mode = self.CURVE_FILL_MODE curve_mat = bpy.data.materials.new('ОбводкаДетали') curve_mat.diffuse_color = self.STROKE_COLOR curve.materials.append(curve_mat) bpyObj = bpy.data.objects.new("Деталь", curve) # new_scene = bpy.data.scenes.new(bpyObj.name) Counter.register(bpyObj, self.FP_TYPE) bpyObj.location = (0, 0, 0) bpyObj.show_name = True # new_scene.objects.link(bpyObj) context.scene.objects.link(bpyObj) spline = bpyObj.data.splines.new('BEZIER') spline.use_cyclic_u = True points = spline.bezier_points points.add(len(self.POINTS) - 1) for index, point in enumerate(points): point.co = self.POINTS[index].pos point.handle_left = self.POINTS[index].hl point.handle_right = self.POINTS[index].hr bpyObj.layers[1] = True bpyObj.layers[0] = False curve.fill_mode = 'BACK' curve.dimensions = '2D' deps = [ e for e in self.USEDPOINTS if e not in deps and not deps.append(e) ] for i in range(30 - len(deps)): deps.append(0) bpyObj.fp_deps30 = deps # integration to the XPettern plugin points = [x.pos for x in self.POINTS] bpy_obj = obj_utils.create_object() location = Vector((0, 0, 0)) for point in points: location = location + point bpy_obj.location = location / len(points) curve = helpers.Curve.fromPoints(points) helpers.Wrapper(curve).toBpy(bpy_obj) # reset points self.POINTS = [] self.USEDPOINTS = []
def create(self, context): parent = context.active_object dep_id = tuple([ d.fp_id for d in context.selected_objects if not d.fp_id == parent.fp_id ] + [0, 0]) dep = [ d for d in context.selected_objects if not d.fp_id == parent.fp_id ] distance = get_distance( get_point_abs_location(context.selected_objects[0]), get_point_abs_location(context.selected_objects[1])) bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) obj = context.object Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) obj.parent = parent obj.fp_deps = dep_id obj.fp_expression = self.DEFAULT_EXPRESSION obj.lock_location = (True, True, True) obj.show_name = True # obj.select = False id_dart = obj.fp_id p_a_location = get_point_abs_location(obj.parent) d_a_location = get_point_abs_location([ d for d in bpy.data.objects if d.fp_id == obj.fp_deps[0] and d.fp_id > 0 ][0]) pd_dif = (p_a_location[0] - d_a_location[0], p_a_location[1] - d_a_location[1], 0.0) pd_hyp = sqrt(pd_dif[0]**2 + pd_dif[1]**2) op_hyp = expression_to_value(obj.fp_expression) proportion = op_hyp / pd_hyp if pd_hyp else 0 op_x = pd_dif[0] * proportion op_y = pd_dif[1] * proportion obj.location = (-op_x, -op_y, 0.0) print("parent 1 = ", obj.parent) obj.fp_angle = get_angle(get_point_abs_location(obj), get_point_abs_location(dep[0])) draw_line = Line() parent.select = True draw_line.create(context) mat = bpy.data.materials.new('ЗаливкаТочкиДляВытачки') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat) bpy.ops.mesh.primitive_plane_add(radius=self.POINT_RADIUS) obj = context.object Counter.register(obj, self.FP_TYPE) obj.name = self.BASE_NAME + '.' + Counter.get_counter_suffix(obj) obj.parent = dep[0] obj.fp_deps = tuple([parent.fp_id] + [0, 0]) obj.fp_expression = str(distance - expression_to_value(self.DEFAULT_EXPRESSION)) obj.lock_location = (True, True, True) obj.show_name = True obj.fp_dart = id_dart # obj.select = False p_a_location = get_point_abs_location(obj.parent) d_a_location = get_point_abs_location([ d for d in bpy.data.objects if d.fp_id == obj.fp_deps[0] and d.fp_id > 0 ][0]) pd_dif = (p_a_location[0] - d_a_location[0], p_a_location[1] - d_a_location[1], 0.0) pd_hyp = sqrt(pd_dif[0]**2 + pd_dif[1]**2) op_hyp = expression_to_value(obj.fp_expression) proportion = op_hyp / pd_hyp if pd_hyp else 0 op_x = pd_dif[0] * proportion op_y = pd_dif[1] * proportion obj.location = (-op_x, -op_y, 0.0) print("parent 2 = ", obj.parent) obj.fp_angle = get_angle(get_point_abs_location(obj), get_point_abs_location(parent)) draw_line = Line() dep[0].select = True draw_line.create(context) mat = bpy.data.materials.new('ЗаливкаТочкиДляВытачки') mat.diffuse_color = self.FILL_COLOR obj.data.materials.append(mat) for obj in bpy.data.objects: obj.select = False for line in bpy.data.objects: if line.fp_type == Line.FP_TYPE and ( (line.fp_deps[0] == parent.fp_id and line.fp_deps[1] == dep[0].fp_id) or (line.fp_deps[0] == dep[0].fp_id and line.fp_deps[1] == parent.fp_id)): line.select = True bpy.ops.object.delete() break
def create(self, context): self.POINTS = [] for point in bpy.context.selected_objects: point_location = list(get_point_abs_location(point)) handle_left = [0, 0, 0] handle_right = [0, 0, 0] for i in range(len(point_location)): if i == 1: handle_left[i] = point_location[i] + 1 handle_right[i] = point_location[i] - 1 else: handle_left[i] = point_location[i] handle_right[i] = point_location[i] new_point = PointsForCreateDetail(pos=point_location, hl=handle_left, hr=handle_right) self.POINTS.append(new_point) dep_custom = [0] * 30 len_selected_obj = len(context.selected_objects) - 1 for i in range(30): if i <= len_selected_obj: dep_custom[i] = context.selected_objects[i].fp_id else: dep_custom[i] = 0 dep_id = tuple(dep_custom) curve = bpy.data.curves.new(name="Сложная кривая", type='CURVE') curve.dimensions = self.CURVE_DIMS curve.bevel_depth = self.CURVE_BEVEL_DEPTH curve.bevel_resolution = 12 curve.fill_mode = self.CURVE_FILL_MODE curve_mat = bpy.data.materials.new('ОбводкаСложнойКривой') curve_mat.diffuse_color = self.STROKE_COLOR curve.materials.append(curve_mat) bpyObj = bpy.data.objects.new("Сложная кривая", curve) bpyObj.location = (0, 0, 0) bpyObj.lock_location = (True, True, True) bpyObj.show_name = True bpy.context.scene.objects.link(bpyObj) Counter.register(bpyObj, self.FP_TYPE) bpyObj.fp_deps30 = dep_id spline = bpyObj.data.splines.new('BEZIER') curve.resolution_u = 32 points = spline.bezier_points points.add(len(self.POINTS) - 1) locations = [ get_point_abs_location(item) for item in bpy.data.objects if item.fp_id > 0 and item.fp_id in bpyObj.fp_deps30 ] loc_x = 0 loc_y = 0 for i in range(len(locations)): loc_x += locations[i][0] / len(locations) for i in range(len(locations)): loc_y += locations[i][1] / len(locations) bpyObj.location = (loc_x, loc_y, 0.0) for index, loc in enumerate(locations): point_loc = [loc[i] - bpyObj.location[i] for i in range(3)] bpyObj.data.splines[0].bezier_points[index].co = point_loc bpyObj.data.splines[0].bezier_points[index].handle_left = [ (point_loc[i] - 1.0 if i == 1 else point_loc[i]) for i in range(3) ] bpyObj.data.splines[0].bezier_points[index].handle_right = [ (point_loc[i] + 1.0 if i == 1 else point_loc[i]) for i in range(3) ]
def add_guides(self, obj): count = 0 for x in obj.fp_deps30: if not x == 0: count += 1 chs = bpy.data.curves.new('Управляющие', type='CURVE') chs.dimensions = self.CURVE_DIMS chs.bevel_depth = self.CURVE_BEVEL_DEPTH / 1.0 chs.bevel_resolution = 12 chs.fill_mode = self.CURVE_FILL_MODE chs_mat = bpy.data.materials.new('ОбводкаУправляющей') chs_mat.diffuse_color = self.GUIDE_COLOR chs.materials.append(chs_mat) hobj = bpy.data.objects.new("Сложная кривая", chs) hobj.location = obj.location hobj.lock_location = (True, True, True) hobj.show_name = False hobj.hide_select = True hobj.fp_type = self.FP_TYPE_CONTROL_GUIDE bpy.context.scene.objects.link(hobj) for spline_index in range(count): spline_first = chs.splines.new('POLY') spline_first.points.add(1) spline_second = chs.splines.new('POLY') spline_second.points.add(1) bpoint = obj.data.splines[0].bezier_points[spline_index] if spline_index % 2 == 0: spline_first.points[0].co = list( obj.data.splines[0].bezier_points[spline_index].co) + [ 0.001 ] spline_first.points[1].co = list(bpoint.handle_right) + [0.001] spline_second.points[0].co = list( obj.data.splines[0].bezier_points[spline_index].co) + [ 0.001 ] spline_second.points[1].co = list(bpoint.handle_left) + [0.001] else: spline_first.points[0].co = list(bpoint.handle_left) + [0.001] spline_first.points[1].co = list( obj.data.splines[0].bezier_points[spline_index].co) + [ 0.001 ] spline_second.points[0].co = list( bpoint.handle_right) + [0.001] spline_second.points[1].co = list( obj.data.splines[0].bezier_points[spline_index].co) + [ 0.001 ] for wing_index in range(count): wing = obj.data.splines[0].bezier_points[wing_index] for handle_index in range(2): handle_loc = [wing.handle_left, wing.handle_right][handle_index] target_loc = [ handle_loc[i] + obj.location[i] for i in range(3) ] hcurv = bpy.data.curves.new("КонтрольнаяТочка", type="CURVE") hcurv.dimensions = "2D" hcurv.bevel_depth = self.CURVE_BEVEL_DEPTH / 1.0 hcurv.bevel_resolution = 12 hcurv.fill_mode = "BOTH" hcurv_mat = bpy.data.materials.new('ЗаливкаКонтрольнойТочки') hcurv_mat.diffuse_color = self.HANDLE_COLOR hcurv.materials.append(hcurv_mat) pobj = bpy.data.objects.new("КонтрольнаяТочка.000", hcurv) pobj.lock_location = (False, False, True) pobj.show_name = False Counter.register(pobj, self.FP_TYPE_CONTROL_POINT) pobj.fp_deps = [obj.fp_id, wing_index, handle_index] bpy.context.scene.objects.link(pobj) pobj.location = target_loc spl = hcurv.splines.new('NURBS') spl.points.add(3) spl.use_cyclic_u = True for j in range(4): spl.points[j].co = (self.HANDLE_RADIUS if j in [1, 2] else -self.HANDLE_RADIUS, self.HANDLE_RADIUS if j in [0, 1] else -self.HANDLE_RADIUS, 0.0, 0.001) chs.resolution_u = 12