Skip to content

(Part 2/3) Project 3D part to plane#2002

Open
antonysigma wants to merge 1 commit intoCadQuery:masterfrom
antonysigma:project-to-viewpoint
Open

(Part 2/3) Project 3D part to plane#2002
antonysigma wants to merge 1 commit intoCadQuery:masterfrom
antonysigma:project-to-viewpoint

Conversation

@antonysigma
Copy link

Simulate the API from Build123d project_to_viewpoint: Given a 3D vector representing the camera position pointing at the origin (0,0,0), render all visible edges/arcs/splines representing the outline of the 3D part projected to the camera.

Also render all hidden edges/arcs/splines.

Provide and example script tests/test_projection.py where a generic part (A bracket with rounded corners and a countersunk hole) is projected to top view, side view, front view, and orthogonal view, and then exported to DXF 2D drawings.

Reference: https://build123d.readthedocs.io/en/latest/tech_drawing_tutorial.html

Expected output from tests/test_projection.py:

image

Follow-up of MR #2001 .
Related to: #122, #1767

Comment on lines +56 to +58
# Expected DXF output to be identical to SVG output
exportSVG3rdAngleProjection(drilled, "")
exportDXF3rdAngleProjection(drilled, "")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Help wanted to move this example code to examples/ folder.

Comment on lines +15 to +19
cq.exporters.exportDXF(
visible_edges,
f"{prefix}{name}.dxf",
doc_units=6,
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dimensioning in Librecad:

Image

@antonysigma antonysigma force-pushed the project-to-viewpoint branch 2 times, most recently from 97a6903 to d975b18 Compare February 27, 2026 21:23
@adam-urbanczyk
Copy link
Member

OK, let's get this going. @antonysigma could you run our version of black in the codebase?

Simulate the API from Build123d `project_to_viewpoint`: Given a 3D
vector representing the camera position pointing at the origin
`(0,0,0)`, render all visible edges/arcs/splines representing the outline
of the 3D part projected to the camera.

Also render all hidden edges/arcs/splines.

Provide and example script `tests/test_projection.py` where a generic
part (A bracket with rounded corners and a countersunk hole) is
projected to top view, side view, front view, and orthogonal view, and
then exported to DXF 2D drawings.

Reference: https://build123d.readthedocs.io/en/latest/tech_drawing_tutorial.html
@antonysigma antonysigma force-pushed the project-to-viewpoint branch from d975b18 to 8de8187 Compare March 12, 2026 17:43
@antonysigma
Copy link
Author

OK, let's get this going. @antonysigma could you run our version of black in the codebase?

Done running black and pushed the new commit. Let me know if you need anything else.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants