Skip to main content
added 71 characters in body
Source Link
batFINGER
  • 84.6k
  • 10
  • 110
  • 237

Boundary edges

I essentially want to put a fence up around the edge of my object

IMO Simplest here to select edges that are boundaries, ie are connected to only one face.

import bpy
import bmesh

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)

for e in bm.edges:
    e.select = e.is_boundary
    
bmesh.update_edit_mesh(me)

The vertex selection is implied by the edges. .. which is why I could have used

e.select_set(e.is_boundary)

BMEdge.select_set(select):

Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.

Although in this case I'm of the belief that the verts of an edge are selected with the edge. So

verts = set(v for e in boundary_edges for v in e.verts)

will be same as selected verts.

v for v in bm.verts if v.select

Using the bmesh to extrude those edges.

Rather than selecting the edges, can instead feed them directly into bmesh operators. For the example below the vertices created as a result of extruding boundary edges are fed into transform operator, and moved up one in Z.

enter image description here Result on 10 x 10 default grid import bpy import bmesh from

Notice newly created geometry added with bmesh is unselected by default.types import BMVert from mathutils import Matrix Run both these scripts below in edit mode.

import bpy
import bmesh
from bmesh.types import BMVert
from mathutils import Matrix

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)
bmesh.ops.transform(
    bm,
    verts = [
            e for e in 
                bmesh.ops.extrude_edge_only(
                    bm,
                    edges=[e for e in bm.edges if e.is_boundary],
            )["geom"] 
            if isinstance(e, BMVert)
            ],
    matrix=Matrix.Translation((0, 0, 1)),
    )
    
bmesh.update_edit_mesh(me)

Boundary edges

I essentially want to put a fence up around the edge of my object

IMO Simplest here to select edges that are boundaries, ie are connected to only one face.

import bpy
import bmesh

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)

for e in bm.edges:
    e.select = e.is_boundary
    
bmesh.update_edit_mesh(me)

The vertex selection is implied by the edges. .. which is why I could have used

e.select_set(e.is_boundary)

BMEdge.select_set(select):

Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.

Although in this case I'm of the belief that the verts of an edge are selected with the edge. So

verts = set(v for e in boundary_edges for v in e.verts)

will be same as selected verts.

v for v in bm.verts if v.select

Using the bmesh to extrude those edges.

Rather than selecting the edges, can instead feed them directly into bmesh operators. For the example below the vertices created as a result of extruding boundary edges are fed into transform operator, and moved up one in Z.

enter image description here Result on 10 x 10 default grid import bpy import bmesh from bmesh.types import BMVert from mathutils import Matrix

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)
bmesh.ops.transform(
    bm,
    verts = [
            e for e in 
                bmesh.ops.extrude_edge_only(
                    bm,
                    edges=[e for e in bm.edges if e.is_boundary],
            )["geom"] 
            if isinstance(e, BMVert)
            ],
    matrix=Matrix.Translation((0, 0, 1)),
    )
    
bmesh.update_edit_mesh(me)

Boundary edges

I essentially want to put a fence up around the edge of my object

IMO Simplest here to select edges that are boundaries, ie are connected to only one face.

import bpy
import bmesh

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)

for e in bm.edges:
    e.select = e.is_boundary
    
bmesh.update_edit_mesh(me)

The vertex selection is implied by the edges. .. which is why I could have used

e.select_set(e.is_boundary)

BMEdge.select_set(select):

Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.

Although in this case I'm of the belief that the verts of an edge are selected with the edge. So

verts = set(v for e in boundary_edges for v in e.verts)

will be same as selected verts.

v for v in bm.verts if v.select

Using the bmesh to extrude those edges.

Rather than selecting the edges, can instead feed them directly into bmesh operators. For the example below the vertices created as a result of extruding boundary edges are fed into transform operator, and moved up one in Z.

enter image description here Result on 10 x 10 default grid

Notice newly created geometry added with bmesh is unselected by default. Run both these scripts below in edit mode.

