Skip to content

Some examples how projectionDir works in SVG export #1685

Open
@Jopie01

Description

@Jopie01

I'm really struggling to make any sense how the projectionDir option works in exporting a SVG. The documentation tells me: Direction the camera will view the shape from., but how is that direction defined?

Imagine the following example

import cadquery as cq

box = cq.Workplane('XY').box(10, 20, 10)
box = box.faces("<X").workplane().circle(2).cutThruAll()

cq.exporters.export(box,
    "box_custom_options.svg",
    opt={
        "width": 300,
        "height": 300,
        "marginLeft": 10,
        "marginTop": 10,
        "showAxes": False,
        "projectionDir": (1, 0, 0),  # <-- I'm lost how this works
        "strokeWidth": 0.25,
        "strokeColor": (255, 0, 0),
        "hiddenColor": (0, 0, 255),
        "showHidden": False,
    },
)

When you run this in cq-editor you will get the following SVG
g6

But I want that image 90 degrees rotated like so
g7

But I can't get my head around how to do that. Are there any examples how projectionDir works and how to use it? It would be really nice if it was possible to define the rotations about the XYZ like you can when assembling parts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions