0
$\begingroup$

In the following code I am joining several objects. 'Plane1' and 'Plane2' have beveled corners. But when I join them to 'Cube' the bevels disappear. Why?

Below are two code snippets; the first creates the plane and the bevel (in case procedurally I should do something different), the second has the join operation that causes the bevels to disappear.

Here's the code that creates the plane and the bevel:

def add_plane_obj(ObjName):
    bpy.ops.mesh.primitive_plane_add(size=SizePlane1,enter_editmode=False,location=(-2,-2,BaseZ))
    bpy.context.active_object.name=ObjName
    bpy.ops.object.editmode_toggle()

def add_plane_resize(ScaleX, ScaleY):
    bpy.ops.transform.resize(value=(ScaleX,ScaleY,1))

def add_plane_material(MaterialsIndex, MaterialName, R, G, B):
    bpy.ops.material.new()
    try:
        bpy.data.materials[MaterialsIndex].name=MaterialName
    except:
        pass
    bpy.data.materials[MaterialName].diffuse_color=(R,G,B,1)
    bpy.context.object.data.materials.append(bpy.data.materials[MaterialName])

def add_plane(ObjName, MaterialName, MaterialsIndex, R, G, B, ScaleX, ScaleY):
    add_plane_obj(ObjName)
    add_plane_resize(ScaleX,ScaleY)
    add_plane_material(MaterialsIndex, MaterialName,R, G,B)

def bevel_plane(BevelWidth):
    bpy.ops.object.editmode_toggle()
    bpy.ops.object.modifier_add(type='BEVEL')
    bpy.context.object.modifiers["Bevel"].segments=15
    bpy.context.object.modifiers["Bevel"].width=BevelWidth
    bpy.context.object.modifiers["Bevel"].use_only_vertices=True

add_plane('Plane1','RSwhite3', 0, WhiteR, WhiteG, WhiteB, ScalarX, ScalarY)
bevel_plane(BevelWidth1)
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)


The following code causes the bevels to disappear after executing the join on 'Plane1' and 'Plane2:'

bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
bpy.ops.object.select_all(action='DESELECT')
bpy.data.objects['Cube'].select_set(True)
bpy.context.view_layer.objects.active = bpy.data.objects["Cube"]
bpy.data.objects['new_name'].select_set(True)
bpy.ops.object.join()
bpy.data.objects['Plane0'].select_set(True)
bpy.ops.object.join()
bpy.data.objects['Plane1'].select_set(True)
bpy.ops.object.join()
bpy.data.objects['Plane2'].select_set(True)
bpy.ops.object.join()
bpy.data.objects['Circle'].select_set(True)
bpy.ops.object.join()
$\endgroup$
1
$\begingroup$

As well as an object being selected, one object is known as the active object, this object has its properties shown in the properties panels and may be affected by some operators that will ignore the other selected objects.

In your case, when joining multiple objects, the modifiers of the active object are kept while modifiers on other objects are disposed of.

You could set the plane as the active object before the join or add the modifiers after the join. Most likely you want to apply the modifiers to the plane so that the bevel on the plane is kept and is not also added to other parts of the joined mesh.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.