I have written code that created dxf file with 2 cylinders stacked on top of each other, most of the part is working fine except when I add text into the 3d model it doesn't show in the Autodesk Viewer, any idea why or any possible fix? Below is my code
import ezdxf
from ezdxf.render import forms
from ezdxf.gfxattribs import GfxAttribs
from ezdxf import colors
from ezdxf.math import UCS, Vec3
from ezdxf.enums import TextEntityAlignment
# create the DXF document and model space
doc = ezdxf.new()
doc.styles.new('TXT', dxfattribs={'font': 'romans.shx'})
msp = doc.modelspace()
# create the first cylinder with a height of 10
cylinder_1 = forms.cylinder(radius=1.0, count=8).scale(1, 1, 5)
green = GfxAttribs(color=colors.GREEN)
# create the second cylinder with a height of 5
cylinder_2 = forms.cylinder(radius=1.0, count=8).scale(1, 1, 2)
blue = GfxAttribs(color=colors.BLUE)
# render the first cylinder as a MESH entity
cylinder_1.render_polyface(msp, dxfattribs=green)
# add text to first cylinder
ucs_1 = UCS(origin=(0, 0, 10), ux=(1, 0, 0), uz=(0, 1, 0))
text_1 = msp.add_text("Cylinder 1", dxfattribs={
'rotation': ucs_1.to_ocs(Vec3(45, 0, 0)).angle_deg,
'extrusion': ucs_1.uz,
'color': 1,
'style': 'TXT',
}).set_placement(ucs_1.to_ocs((0, 0, 0)), align=TextEntityAlignment.CENTER)
# translate the second cylinder to stack at bottom of first cylinder
cylinder_2.translate(0, 0, -2)
# render the second cylinder as a MESH entity
cylinder_2.render_polyface(msp, dxfattribs=blue)
doc.saveas("test.dxf")
I am only getting this view below in Autodesk Viewer, can't see any text
Hope to get some help on this. thank you all