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

Non normal extrusion #83

Closed
wants to merge 7 commits into from
Closed

Conversation

RemDelaporteMathurin
Copy link
Member

@RemDelaporteMathurin RemDelaporteMathurin commented Sep 13, 2021

Proposed changes

This PR fixes #81. Thanks @gonuke for suggesting this feature!

Users can now provide an extrusion direction (via a vector) for all the Extrude shapes (ExtrudeMixedShape, ExtrudeStraightShape, ExtrudeCircleShape, ExtrudeSplineShape).

The norm of the vector will be ignored since its normalised internally.

Usage

from paramak import ExtrudeMixedShape

my_shape = ExtrudeMixedShape(
        points=[
            (50, 0, "straight"),
            (50, 50, "spline"),
            (60, 70, "spline"),
            (70, 50, "circle"),
            (60, 25, "circle"),
            (70, 0, "straight")
        ],
        distance=50,
        extrusion_vector=(1, 1, 1)
)

Produces:
image

Default behaviour:
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)

@codecov
Copy link

codecov bot commented Sep 13, 2021

Codecov Report

Merging #83 (b84d952) into develop (80b723a) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop      #83   +/-   ##
========================================
  Coverage    97.90%   97.91%           
========================================
  Files           75       75           
  Lines         4871     4886   +15     
========================================
+ Hits          4769     4784   +15     
  Misses         102      102           
Impacted Files Coverage Δ
paramak/parametric_shapes/extruded_mixed_shape.py 100.00% <100.00%> (ø)

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 80b723a...b84d952. Read the comment docs.

@RemDelaporteMathurin
Copy link
Member Author

@shimwell I think this is ready for review. Don't really get why RTD is failing though

@gonuke is this what you had in mind?

@RemDelaporteMathurin RemDelaporteMathurin linked an issue Sep 13, 2021 that may be closed by this pull request
@shimwell
Copy link
Member

Looks like the RTD failed due to "Command killed due to excessive memory consumption" which can happen when several are building at the same time. I've relaunched the build

@gonuke
Copy link

gonuke commented Sep 13, 2021

Thanks @RemDelaporteMathurin !

I'll take a look, but from a first skim, it's not obvious whether or not the 2-D shape is formed on a plane normal to the extrusion vector, or if it is formed on the workplane and extruded in a direction that is not parallel to that normal?

@gonuke
Copy link

gonuke commented Sep 13, 2021

I'm going to tag @connoramoreno to take a look, as well

@RemDelaporteMathurin
Copy link
Member Author

I'll take a look, but from a first skim, it's not obvious whether or not the 2-D shape is formed on a plane normal to the extrusion vector, or if it is formed on the workplane and extruded in a direction that is not parallel to that normal?

The 2D shape is formed on the workplane, and then extruded in the given direction (which is not necessarily normal to the workplane).
But maybe I misunderstood your request.

@connoramoreno
Copy link

Without actually testing it myself, it sounds like it's not quite what we were thinking. What we had in mind is to have the 2D shape normal to the extrusion vector (essentially a rotation of of the shape from the workplane normal to the extrusion vector). This can be done via a rotation axis and azimuthal placement angle now, but is somewhat cumbersome and requires some math to be done by the user. Although, this seems like a useful feature as well.

@RemDelaporteMathurin
Copy link
Member Author

Without actually testing it myself, it sounds like it's not quite what we were thinking. What we had in mind is to have the 2D shape normal to the extrusion vector (essentially a rotation of of the shape from the workplane normal to the extrusion vector). This can be done via a rotation axis and azimuthal placement angle now, but is somewhat cumbersome and requires some math to be done by the user. Although, this seems like a useful feature as well.

Yes I think I understand now what you were looking for.
Indeed, this can be achieved by rotating the solid a posteriori but is tedious due to the maths involved.

Instead, it is more straightforward to create a workplane that is correctly oriented and then extrude the 2D shape in the normal direction.

I implemented this in PR #84. This is not merged yet because of some compatibility issues with jupyter-cadquery.

However, using the branch workplane_accepts_cq_plane should do the trick.

@shimwell
Copy link
Member

What do you think, is this PR still needed now that #84 has been merged

@RemDelaporteMathurin
Copy link
Member Author

@shimwell I think this can be closed since I don't see yet how this feature could be useful. It isn't too complicated to re-implement should we ever need it in the future

@shimwell shimwell closed this Sep 19, 2021
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
4 participants