Commit Graph

379 Commits

Author SHA1 Message Date
015d8b33ae Fix spelling mistakes and typos. 2021-08-25 23:38:52 +01:00
93623fa9bd #788 Add __repr__ and __str__ methods to Matrix (#791)
* #788 Add __repr__ and __str__ methods to Matrix

* Shortened code with join & improved test

* Renamed variable and fixed use of join

* Replaced __getitem__ with transposed_list

* Optimized repr and removed str methods

* Cleanup comment

* Increased geom.py code coverage to near 100%

* Reformatted with black 19.10b0 defaults

* Remove the typing import
2021-08-12 20:38:06 +02:00
9e481b41a1 Typo fixes
Found via `codespell -q 3 -S *.js -L ba`
2021-07-30 13:48:22 -04:00
7afbb37f6e Mixin3D.shell: allow faceList=None 2021-07-29 14:34:23 +09:30
6a440b63af Handle constraints from infinite faces (#797)
* Face.toPln method added

* solver: set xtol_abs

* Constraint: handle infinite faces

Infinite faces have their center at 1e99, which was causing overflows in
the solver and also was not what the user intended when creating the
Shape. They are now converted to the expected values.
2021-07-06 16:47:36 +09:30
AU
3cb72378b8 Assy solver fix (#806)
* Use nlopt in place of scipy.optimize 

* report the results of optimization

* Deps update and OCP 7.5 -> 7.5.1

* Rewrite cost and gradient

* Check solve results
2021-07-03 13:29:10 +09:30
e00ac83f98 Implement importBrep and vtkPolyData export (#735)
* Implement importBrep

* Implement rw to/from stream

* Implement toVtkPolyData

* Implemented VTP export

* Added normals calculation

* use VTK for rendering in jupyter

* Added orientation marker

* Assy rendering in notebooks

* Implement export to vtkjs

* Store the env in the cqgi result

* VTK-based cq directive

* Support show_object and assy

* assy vrml export via vtk

* Use vtk in the docs

* Add slot dxf file

* Add vtk.js to the static files

* Use single renderer

* Ignore cq_directive code coverage

* Ignore missing docutils stubs

* Implement select

* Disable interaction dynamically

* Mention VTP in the docs

* Add path to the test reqs
2021-06-22 17:36:50 +09:30
7b1a99ca8a Workplane.rect: test and document negative lengths (#774) 2021-06-01 18:36:57 +02:00
7493e6129b Convert int text sizes to floats (#764)
Avoids a segfault when using integer text sizes. Also adds a test for
integer text size.
2021-05-13 20:57:30 +02:00
0f249dfec8 Assembly toCompound (#726)
* Added Assembly.toCompound

* spelling

Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>

* Add annotation + minor updates

* Better annotations for locate and move

Co-authored-by: Jeremy Wright <wrightjmf@gmail.com>
Co-authored-by: Adam Urbańczyk <adam-urbanczyk@users.noreply.github.com>
2021-04-19 19:50:31 +02:00
b0a8cb247b PointInPlane constraint (#712)
* Allow Plane init with no specific x dir and add Plane.toPln

* PointInPlane constraint
2021-04-13 17:12:14 +09:30
39e60f6e48 Check if wires are coplanar 2021-04-03 13:54:31 +10:30
7546866159 Merge pull request #694 from CadQuery/splineApprox
Implement makeSplineApprox for edges and faces
2021-03-31 15:06:41 -04:00
7a259bed61 Typos 2021-03-31 19:21:47 +02:00
8e23195a34 Implement close for wires 2021-03-31 19:17:20 +02:00
179b964514 Update tests/test_assembly.py
Co-authored-by: Marcus Boyd <mwb@geosol.com.au>
2021-03-29 08:08:28 +02:00
2c8a8520ee added tests for Shape.split 2021-03-29 10:45:18 +10:30
6615c2a495 black fix 2021-03-29 09:29:01 +10:30
7fe44b02c7 Test Edge.close 2021-03-29 07:02:49 +10:30
55ba8ca5eb Test Workplane.split error when no side kept 2021-03-29 07:00:43 +10:30
82136e4ee7 Another black fix 2021-03-28 12:48:35 +02:00
58a61812c6 Black fix 2021-03-28 12:22:33 +02:00
c72f0838e0 Check if complex selectors works with assy 2021-03-28 12:07:08 +02:00
64b7048ee1 Rework Workplane.split to support arbitrary shapes 2021-03-25 18:19:36 +01:00
c0aaa485f7 Implement Workplane.splineApprox 2021-03-23 18:37:02 +01:00
e82c7c3a9f Implement Edge.close 2021-03-23 08:42:04 +01:00
68dba0ad89 Extend coverage 2021-03-22 19:36:23 +01:00
1d3fc576cb typo fix 2021-03-21 20:34:51 +01:00
8c15d18514 Implement parametricSurface 2021-03-21 18:44:31 +01:00
50bada403f Added tests for Face.makeSplineApprox 2021-03-19 22:32:38 +01:00
54831144a2 test for makeSplineApprox 2021-03-18 19:50:05 +01:00
d5ce1321ca Added AreaNthSelector (#688)
* Added AreaNthSelector

Added AreaNthSelector that is useful for nested features selection. Especially to select one of coplanar nested wires for subsequent extrusion, cutting or filleting.

* LengthNthSelector

* Explicitly marked _NthSelector class and _NthSelector.key(..) method as abstract using standard abc package

* AreaNthSelector ignores "bad" Wires

AreaNthSelector.key raises ValueError if temporary face creation fails for a wire for any reason (non-planar, non-closed). That causes _NthSelector that it inherits to ignore such wires. Done so for consistency with RadiusNthSelector that ignores anything it can not get radius from.

Co-authored-by: Marcus Boyd <mwb@geosol.com.au>
2021-03-17 14:14:37 +10:30
a54de640ff Improve Inheriting Workplane Fluent Methods (#677)
* Return Instances of the Type of self from Fluent Methods

* Updated `Workplane.workplane()`, `Workplane.copyWorkplane()`, `Workplane.newObject()` to return instances of a type that's based on the input parameters (such as `self`).
* Updated type hints to reflect that return types of fluent methods depend on the type of method arguments.
* Added a unit test to verify fluent methods in a derived class return instances of the derived class.

* Fix Workpane MyPy Errors

* Fixed type hints in `sweep()` and `_selectObjects()`.

* Fix `test_cadquery.py` Formatting

* Ran `black` on `test_cadquery.py`.

* Renamed `TypeVar` `WorkplaneT` to `T`

* Renamed `WorkplaneT` to `T` in `cq.py`.

* Reformat with Black

* Re-formatted `cq.py` with `black`.

* Re-format with the Right Version of Black (19.10b0)

* Re-formatted `cq.py` with `black` 19.10b0.
2021-03-12 07:34:54 +01:00
5542816447 2D fillet chamfer (#683)
* Implement 2D chamfers and fillets

* Implement 2D chamfer/fillet tests

Co-authored-by: Marcus Boyd <mwb@geosol.com.au>
2021-03-12 07:05:56 +10:30
d7e7812c4c Merge branch 'master' into getPending 2021-03-10 08:54:27 +01:00
48deb19b68 Initial implementation of CompSolid 2021-03-10 13:14:38 +10:30
7be6070534 Use popPending methods 2021-03-08 14:22:47 +10:30
b316461b49 Added popPendingEdges and popPendingWires to CQ Context
Also tests
2021-03-08 14:17:47 +10:30
0325474f72 findSolid errors (#655)
* findSolid returns None when no solids found

Removed a line in the findSolid docstring about raising an error if no
solids found. Added exceptions to several methods that were previously
failing with AttributeErrors when they tried to treat the None object as
a solid.

* findSolid needed type hint Optional on it's return value

* Type hint and test Workplane.findFace

* Rewrite to raise ValueError in findSolid

* I forgot about findFace again

* add exceptions to docstrings
2021-03-03 21:03:19 +01:00
0885b198b1 Merge branch 'master' into 7.5 2021-02-26 23:05:02 +01:00
606eb2773e offset2D for construction (#639)
* Added forConstruction option to Workplane.offset2D

* Added Workplane.offset2D example

Co-authored-by: Adam Urbańczyk <adam-urbanczyk@users.noreply.github.com>
2021-02-19 10:49:09 +10:30
3505fc2ff6 Merge pull request #636 from pavpen/spline-tangents-parameters-tolerance
Add Support for Specifying Arbitrary Tangents, etc. in spline()
2021-02-18 20:57:35 +10:30
8d2c0b90c2 Black 19.10 fix 2021-02-18 11:02:55 +10:30
ff0b123889 Test periodic splines with parameters 2021-02-18 10:38:49 +10:30
6f5f0cc984 Validate Edge.makeSpline parameters for periodic splines 2021-02-18 10:38:36 +10:30
b5e4aa940f Validate Edge.makeSpline parameters input 2021-02-18 07:20:40 +10:30
9efe66c482 Fix Unit Test after Rename of spline() Parameter tolerance to tol
* Fixed the `testSplineTangentMagnitudeBelowToleranceThrows` unit test. It was failing since `spline()`'s parameter `tolerance` seems to have been renamed to `tol`.
2021-02-17 14:02:27 -05:00
bec5036d34 Additional test for spline 2021-02-17 18:04:29 +01:00
172ae85c01 Put Spline scale Parameter Tests Cases Together
* Moved the tests cases, so they're next to each other.
* Added a comment about the relationship between the two test cases.
2021-02-17 06:06:34 -05:00
0dcccc351d tangentAt fix (#641)
* tangentAt fix

* Better testTangengAt

* Change default to length

* tests fix
2021-02-15 21:18:09 +01:00