waterfall-cad 0.2.2.0 → 0.2.2.1
raw patch · 3 files changed
+49/−14 lines, 3 filesdep ~opencascade-hsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: opencascade-hs
API changes (from Hackage documentation)
- Waterfall.IO: instance GHC.Exception.Type.Exception Waterfall.IO.WaterfallIOException
- Waterfall.IO: instance GHC.Show.Show Waterfall.IO.WaterfallIOException
- Waterfall.IO: instance GHC.Show.Show Waterfall.IO.WaterfallIOExceptionCause
- Waterfall.Internal.Path: instance GHC.Base.Monoid Waterfall.Internal.Path.Path
- Waterfall.Internal.Path: instance GHC.Base.Semigroup Waterfall.Internal.Path.Path
- Waterfall.Internal.Solid: instance GHC.Base.Monoid Waterfall.Internal.Solid.Solid
- Waterfall.Internal.Solid: instance GHC.Base.Semigroup Waterfall.Internal.Solid.Solid
- Waterfall.TwoD.Internal.Path2D: instance GHC.Base.Monoid Waterfall.TwoD.Internal.Path2D.Path2D
- Waterfall.TwoD.Internal.Path2D: instance GHC.Base.Semigroup Waterfall.TwoD.Internal.Path2D.Path2D
- Waterfall.TwoD.Path2D: instance GHC.Show.Show Waterfall.TwoD.Path2D.Sense
+ Waterfall.IO: instance GHC.Internal.Exception.Type.Exception Waterfall.IO.WaterfallIOException
+ Waterfall.IO: instance GHC.Internal.Show.Show Waterfall.IO.WaterfallIOException
+ Waterfall.IO: instance GHC.Internal.Show.Show Waterfall.IO.WaterfallIOExceptionCause
+ Waterfall.Internal.Path: instance GHC.Internal.Base.Monoid Waterfall.Internal.Path.Path
+ Waterfall.Internal.Path: instance GHC.Internal.Base.Semigroup Waterfall.Internal.Path.Path
+ Waterfall.Internal.Solid: instance GHC.Internal.Base.Monoid Waterfall.Internal.Solid.Solid
+ Waterfall.Internal.Solid: instance GHC.Internal.Base.Semigroup Waterfall.Internal.Solid.Solid
+ Waterfall.TwoD.Internal.Path2D: instance GHC.Internal.Base.Monoid Waterfall.TwoD.Internal.Path2D.Path2D
+ Waterfall.TwoD.Internal.Path2D: instance GHC.Internal.Base.Semigroup Waterfall.TwoD.Internal.Path2D.Path2D
+ Waterfall.TwoD.Path2D: instance GHC.Internal.Show.Show Waterfall.TwoD.Path2D.Sense
Files
- CHANGELOG.md +6/−0
- src/Waterfall/Internal/Remesh.hs +41/−12
- waterfall-cad.cabal +2/−2
CHANGELOG.md view
@@ -9,6 +9,12 @@ ## Unreleased +## 0.2.2.1++### Fixed++- Importing files that contain multiple separate solids should no longer error+ ## 0.2.2.0 ### Added
src/Waterfall/Internal/Remesh.hs view
@@ -55,6 +55,35 @@ then Nothing else Just shape +makeSolidFromShell :: Ptr TopoDS.Shape -> Acquire (Maybe (Ptr TopoDS.Solid))+makeSolidFromShell shape = do+ t <- liftIO $ TopoDS.Shape.shapeType shape+ case t of + ShapeEnum.Shell -> do+ makeSolid <- BRepBuilderAPI.MakeSolid.new + shapeAsShell <- liftIO $ unsafeDowncast shape+ liftIO $ BRepBuilderAPI.MakeSolid.add makeSolid shapeAsShell+ shapeAsSolid <- BRepBuilderAPI.MakeSolid.solid makeSolid+ return $ Just shapeAsSolid+ ShapeEnum.Compound -> do+ makeSolid <- BRepBuilderAPI.MakeSolid.new + explorer <- TopExp.Explorer.new shape ShapeEnum.Shell+ let actionForEachShell :: Acquire ()+ actionForEachShell = do+ shellAsShape <- liftIO $ TopExp.Explorer.value explorer+ shapeAsShell <- liftIO $ unsafeDowncast shellAsShape+ liftIO $ BRepBuilderAPI.MakeSolid.add makeSolid shapeAsShell+ let go = do+ isMore <- liftIO $ TopExp.Explorer.more explorer+ when isMore $ do + actionForEachShell+ liftIO $ TopExp.Explorer.next explorer+ go+ go+ shapeAsSolid <- BRepBuilderAPI.MakeSolid.solid makeSolid+ return $ Just shapeAsSolid+ _ -> pure Nothing+ remesh :: Ptr TopoDS.Shape -> Acquire (Maybe (Ptr TopoDS.Shape)) remesh s = do @@ -110,18 +139,18 @@ liftIO $ BRepBuilderAPI.Sewing.load sewing (upcast compound) liftIO . BRepBuilderAPI.Sewing.perform $ sewing shape <- BRepBuilderAPI.Sewing.sewedShape sewing- makeSolid <- BRepBuilderAPI.MakeSolid.new - shapeAsShell <- liftIO $ unsafeDowncast shape- liftIO $ BRepBuilderAPI.MakeSolid.add makeSolid shapeAsShell- shapeAsSolid <- BRepBuilderAPI.MakeSolid.solid makeSolid- maybeNotNull <- checkNonNull (upcast shapeAsSolid)- case maybeNotNull of- Nothing -> return Nothing- Just _ -> do - orientable <- liftIO $ BRepLib.orientClosedSolid (shapeAsSolid)- if orientable - then return . Just . upcast $ shapeAsSolid- else return Nothing+ maybeShapeAsSolid <- makeSolidFromShell shape+ case maybeShapeAsSolid of+ Nothing -> pure Nothing+ Just shapeAsSolid -> do+ maybeNotNull <- checkNonNull (upcast shapeAsSolid)+ case maybeNotNull of+ Nothing -> return Nothing+ Just _ -> do + orientable <- liftIO $ BRepLib.orientClosedSolid (shapeAsSolid)+ if orientable + then return . Just . upcast $ shapeAsSolid+ else return Nothing
waterfall-cad.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: waterfall-cad-version: 0.2.2.0+version: 0.2.2.1 synopsis: Declarative CAD/Solid Modeling Library description: Please see the README on GitHub at <https://github.com/joe-warren/opencascade-hs#readme> category: Graphics@@ -65,7 +65,7 @@ , lattices >=2.0 && <3 , lens ==5.* , linear >=1.21 && <2- , opencascade-hs >=0.2.2.0 && <0.3+ , opencascade-hs >=0.2.2.1 && <0.3 , primitive >=0.7 && <0.10 , resourcet >=1.2 && <1.4 default-language: Haskell2010