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

Shape.workplane can now accept a cadquery.Plane object #84

Merged
merged 6 commits into from
Sep 18, 2021

Conversation

RemDelaporteMathurin
Copy link
Member

@RemDelaporteMathurin RemDelaporteMathurin commented Sep 13, 2021

Proposed changes

Linked to #81.

This PR allows user to define the workplane from a cadquery.Plane object, which is defined by an origin point and a normal vector.

This normal vector is then the extrusion vector.

Usage

import paramak
from cadquery import Plane


points = [
    (0, 0),
    (1, 0),
    (1, 1),
    (0, 1)
]

# normal shape
shape_1 = paramak.ExtrudeStraightShape(points=points, distance=1)

# shape with vector-defined workplane
normal_vec = (1, 1, 1)
workplane = Plane(origin=(0, 0, 0), xDir=(-1, 1, 0), normal=normal_vec)
# in future releases of CQ, origin and xDir will be optional

shape_2 = paramak.ExtrudeStraightShape(
    points=points, distance=1,
    workplane=workplane,
    rotation_axis='X')

# export shapes
shape_1.export_stl('non_rotated.stl')  # white
shape_2.export_stl('rotated.stl')  # red

image

Types of changes

What types of changes does your code introduce to the Paramak?
Put an x in the boxes that apply

  • 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.

  • Pep8 applied
  • Unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@RemDelaporteMathurin RemDelaporteMathurin marked this pull request as draft September 13, 2021 14:16
@codecov
Copy link

codecov bot commented Sep 13, 2021

Codecov Report

Merging #84 (6735cc1) into develop (3e24fcf) will decrease coverage by 0.30%.
The diff coverage is 75.00%.

❗ Current head 6735cc1 differs from pull request most recent head 57dcc26. Consider uploading reports for the commit 57dcc26 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #84      +/-   ##
===========================================
- Coverage    98.17%   97.86%   -0.31%     
===========================================
  Files           76       75       -1     
  Lines         4873     4875       +2     
===========================================
- Hits          4784     4771      -13     
- Misses          89      104      +15     
Impacted Files Coverage Δ
paramak/shape.py 96.17% <75.00%> (-0.99%) ⬇️
paramak/reactor.py 91.97% <0.00%> (-1.88%) ⬇️
paramak/__init__.py 100.00% <0.00%> (ø)
paramak/parametric_reactors/cylinder_reactor.py

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 3e24fcf...57dcc26. Read the comment docs.

@RemDelaporteMathurin RemDelaporteMathurin marked this pull request as ready for review September 13, 2021 14:34
@shimwell
Copy link
Member

It looks like jupyter cadquery is trying to jsonify a NaN value and the json encoder is failing

@shimwell
Copy link
Member

I've rebuilt the dockerimage that the tests run on and rerun the tests. Looks like this PR is now working. There must have been a problem with the dockerimage contents that appears to have been fixed now.

Copy link

@gonuke gonuke left a comment

Choose a reason for hiding this comment

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

This is precisely what I was requesting; thanks @RemDelaporteMathurin !

@shimwell
Copy link
Member

Super, I guess we just need to change the docstring a bit and add a test if that is ok. I can do these if that helps

@shimwell shimwell merged commit 152a3d5 into develop Sep 18, 2021
@shimwell
Copy link
Member

Thanks for another nice feature @RemDelaporteMathurin

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.

Allow user to define a vector for the extrusion direction
3 participants