CadQuery / CadQuery/cadquery

Support radiusArc with relative coordinates

Open
#219 5 comments 2 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
5.8k
Forks
541
Avg merge
3d 2h
Merged PRs (30d)
5

Description

Most of the line drawing functions exist in two forms. For example `line` and `lineTo`. Consider the code below that draws the cross section of some typical angle-iron. The radiusArc function has to refer back to the drawing start point and work out how it relates to the position of the end of the arc. With a relative version (shown in the comments) it would only need to know the radius.

```python
# Draws angle iron that looks a bit like
# this (with a radiused internal corner
# represented by the slashes):
#
# ┌────────┐
# │ /─────┘
# │ /
# │ │
# │ │
# └─┘

startPointX, startPointY = 12.3, 42.7
side = 75.0
thickness = 6.0
radius = 4.0
inside_length = side - (thickness + radius)

angle_section = (cq.Workplane('YZ', origin=(0, 0, 0))
.moveTo(startPointX, startPointY)
.vLine(-side) # Down the left-hand side
.hLine(thickness) # Along the bottom edge
.vLine(inside_length) # Up the inside vertical edge
# QUESTION: is there a way to do something relative with arcs?
# i.e. the difference between line() and lineTo(). Would be cleaner
# if this code was .radiusArc((radius, radius), radius)
# rather than having to refer back to the origin of the drawing.
.radiusArc((startPointX+thickness+radius, startPointY-thickness), radius)
.hLine(inside_length) # Along the inside horizontal edge
.vLine(thickness) # Up the right-hand side
.hLine(-side) # Along the top
.close()
)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.