Here is a simple script that you can try.
Paste this script in a new Text in your Text Editor
import bpy
import bmesh
# Selected Armature in Object Mode Required
obj = bpy.context.active_object
view_layer = bpy.context.view_layer
if obj.type == 'ARMATURE':
# Create new mesh object to contain the converted bones
mData = bpy.data.meshes.new( obj.name + "_Data" )
mObj = bpy.data.objects.new( obj.name + "_OBJ", mData )
# Link to current View Layer active Collection (link to scene)
view_layer.active_layer_collection.collection.objects.link(mObj)
# Using BMesh
bm = bmesh.new()
bm.from_mesh(mData) # initialize from mData
# Read Armature's Bones Data and assign each head and tail to vertices of a new edge
for bone in obj.data.bones:
bm.edges.new((bm.verts.new(bone.head_local), bm.verts.new(bone.tail_local)))
# Convert BMesh data to Mesh Data and rewrite mData
bm.to_mesh(mData)
bm.free() # no longer needed
Select your Armature object and run the script by pressing the Run button.
It will convert the bones to edges.
Note there will be duplicate vertices where bones connect. You can merge vertices if needed in Edit mode.
The object is of type Mesh which you can now export as an OBJ file.