Skip to content

mkondratyev85/pattern_definition_editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pattern_definition_editor

This is a simple editor for pattern definitions that could be used by ezdxf library to create custom pattern definition to fill polygons.

Select line to edit by hitting 'Select Line' and then clicking on the desire line.

By moving rectangular control anchors you can change origin point of the line, its angle, offset.

If you want selected line to has dashed pattern click 'Add Dash to Line' it will make line 'dashed' and it will also add another one control anchor.

It saves pattern definition as lists via pickle module. You can open saved files to edit them later. Or, you can use them in ezdxf like this:

import pickle

import ezdxf

# load pattern definition from file
filename = '/tmp/pd.pickle'
with open(filename, 'rb') as f:
    pattern_definition = pickle.load(f)

doc = ezdxf.new('R2010')
msp = doc.modelspace()
hatch = msp.add_hatch()
hatch.set_pattern_fill('MY_PATTERN',
                       definition=pattern_definition,
                       scale=0.01
                       )
hatch.paths.add_polyline_path(
    [(0, 0), (0, 3), (3, 6), (6, 6), (6, 3), (3, 0)],
    )
doc.saveas('/tmp/example.dxf')  # save DXF drawing

This will produce hatched pattern that is supported at least by AutoCad and QCad:

Requirements

python3.7

About

GUI editor for pattern definition files in ezdxf format

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages