Replies: 2 comments 3 replies
-
hmm. I just noticed this comment at the top of the if layout_properties is not None:
# TODO: this does not work, layer properties have to be re-evaluated!
self.ctx.current_layout_properties = layout_properties
else:
self.ctx.set_current_layout(layout) |
Beta Was this translation helpful? Give feedback.
-
The ColorPolicy does what you want. # black and white output
config = Configuration(
color_policy = ColorPolicy.BLACK,
background_policy=BackgroundPolicy.WHITE,
)
# or map all colors to custom color
config = Configuration(
color_policy = ColorPolicy.CUSTOM,
custom_fg_color = "#FF0000",
background_poliy=BackgroundPolicy.CUSTOM,
custom_bg_color = "#0000FF",
)
frontend = Frontend(
ctx=RenderContext(doc),
out=svg.SVGBackend(),
config=config,
) Additional ways to override the ACIThe way CAD applications allow users to set their own ACI colors is the The Override ctx = RenderContext(doc, ctb="your.ctb") Another way to override the default ACI colors is to inherit from the class MyFrontend(Frontend):
def override_properties(self, entity: DXFGraphic, properties: Properties) -> None:
if properties.pen = 7: # the ACI
properties.color = "#AABBCC" These are old features and there are better ways to do that. The But the EDIT: I can/will fix this two problems without breaking existing code. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Simply provide some greater control over the colors used to render ACI colors from the drawing add-on.
It is useful to adjust the colors to have better contrast on some background (it is already possible to set the background color and the contrast color with
LayoutProperties
). It could also be useful to force all elements to a single color, say blue, to provide a simplified visual, say like a blueprint.Just "reaching into" the
ezdxf.colors
module and changing the color values in theDXF_DEFAULT_COLORS
andDXF_DEFAULT_PAPERSPACE_COLORS
lists doesn't seem to have the intended effect.I could work on a PR, assuming this would be a welcome feature.
Beta Was this translation helpful? Give feedback.
All reactions