i’m trying to make a new script to help
calculate the size of some cables and diameters and make a list for these data!
but i need to keep the original curves in scene.
i have a scene with many objects including
some cables made with bezier curve type poly with bevel
the curves are cables with the proper diameter and lenght.
cable’s Diam is done either with a bevel curve or with the bevel depth!
now i need for each curve cable the following :
get cable name
convert curve to mesh and calculate the lenght of each mesh line = curve lenght
get the size
but whitout loosing the original curves.
find only curves bezier type poly then convert to a mesh line
so need to select each curve-cable make a copy
remove the bevel curve or extruded value
Note: i already have a function to calculate each segment lenght of mesh line with Bmesh data
and delete the curve copy
how to remove the bevel curve or extruded value
on the newly created curve object ?
and also get the diam of extruded or bevel size !
here is beginning of script I got up to now
import bpy import mathutils from mathutils import Vector from mathutils import * # Select all object and find curves only type bezier bpy.ops.object.select_all(action='SELECT') obj_sel = bpy.context.selected_objects print ('list LEN obj_sel=',len(obj_sel)) print () print () print (' ^^^^^^^^ print only Curve type object ^^^^^^') print () jj=0 for i in obj_sel: if i.type=='CURVE': print ('jj=',jj,'i=',i.name,'Type',i.type) jj+=1 print () print (' Qty of curves = ',jj) print () print () print (' Qty of curves = ',jj) print () for i in obj_sel: if i.type=='CURVE': print ('name = ', i.name,'Type',i.type ) ob = i.copy() ob.location.x = 10 ob.data = ob.data.copy() bpy.context.scene.objects.link(ob) bpy.context.scene.update() print ('new ob name new curve =', ob.name) # convert curve to mesh # Make a copy of the curve then ????? # Remove the bevel bpy.ops.object.convert( target='MESH') print ('new ob name new mesh line =', ob.name) MESHNAME = ob.name # bpy.context.active_object = ob # Delete objects MLINEOB = bpy.data.objects[MESHNAME] mesh = MLINEOB.data bpy.data.objects.remove(MLINEOB) bpy.data.meshes.remove(mesh) print (' DELETED OBJECT = ', MESHNAME ) print ()
add a poly curve in scene and run script
working but need to get rid of bevel on curves how ?
any help appreciated
have a nice day