Esempio n. 1
0
	def execute(self, context):#this is almost same as getobjectoutline, just without the need of operation data
		ob=bpy.context.active_object
		self.silh=utils.getObjectSilhouete('OBJECTS', objects=bpy.context.selected_objects)
		bpy.context.scene.cursor_location=(0,0,0)
		#smp=sgeometry.asMultiPolygon(self.silh)
		for smp in self.silh:
			polygon_utils_cam.shapelyToCurve(ob.name+'_silhouette',smp,0)#
		#bpy.ops.object.convert(target='CURVE')
		bpy.context.scene.cursor_location=ob.location
		bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
		return {'FINISHED'}
Esempio n. 2
0
	def execute(self, context):#this is almost same as getobjectoutline, just without the need of operation data
		ob=bpy.context.active_object
		self.silh=utils.getObjectSilhouete('OBJECTS', objects=bpy.context.selected_objects)
		bpy.context.scene.cursor_location=(0,0,0)
		#smp=sgeometry.asMultiPolygon(self.silh)
		for smp in self.silh:
			polygon_utils_cam.shapelyToCurve(ob.name+'_silhouette',smp,0)#
		#bpy.ops.object.convert(target='CURVE')
		bpy.context.scene.cursor_location=ob.location
		bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
		return {'FINISHED'}
Esempio n. 3
0
 def execute(self, context):  # this is almost same as getobjectoutline, just without the need of operation data
     ob = bpy.context.active_object
     self.silh = utils.getObjectSilhouete("OBJECTS", objects=bpy.context.selected_objects)
     poly = Polygon.Polygon()
     for p in self.silh:
         for ci in range(0, len(p)):
             poly.addContour(p[ci])
     bpy.context.scene.cursor_location = (0, 0, 0)
     polygon_utils_cam.polyToMesh(ob.name + "_silhouette", poly, 0)  #
     bpy.ops.object.convert(target="CURVE")
     bpy.context.scene.cursor_location = ob.location
     bpy.ops.object.origin_set(type="ORIGIN_CURSOR")
     return {"FINISHED"}
Esempio n. 4
0
	def execute(self, context):#this is almost same as getobjectoutline, just without the need of operation data
		ob=bpy.context.active_object
		self.silh=utils.getObjectSilhouete('OBJECTS', objects=bpy.context.selected_objects)
		poly=Polygon.Polygon()
		for p in self.silh:
			for ci in range(0,len(p)):
				poly.addContour(p[ci])
		bpy.context.scene.cursor_location=(0,0,0)
		polygon_utils_cam.polyToMesh(ob.name+'_silhouette',poly,0)#
		bpy.ops.object.convert(target='CURVE')
		bpy.context.scene.cursor_location=ob.location
		bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
		return {'FINISHED'}
Esempio n. 5
0
def addAutoBridges(o):
    """attempt to add auto bridges as set of curves"""
    utils.getOperationSources(o)
    # if not o.onlycurves:
    #	o.warnings+=('not curves')
    #	return;
    bridgecollectionname = o.bridges_collection_name
    if bridgecollectionname == '' or bpy.data.collections.get(
            bridgecollectionname) == None:
        bridgecollectionname = 'bridges_' + o.name
        bpy.data.collections.new(bridgecollectionname)
        bpy.context.collection.children.link(
            bpy.data.collections[bridgecollectionname])
    g = bpy.data.collections[bridgecollectionname]
    o.bridges_collection_name = bridgecollectionname
    for ob in o.objects:

        if ob.type == 'CURVE' or ob.type == 'TEXT':
            curve = utils.curveToShapely(ob)
        if ob.type == 'MESH':
            curve = utils.getObjectSilhouete('OBJECTS', [ob])
        # curve = shapelyToMultipolygon(curve)
        for c in curve:
            c = c.exterior
            minx, miny, maxx, maxy = c.bounds
            d1 = c.project(sgeometry.Point(maxx + 1000, (maxy + miny) / 2.0))
            p = c.interpolate(d1)
            bo = addBridge(p.x, p.y, -math.pi / 2, o.bridges_width,
                           o.cutter_diameter * 1)
            g.objects.link(bo)
            bpy.context.collection.objects.unlink(bo)
            d1 = c.project(sgeometry.Point(minx - 1000, (maxy + miny) / 2.0))
            p = c.interpolate(d1)
            bo = addBridge(p.x, p.y, math.pi / 2, o.bridges_width,
                           o.cutter_diameter * 1)
            g.objects.link(bo)
            bpy.context.collection.objects.unlink(bo)
            d1 = c.project(sgeometry.Point((minx + maxx) / 2.0, maxy + 1000))
            p = c.interpolate(d1)
            bo = addBridge(p.x, p.y, 0, o.bridges_width, o.cutter_diameter * 1)
            g.objects.link(bo)
            bpy.context.collection.objects.unlink(bo)
            d1 = c.project(sgeometry.Point((minx + maxx) / 2.0, miny - 1000))
            p = c.interpolate(d1)
            bo = addBridge(p.x, p.y, math.pi, o.bridges_width,
                           o.cutter_diameter * 1)
            g.objects.link(bo)
            bpy.context.collection.objects.unlink(bo)