import bpy
import bmesh
from bmesh.types import BMVert
from mathutils import Matrix

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)
bmesh.ops.transform(
    bm,
    verts = [
            e for e in 
                bmesh.ops.extrude_edge_only(
                    bm,
                    edges=[e for e in bm.edges if e.is_boundary],
            )["geom"] 
            if isinstance(e, BMVert)
            ],
    matrix=Matrix.Translation((0, 0, 1)),
    )
    
bmesh.update_edit_mesh(me)
added 71 characters in body
Source Link
batFINGER
  • 84.6k
  • 10
  • 110
  • 237

Boundary edges

I essentially want to put a fence up around the edge of my object

IMO Simplest here to select edges that are boundaries, ie are connected to only one face.

import bpy
import bmesh

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)

for e in bm.edges:
    e.select = e.is_boundary
    
bmesh.update_edit_mesh(me)

The vertex selection is implied by the edges. .. which is why I could have used

e.select_set(e.is_boundary)

BMEdge.select_set(select):

Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.

Although in this case I'm of the belief that the verts of an edge are selected with the edge. So

verts = set(v for e in boundary_edges for v in e.verts)

will be same as selected verts.

v for v in bm.verts if v.select

Using the bmesh to extrude those edges.

Rather than selecting the edges, can instead feed them directly into bmesh operators. For the example below the vertices created as a result of extruding boundary edges are fed into transform operator, and moved up one in Z.

enter image description here Result on 10 x 10 default grid import bpy import bmesh from bmesh.types import BMVert from mathutils import Matrix

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)
bmesh.ops.transform(
    bm,
    verts = [
            e for e in 
                bmesh.ops.extrude_edge_only(
                    bm,
                    edges=[e for e in bm.edges if e.is_boundary],
            )["geom"] 
            if isinstance(e, BMVert)
            ],
    matrix=Matrix.Translation((0, 0, 1)),
    )
    
bmesh.update_edit_mesh(me)

Boundary edges

IMO Simplest here to select edges that are boundaries, ie are connected to only one face.

import bpy
import bmesh

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)

for e in bm.edges:
    e.select = e.is_boundary
    
bmesh.update_edit_mesh(me)

The vertex selection is implied by the edges. .. which is why I could have used

e.select_set(e.is_boundary)

BMEdge.select_set(select):

Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.

Although in this case I'm of the belief that the verts of an edge are selected with the edge. So

verts = set(v for e in boundary_edges for v in e.verts)

will be same as selected verts.

v for v in bm.verts if v.select

Using the bmesh to extrude those edges.

Rather than selecting the edges, can instead feed them directly into bmesh operators. For the example below the vertices created as a result of extruding boundary edges are fed into transform operator, and moved up one in Z.

enter image description here Result on 10 x 10 default grid import bpy import bmesh from bmesh.types import BMVert from mathutils import Matrix

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)
bmesh.ops.transform(
    bm,
    verts = [
            e for e in 
                bmesh.ops.extrude_edge_only(
                    bm,
                    edges=[e for e in bm.edges if e.is_boundary],
            )["geom"] 
            if isinstance(e, BMVert)
            ],
    matrix=Matrix.Translation((0, 0, 1)),
    )
    
bmesh.update_edit_mesh(me)

Boundary edges

I essentially want to put a fence up around the edge of my object

IMO Simplest here to select edges that are boundaries, ie are connected to only one face.

import bpy
import bmesh

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)

for e in bm.edges:
    e.select = e.is_boundary
    
bmesh.update_edit_mesh(me)

The vertex selection is implied by the edges. .. which is why I could have used

e.select_set(e.is_boundary)

BMEdge.select_set(select):

Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.

Although in this case I'm of the belief that the verts of an edge are selected with the edge. So

verts = set(v for e in boundary_edges for v in e.verts)

will be same as selected verts.

v for v in bm.verts if v.select

Using the bmesh to extrude those edges.

Rather than selecting the edges, can instead feed them directly into bmesh operators. For the example below the vertices created as a result of extruding boundary edges are fed into transform operator, and moved up one in Z.

