コード例 #1
0
        elif isinstance(item, BSpline2D):
            path_style = GraphicPathStyle(
                line_width=line_width,
                stroke_color=Colors.blue_blue,
            )
            self._scene.polyline(
                item.points,
                path_style,
                user_data=item,
            )
            path_style = GraphicBezierStyle(
                line_width=5.0,
                stroke_color=Colors.black,
                show_control=True,
                control_color=Colors.red,
            )
            self._scene.add_spline(item, path_style)

        else:
            self._scene.add_geometry(item, path_style)

        self._update_bounding_box(item)


####################################################################################################

dxf_path = find_data_path('dxf', 'test-dxf-r15.dxf')

scene_importer = SceneImporter(dxf_path)
application.qml_application.scene = scene_importer.scene
コード例 #2
0
ファイル: test-measurement.py プロジェクト: maaaash/Patro
#
# You should have received a copy of the GNU Affero General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
#
####################################################################################################

####################################################################################################

from pathlib import Path

from Patro.Common.Logging import Logging
Logging.setup_logging()

from Patro.FileFormat.Valentina.Measurement import VitFile
from Patro.Measurement.Measurement import Measurements
from PatroExample import find_data_path

####################################################################################################

vit_path = find_data_path('measurements', 'measurements.vit')
vit_file = VitFile(vit_path)

# vit_file.measurements.dump()

yaml_path = Path('output', 'measurements.yaml')
vit_file.measurements.save_as_yaml(yaml_path)

measurements = Measurements()
measurements.load_yaml(yaml_path)
measurements.dump()
コード例 #3
0
            stroke_style=stroke_style,
            cap_style=CapStyle.RoundCap,
            # fill_color=fill_color,
        )

        transformation = self._screen_transformation * state.transform
        # transformation = state.transform
        # self._logger.info('Sate Transform\n' + str(transformation))
        if isinstance(item, SvgFormat.Path):
            # and state.stroke_dasharray is None
            path = item.path_data
        elif isinstance(item, SvgFormat.Rect):
            path = item.geometry
        path = path.transform(transformation)
        self._update_bounding_box(path)
        self._scene.add_path(path, path_style)

####################################################################################################

# svg_path = find_data_path('svg', 'basic-demo-2.by-hand.svg')
svg_path = find_data_path('svg', 'demo.svg')
# svg_path = find_data_path('svg', 'demo.simple.svg')
# svg_path = find_data_path('patterns-svg', 'veravenus-little-bias-dress.pattern-a0.svg')
# svg_path = find_data_path('patterns-svg', 'veravenus-little-bias-dress.pattern-a0.no-text-zaggy.svg')

# svg_file = SvgFile(svg_path)

scene_importer = SceneImporter(svg_path)
if use_qt:
    application.qml_application.scene = scene_importer.scene
コード例 #4
0
from Patro.FileFormat.Valentina.Pattern import ValFileReader, ValFileWriter
from Patro.GraphicEngine.GraphicScene.TypographyUnit import PointUnit
from Patro.GraphicEngine.Painter.Paper import PaperSize
from Patro.Pattern.SketchStyle import DetailSketchStyle
from PatroExample import find_data_path

from Patro.GraphicEngine.Painter.DxfPainter import DxfPainter
from Patro.GraphicEngine.Painter.MplPainter import MplPainter
from Patro.GraphicEngine.Painter.PdfPainter import PdfPainter
from Patro.GraphicEngine.Painter.SvgPainter import SvgPainter
from Patro.GraphicEngine.Painter.TexPainter import TexPainter

####################################################################################################

val_file = 'flat-city-trouser.val'
val_path = find_data_path('patterns-valentina', val_file)

val_file = ValFileReader(val_path)
pattern = val_file.pattern

scope_names = pattern.scope_names()
print(scope_names)
scope = pattern.scope(scope_names[0])
sketch = scope.sketch

sketch.dump()

for operation in sketch.operations:
    print(operation.to_python())

nodes = sketch.calculator.dag.topological_sort()
コード例 #5
0
ファイル: svg-import.py プロジェクト: FabriceSalvaire/Patro
            # fill_color=fill_color,
        )

        transformation = self._screen_transformation * state.transform
        # transformation = state.transform
        # self._logger.info('Sate Transform\n' + str(transformation))
        if isinstance(item, SvgFormat.Path):
            # and state.stroke_dasharray is None
            path = item.path_data
        elif isinstance(item, SvgFormat.Rect):
            path = item.geometry
        path = path.transform(transformation)
        self._update_bounding_box(path)
        self._scene.add_path(path, path_style)


####################################################################################################

# svg_path = find_data_path('svg', 'basic-demo-2.by-hand.svg')
svg_path = find_data_path('svg', 'demo.svg')
# svg_path = find_data_path('svg', 'demo.simple.svg')
svg_path = find_data_path('patterns-svg',
                          'veravenus-little-bias-dress.pattern-a0.svg')
# svg_path = find_data_path('patterns-svg', 'veravenus-little-bias-dress.pattern-a0.no-text-zaggy.svg')

# svg_file = SvgFile(svg_path)

scene_importer = SceneImporter(svg_path)
if use_qt:
    application.qml_application.scene = scene_importer.scene