Skip to content
Discussion options

You must be logged in to vote

You have to render the text as HATCH entities. The first example shows how to render HATCHES with solid filling:

import ezdxf
from ezdxf.addons import text2path
from ezdxf.tools import fonts
from ezdxf.math import Matrix44
from ezdxf import zoom

doc = ezdxf.new()
msp = doc.modelspace()

hatches = text2path.make_hatches_from_str(
    "厂牌AAA123",
    font=fonts.FontFace(family="SimSun"),
    size=4,
)
m = Matrix44.translate(2, 1.5, 0)

for hatch in hatches:
    hatch.transform(m)
    hatch.set_solid_fill(color=1, style=0)
    msp.add_entity(hatch)

zoom.extents(msp)
doc.saveas("text2solid_hatch.dxf")

The HATCH entity can be filled with predefined patterns, but this involves much guessing:

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@mozman
Comment options

@shine-flower
Comment options

@shine-flower
Comment options

Answer selected by shine-flower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #741 on September 17, 2022 02:31.