enter image description here Result on 10 x 10 default grid import bpy import bmesh from bmesh.types import BMVert from mathutils import Matrix

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)
bmesh.ops.transform(
    bm,
    verts = [
            e for e in 
                bmesh.ops.extrude_edge_only(
                    bm,
                    edges=[e for e in bm.edges if e.is_boundary],
            )["geom"] 
            if isinstance(e, BMVert)
            ],
    matrix=Matrix.Translation((0, 0, 1)),
    )
    
bmesh.update_edit_mesh(me)
added 1026 characters in body
Source Link
batFINGER
  • 84.6k
  • 10
  • 110
  • 237

Boundary edges

IMO Simplest here to select edges that are boundaries, ie are connected to only one face.

import bpy
import bmesh

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)

for e in bm.edges:
    e.select = e.is_boundary
    
bmesh.update_edit_mesh(me)

The vertex selection is implied by the edges. .. which is why I could have used

e.select_set(e.is_boundary)

BMEdge.select_set(select):

Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.

Although in this case I'm of the belief that the verts of an edge are selected with the edge. So

verts = set(v for e in boundary_edges for v in e.verts)

will be same as selected verts.

v for v in bm.verts if v.select

Using the bmesh to extrude those edges.

Rather than selecting the edges, can instead feed them directly into bmesh operators. For the example below the vertices created as a result of extruding boundary edges are fed into transform operator, and moved up one in Z.

enter image description here Result on 10 x 10 default grid import bpy import bmesh from bmesh.types import BMVert from mathutils import Matrix

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)
bmesh.ops.transform(
    bm,
    verts = [
            e for e in 
                bmesh.ops.extrude_edge_only(
                    bm,
                    edges=[e for e in bm.edges if e.is_boundary],
            )["geom"] 
            if isinstance(e, BMVert)
            ],
    matrix=Matrix.Translation((0, 0, 1)),
    )
    
bmesh.update_edit_mesh(me)

Boundary edges

IMO Simplest here to select edges that are boundaries, ie are connected to only one face.

import bpy
import bmesh

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)

for e in bm.edges:
    e.select = e.is_boundary
    
bmesh.update_edit_mesh(me)

The vertex selection is implied by the edges. .. which is why I could have used

e.select_set(e.is_boundary)

BMEdge.select_set(select):

Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.

Although in this case I'm of the belief that the verts of an edge are selected with the edge. So

verts = set(v for e in boundary_edges for v in e.verts)

will be same as selected verts.

v for v in bm.verts if v.select

Boundary edges

IMO Simplest here to select edges that are boundaries, ie are connected to only one face.

import bpy
import bmesh

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)

for e in bm.edges:
    e.select = e.is_boundary
    
bmesh.update_edit_mesh(me)

The vertex selection is implied by the edges. .. which is why I could have used

e.select_set(e.is_boundary)

BMEdge.select_set(select):

Set the selection. This is different from the select attribute because it updates the selection state of associated geometry.

Although in this case I'm of the belief that the verts of an edge are selected with the edge. So

verts = set(v for e in boundary_edges for v in e.verts)

will be same as selected verts.

v for v in bm.verts if v.select

Using the bmesh to extrude those edges.

Rather than selecting the edges, can instead feed them directly into bmesh operators. For the example below the vertices created as a result of extruding boundary edges are fed into transform operator, and moved up one in Z.

enter image description here Result on 10 x 10 default grid import bpy import bmesh from bmesh.types import BMVert from mathutils import Matrix

ob = bpy.context.edit_object

me = ob.data
bm = bmesh.from_edit_mesh(me)
bmesh.ops.transform(
    bm,
    verts = [
            e for e in 
                bmesh.ops.extrude_edge_only(
                    bm,
                    edges=[e for e in bm.edges if e.is_boundary],
            )["geom"] 
            if isinstance(e, BMVert)
            ],
    matrix=Matrix.Translation((0, 0, 1)),
    )
    
bmesh.update_edit_mesh(me)
deleted 1 character in body
Source Link
batFINGER
  • 84.6k
  • 10
  • 110
  • 237
Loading
added 488 characters in body
Source Link
batFINGER
  • 84.6k
  • 10
  • 110
  • 237
Loading
Source Link
batFINGER
  • 84.6k
  • 10
  • 110
  • 237
Loading