Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added option to translate shapes #214

Merged
merged 6 commits into from
Mar 18, 2022

Conversation

shimwell
Copy link
Member

Proposed changes

These changes allow a translation to be added to an extruded shape.

behavior before:

it is not possible to translate a shape directly so this has to be done as a post process on the cadquery object

import paramak

extruded_straight = paramak.ExtrudeStraightShape(
    points=[
         (300, -300),
         (400, 0),
         (300, 300),
         (400, 300),
         (500, 0),
         (400, -300),
        ],
    distance=200
)
extruded_straight.solid = extruded_straight.solid.translate(200,0,0)

behavior afterwards:

now the shape can be translated when created

import paramak

extruded_straight = paramak.ExtrudeStraightShape(
    points=[
         (300, -300),
         (400, 0),
         (300, 300),
         (400, 300),
         (500, 0),
         (400, -300),
        ],
    distance=200,
    translate(200,0,0)
)

To merge this in there are still a few outstanding tasks:

  • add some units tests to check behavior is correct
  • add to the doc string to described the new feature
  • add the translate option to the other parametric shape classes to be consistent (perhaps I can do this later)

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Code refactoring
  • Documentation Update (if none of the other choices apply)
  • New tests

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@drjamesallison this might be of interest

@codecov
Copy link

codecov bot commented Mar 18, 2022

Codecov Report

Merging #214 (9195260) into develop (cf30eb9) will increase coverage by 0.50%.
The diff coverage is 83.33%.

❗ Current head 9195260 differs from pull request most recent head 953f249. Consider uploading reports for the commit 953f249 to get more accurate results

@@             Coverage Diff             @@
##           develop     #214      +/-   ##
===========================================
+ Coverage    95.64%   96.15%   +0.50%     
===========================================
  Files           79       79              
  Lines         5263     5281      +18     
===========================================
+ Hits          5034     5078      +44     
+ Misses         229      203      -26     
Impacted Files Coverage Δ
paramak/parametric_shapes/extruded_spline_shape.py 100.00% <ø> (ø)
...ramak/parametric_shapes/extruded_straight_shape.py 100.00% <ø> (ø)
paramak/parametric_shapes/rotate_spline_shape.py 100.00% <ø> (ø)
paramak/parametric_shapes/rotate_straight_shape.py 100.00% <ø> (ø)
paramak/parametric_shapes/sweep_spline_shape.py 100.00% <ø> (ø)
paramak/parametric_shapes/sweep_straight_shape.py 100.00% <ø> (ø)
paramak/parametric_shapes/extruded_circle_shape.py 98.18% <66.66%> (-1.82%) ⬇️
paramak/parametric_shapes/rotate_circle_shape.py 96.96% <66.66%> (-3.04%) ⬇️
paramak/parametric_shapes/sweep_circle_shape.py 98.33% <66.66%> (-1.67%) ⬇️
paramak/parametric_shapes/extruded_mixed_shape.py 100.00% <100.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf30eb9...953f249. Read the comment docs.

@shimwell shimwell changed the title added option to translate extudeded solids added option to translate shapes Mar 18, 2022
@shimwell shimwell merged commit d3312da into develop Mar 18, 2022
@shimwell shimwell deleted the adding_translate_to_extrude_shapes branch March 18, 2022 23:57
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.

1 participant