├── .gitignore ├── LICENSE ├── README.md ├── Setup.hs ├── cabal.project ├── images ├── 2d-booleans.svg ├── bounding-boxes.svg ├── bounding_boxes.png ├── csg.png ├── csg.svg ├── fillet.png ├── fonts │ └── varela │ │ ├── OFL.txt │ │ └── VarelaRound-Regular.ttf ├── gear.png ├── gear.svg ├── loft.png ├── loft.svg ├── logo │ ├── opencascade-hs-logo-name.svg │ ├── repository-open-graph-image.png │ ├── waterfall-cad-logo-bw.svg │ ├── waterfall-cad-logo-name.svg │ ├── waterfall-cad-logo-square.svg │ └── waterfall-cad-logo.svg ├── models │ ├── 2d-booleans.glb │ ├── bounding-boxes.glb │ ├── csg.glb │ ├── fillet.glb │ ├── gear.glb │ ├── loft.glb │ ├── offset.glb │ ├── prism.glb │ ├── revolution.glb │ ├── studio_small_03_1k.hdr │ ├── sweep.glb │ └── text.glb ├── offset.png ├── offset.svg ├── prism.png ├── revolution.png ├── revolution.svg ├── sweep.png ├── sweep.svg ├── text.png └── text.svg ├── opencascade-hs ├── CHANGELOG.md ├── LICENSE ├── README.md ├── cpp │ ├── hs_BOPAlgo_BOP.cpp │ ├── hs_BOPAlgo_BOP.h │ ├── hs_BOPAlgo_Builder.cpp │ ├── hs_BOPAlgo_Builder.h │ ├── hs_BRepAdaptor_Curve.cpp │ ├── hs_BRepAdaptor_Curve.h │ ├── hs_BRepAlgoAPI_Common.cpp │ ├── hs_BRepAlgoAPI_Common.h │ ├── hs_BRepAlgoAPI_Cut.cpp │ ├── hs_BRepAlgoAPI_Cut.h │ ├── hs_BRepAlgoAPI_Fuse.cpp │ ├── hs_BRepAlgoAPI_Fuse.h │ ├── hs_BRepBndLib.cpp │ ├── hs_BRepBndLib.h │ ├── hs_BRepBuilderAPI_Copy.cpp │ ├── hs_BRepBuilderAPI_Copy.h │ ├── hs_BRepBuilderAPI_GTransform.cpp │ ├── hs_BRepBuilderAPI_GTransform.h │ ├── hs_BRepBuilderAPI_MakeEdge.cpp │ ├── hs_BRepBuilderAPI_MakeEdge.h │ ├── hs_BRepBuilderAPI_MakeFace.cpp │ ├── hs_BRepBuilderAPI_MakeFace.h │ ├── hs_BRepBuilderAPI_MakePolygon.cpp │ ├── hs_BRepBuilderAPI_MakePolygon.h │ ├── hs_BRepBuilderAPI_MakeShape.cpp │ ├── hs_BRepBuilderAPI_MakeShape.h │ ├── hs_BRepBuilderAPI_MakeSolid.cpp │ ├── hs_BRepBuilderAPI_MakeSolid.h │ ├── hs_BRepBuilderAPI_MakeVertex.cpp │ ├── hs_BRepBuilderAPI_MakeVertex.h │ ├── hs_BRepBuilderAPI_MakeWire.cpp │ ├── hs_BRepBuilderAPI_MakeWire.h │ ├── hs_BRepBuilderAPI_Sewing.cpp │ ├── hs_BRepBuilderAPI_Sewing.h │ ├── hs_BRepBuilderAPI_Transform.cpp │ ├── hs_BRepBuilderAPI_Transform.h │ ├── hs_BRepFilletAPI_MakeChamfer.cpp │ ├── hs_BRepFilletAPI_MakeChamfer.h │ ├── hs_BRepFilletAPI_MakeFillet.cpp │ ├── hs_BRepFilletAPI_MakeFillet.h │ ├── hs_BRepGProp.cpp │ ├── hs_BRepGProp.h │ ├── hs_BRepLib.cpp │ ├── hs_BRepLib.h │ ├── hs_BRepMesh_IncrementalMesh.cpp │ ├── hs_BRepMesh_IncrementalMesh.h │ ├── hs_BRepOffsetAPI_MakeOffsetShape.cpp │ ├── hs_BRepOffsetAPI_MakeOffsetShape.h │ ├── hs_BRepOffsetAPI_MakePipe.cpp │ ├── hs_BRepOffsetAPI_MakePipe.h │ ├── hs_BRepOffsetAPI_ThruSections.cpp │ ├── hs_BRepOffsetAPI_ThruSections.h │ ├── hs_BRepPrimAPI_MakeBox.cpp │ ├── hs_BRepPrimAPI_MakeBox.h │ ├── hs_BRepPrimAPI_MakeCone.cpp │ ├── hs_BRepPrimAPI_MakeCone.h │ ├── hs_BRepPrimAPI_MakeCylinder.cpp │ ├── hs_BRepPrimAPI_MakeCylinder.h │ ├── hs_BRepPrimAPI_MakePrism.cpp │ ├── hs_BRepPrimAPI_MakePrism.h │ ├── hs_BRepPrimAPI_MakeRevol.cpp │ ├── hs_BRepPrimAPI_MakeRevol.h │ ├── hs_BRepPrimAPI_MakeSphere.cpp │ ├── hs_BRepPrimAPI_MakeSphere.h │ ├── hs_BRepTools_WireExplorer.cpp │ ├── hs_BRepTools_WireExplorer.h │ ├── hs_BRep_Tool.cpp │ ├── hs_BRep_Tool.h │ ├── hs_Bnd_Box.cpp │ ├── hs_Bnd_Box.h │ ├── hs_Bnd_OBB.cpp │ ├── hs_Bnd_OBB.h │ ├── hs_Font_BRepFont.cpp │ ├── hs_Font_BRepFont.h │ ├── hs_Font_BRepTextBuilder.cpp │ ├── hs_Font_BRepTextBuilder.h │ ├── hs_GC_MakeArcOfCircle.cpp │ ├── hs_GC_MakeArcOfCircle.h │ ├── hs_GC_MakeSegment.cpp │ ├── hs_GC_MakeSegment.h │ ├── hs_GProp_GProps.cpp │ ├── hs_GProp_GProps.h │ ├── hs_GeomAdaptor_Curve.cpp │ ├── hs_GeomAdaptor_Curve.h │ ├── hs_GeomConvert_ApproxCurve.cpp │ ├── hs_GeomConvert_ApproxCurve.h │ ├── hs_GeomConvert_BSplineCurveToBezierCurve.cpp │ ├── hs_GeomConvert_BSplineCurveToBezierCurve.h │ ├── hs_Geom_BSplineCurve.cpp │ ├── hs_Geom_BSplineCurve.h │ ├── hs_Geom_BezierCurve.cpp │ ├── hs_Geom_BezierCurve.h │ ├── hs_Geom_Curve.cpp │ ├── hs_Geom_Curve.h │ ├── hs_Geom_TrimmedCurve.cpp │ ├── hs_Geom_TrimmedCurve.h │ ├── hs_HLRAlgo_Projector.cpp │ ├── hs_HLRAlgo_Projector.h │ ├── hs_HLRBRep_Algo.cpp │ ├── hs_HLRBRep_Algo.h │ ├── hs_HLRBRep_HLRToShape.cpp │ ├── hs_HLRBRep_HLRToShape.h │ ├── hs_Message_ProgressRange.cpp │ ├── hs_Message_ProgressRange.h │ ├── hs_NCollection_Array1.cpp │ ├── hs_NCollection_Array1.h │ ├── hs_Poly_Triangle.cpp │ ├── hs_Poly_Triangle.h │ ├── hs_Poly_Triangulation.cpp │ ├── hs_Poly_Triangulation.h │ ├── hs_RWGltf_CafReader.cpp │ ├── hs_RWGltf_CafReader.h │ ├── hs_RWGltf_CafWriter.cpp │ ├── hs_RWGltf_CafWriter.h │ ├── hs_RWMesh_CafReader.cpp │ ├── hs_RWMesh_CafReader.h │ ├── hs_RWObj_CafReader.cpp │ ├── hs_RWObj_CafReader.h │ ├── hs_RWObj_CafWriter.cpp │ ├── hs_RWObj_CafWriter.h │ ├── hs_STEPControl_Reader.cpp │ ├── hs_STEPControl_Reader.h │ ├── hs_STEPControl_Writer.cpp │ ├── hs_STEPControl_Writer.h │ ├── hs_ShapeConstruct_Curve.cpp │ ├── hs_ShapeConstruct_Curve.h │ ├── hs_ShapeExtend_WireData.cpp │ ├── hs_ShapeExtend_WireData.h │ ├── hs_ShapeFix_Solid.cpp │ ├── hs_ShapeFix_Solid.h │ ├── hs_StlAPI_Reader.cpp │ ├── hs_StlAPI_Reader.h │ ├── hs_StlAPI_Writer.cpp │ ├── hs_StlAPI_Writer.h │ ├── hs_TColStd_IndexedDataMapOfStringString.cpp │ ├── hs_TColStd_IndexedDataMapOfStringString.h │ ├── hs_TDF_Label.cpp │ ├── hs_TDF_Label.h │ ├── hs_TDocStd_Document.cpp │ ├── hs_TDocStd_Document.h │ ├── hs_TopExp_Explorer.cpp │ ├── hs_TopExp_Explorer.h │ ├── hs_TopLoc_Location.cpp │ ├── hs_TopLoc_Location.h │ ├── hs_TopTools_ShapeMapHasher.cpp │ ├── hs_TopTools_ShapeMapHasher.h │ ├── hs_TopoDS_Builder.cpp │ ├── hs_TopoDS_Builder.h │ ├── hs_TopoDS_CompSolid.cpp │ ├── hs_TopoDS_CompSolid.h │ ├── hs_TopoDS_Compound.cpp │ ├── hs_TopoDS_Compound.h │ ├── hs_TopoDS_Edge.cpp │ ├── hs_TopoDS_Edge.h │ ├── hs_TopoDS_Face.cpp │ ├── hs_TopoDS_Face.h │ ├── hs_TopoDS_Shape.cpp │ ├── hs_TopoDS_Shape.h │ ├── hs_TopoDS_Shell.cpp │ ├── hs_TopoDS_Shell.h │ ├── hs_TopoDS_Solid.cpp │ ├── hs_TopoDS_Solid.h │ ├── hs_TopoDS_Vertex.cpp │ ├── hs_TopoDS_Vertex.h │ ├── hs_TopoDS_Wire.cpp │ ├── hs_TopoDS_Wire.h │ ├── hs_XCAFDoc_DocumentTool.cpp │ ├── hs_XCAFDoc_DocumentTool.h │ ├── hs_XCAFDoc_ShapeTool.cpp │ ├── hs_XCAFDoc_ShapeTool.h │ ├── hs_XSControl_Reader.cpp │ ├── hs_XSControl_Reader.h │ ├── hs_gp.cpp │ ├── hs_gp.h │ ├── hs_gp_Ax1.cpp │ ├── hs_gp_Ax1.h │ ├── hs_gp_Ax2.cpp │ ├── hs_gp_Ax2.h │ ├── hs_gp_Ax2d.cpp │ ├── hs_gp_Ax2d.h │ ├── hs_gp_Ax3.cpp │ ├── hs_gp_Ax3.h │ ├── hs_gp_Dir.cpp │ ├── hs_gp_Dir.h │ ├── hs_gp_Dir2d.cpp │ ├── hs_gp_Dir2d.h │ ├── hs_gp_GTrsf.cpp │ ├── hs_gp_GTrsf.h │ ├── hs_gp_Pnt.cpp │ ├── hs_gp_Pnt.h │ ├── hs_gp_Pnt2d.cpp │ ├── hs_gp_Pnt2d.h │ ├── hs_gp_Trsf.cpp │ ├── hs_gp_Trsf.h │ ├── hs_gp_Trsf2d.cpp │ ├── hs_gp_Trsf2d.h │ ├── hs_gp_Vec.cpp │ ├── hs_gp_Vec.h │ ├── hs_gp_Vec2d.cpp │ ├── hs_gp_Vec2d.h │ ├── hs_gp_XYZ.cpp │ ├── hs_gp_XYZ.h │ └── hs_types.h ├── opencascade-hs.cabal ├── package.yaml └── src │ └── OpenCascade │ ├── BOPAlgo │ ├── BOP.hs │ ├── Builder.hs │ ├── Internal │ │ └── Destructors.hs │ ├── Operation.hs │ └── Types.hs │ ├── BRep │ └── Tool.hs │ ├── BRepAdaptor.hs │ ├── BRepAdaptor │ ├── Curve.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── BRepAlgoAPI │ ├── Common.hs │ ├── Cut.hs │ └── Fuse.hs │ ├── BRepBndLib.hs │ ├── BRepBuilderAPI.hs │ ├── BRepBuilderAPI │ ├── Copy.hs │ ├── FaceError.hs │ ├── GTransform.hs │ ├── Internal │ │ └── Destructors.hs │ ├── MakeEdge.hs │ ├── MakeFace.hs │ ├── MakePolygon.hs │ ├── MakeShape.hs │ ├── MakeSolid.hs │ ├── MakeVertex.hs │ ├── MakeWire.hs │ ├── Sewing.hs │ ├── Transform.hs │ ├── Types.hs │ └── WireError.hs │ ├── BRepFilletAPI.hs │ ├── BRepFilletAPI │ ├── Internal │ │ └── Destructors.hs │ ├── MakeChamfer.hs │ ├── MakeFillet.hs │ └── Types.hs │ ├── BRepGProp.hs │ ├── BRepLib.hs │ ├── BRepMesh.hs │ ├── BRepMesh │ ├── IncrementalMesh.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── BRepOffset │ └── Mode.hs │ ├── BRepOffsetAPI.hs │ ├── BRepOffsetAPI │ ├── Internal │ │ └── Destructors.hs │ ├── MakeOffsetShape.hs │ ├── MakePipe.hs │ ├── ThruSections.hs │ └── Types.hs │ ├── BRepPrimAPI.hs │ ├── BRepPrimAPI │ ├── Internal │ │ └── Destructors.hs │ ├── MakeBox.hs │ ├── MakeCone.hs │ ├── MakeCylinder.hs │ ├── MakePrism.hs │ ├── MakeRevol.hs │ ├── MakeSphere.hs │ └── Types.hs │ ├── BRepTools.hs │ ├── BRepTools │ ├── Internal │ │ └── Destructors.hs │ ├── Types.hs │ └── WireExplorer.hs │ ├── Bnd │ ├── Box.hs │ ├── Internal │ │ └── Destructors.hs │ ├── OBB.hs │ └── Types.hs │ ├── Font │ ├── BRepFont.hs │ ├── BRepTextBuilder.hs │ ├── FontAspect.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── GC │ ├── MakeArcOfCircle.hs │ └── MakeSegment.hs │ ├── GP.hs │ ├── GP │ ├── Ax1.hs │ ├── Ax2.hs │ ├── Ax2d.hs │ ├── Ax3.hs │ ├── Dir.hs │ ├── Dir2d.hs │ ├── GTrsf.hs │ ├── Internal │ │ └── Destructors.hs │ ├── Pnt.hs │ ├── Pnt2d.hs │ ├── Trsf.hs │ ├── Trsf2d.hs │ ├── Types.hs │ ├── Vec.hs │ ├── Vec2d.hs │ └── XYZ.hs │ ├── GProp │ ├── GProps.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── Geom.hs │ ├── Geom │ ├── BSplineCurve.hs │ ├── BezierCurve.hs │ ├── Curve.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── GeomAbs │ ├── CurveType.hs │ ├── JoinType.hs │ └── Shape.hs │ ├── GeomAdaptor │ ├── Curve.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── GeomConvert │ ├── ApproxCurve.hs │ ├── BSplineCurveToBezierCurve.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── GeomFill.hs │ ├── GeomFill │ └── Trihedron.hs │ ├── Graphic3D │ ├── HorizontalTextAlignment.hs │ └── VerticalTextAlignment.hs │ ├── HLRAlgo │ ├── Internal │ │ └── Destructors.hs │ ├── Projector.hs │ └── Types.hs │ ├── HLRBRep │ ├── Algo.hs │ ├── HLRToShape.hs │ ├── Internal │ │ └── Destructors.hs │ ├── TypeOfResultingEdge.hs │ └── Types.hs │ ├── Handle.hs │ ├── IFSelect │ └── ReturnStatus.hs │ ├── Inheritance.hs │ ├── Internal │ └── Bool.hs │ ├── Message │ ├── Internal │ │ └── Destructors.hs │ ├── ProgressRange.hs │ └── Types.hs │ ├── NCollection.hs │ ├── NCollection │ ├── Array1.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── Poly │ ├── Internal │ │ └── Destructors.hs │ ├── Triangle.hs │ ├── Triangulation.hs │ └── Types.hs │ ├── RWGltf │ ├── CafReader.hs │ ├── CafWriter.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── RWMesh │ ├── CafReader.hs │ └── Types.hs │ ├── RWObj │ ├── CafReader.hs │ ├── CafWriter.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── STEPControl.hs │ ├── STEPControl │ ├── Internal │ │ └── Destructors.hs │ ├── Reader.hs │ ├── StepModelType.hs │ ├── Types.hs │ └── Writer.hs │ ├── ShapeConstruct │ ├── Curve.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── ShapeExtend │ ├── Internal │ │ └── Destructors.hs │ ├── Status.hs │ ├── Types.hs │ └── WireData.hs │ ├── ShapeFix │ ├── Internal │ │ └── Destructors.hs │ ├── Solid.hs │ └── Types.hs │ ├── StlAPI.hs │ ├── StlAPI │ ├── Internal │ │ └── Destructors.hs │ ├── Reader.hs │ ├── Types.hs │ └── Writer.hs │ ├── TColStd │ ├── IndexedDataMapOfStringString.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── TDF │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── TDocStd │ ├── Document.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── TopAbs.hs │ ├── TopAbs │ ├── Orientation.hs │ └── ShapeEnum.hs │ ├── TopExp.hs │ ├── TopExp │ ├── Explorer.hs │ ├── Internal │ │ └── Destructors.hs │ └── Types.hs │ ├── TopLoc.hs │ ├── TopLoc │ ├── Internal │ │ └── Destructors.hs │ ├── Location.hs │ └── Types.hs │ ├── TopTools.hs │ ├── TopTools │ ├── ShapeMapHasher.hs │ └── Types.hs │ ├── TopoDS.hs │ ├── TopoDS │ ├── Builder.hs │ ├── CompSolid.hs │ ├── Compound.hs │ ├── Edge.hs │ ├── Face.hs │ ├── Internal │ │ └── Destructors.hs │ ├── Shape.hs │ ├── Shell.hs │ ├── Solid.hs │ ├── Types.hs │ ├── Vertex.hs │ └── Wire.hs │ ├── XCAFDoc │ ├── DocumentTool.hs │ ├── Internal │ │ └── Destructors.hs │ ├── ShapeTool.hs │ └── Types.hs │ └── XSControl │ ├── Reader.hs │ └── Types.hs ├── package-defaults.yaml ├── scripts ├── enrich-examples.hs ├── regenerate-images.sh └── releasing ├── stack.yaml ├── stack.yaml.lock ├── waterfall-cad-examples ├── CHANGELOG.md ├── LICENSE ├── README.md ├── app │ └── Main.hs ├── package.yaml ├── src │ ├── BoundingBoxExample.hs │ ├── CsgExample.hs │ ├── DarkModeSVG.hs │ ├── FilletExample.hs │ ├── GearExample.hs │ ├── LoftExample.hs │ ├── OffsetExample.hs │ ├── PrismExample.hs │ ├── ReadSolidExpressionExample.hs │ ├── RevolutionExample.hs │ ├── SVG │ │ ├── PathExample.hs │ │ └── ReadFileExample.hs │ ├── SweepExample.hs │ ├── TextExample.hs │ └── TwoDBooleansExample.hs └── waterfall-cad-examples.cabal ├── waterfall-cad-svg ├── CHANGELOG.md ├── LICENSE ├── README.md ├── Setup.hs ├── package.yaml ├── src │ └── Waterfall │ │ ├── SVG.hs │ │ └── SVG │ │ ├── FromSVG.hs │ │ └── ToSVG.hs ├── stack.yaml ├── stack.yaml.lock └── waterfall-cad-svg.cabal └── waterfall-cad ├── CHANGELOG.md ├── LICENSE ├── README.md ├── package.yaml ├── src ├── Waterfall.hs └── Waterfall │ ├── Booleans.hs │ ├── Booleans │ └── Operators.hs │ ├── BoundingBox │ ├── AxisAligned.hs │ └── Oriented.hs │ ├── Diagram.hs │ ├── Fillet.hs │ ├── IO.hs │ ├── Internal │ ├── Diagram.hs │ ├── Edges.hs │ ├── Finalizers.hs │ ├── FromOpenCascade.hs │ ├── Path.hs │ ├── Path │ │ └── Common.hs │ ├── Remesh.hs │ ├── Solid.hs │ └── ToOpenCascade.hs │ ├── Loft.hs │ ├── Offset.hs │ ├── Path.hs │ ├── Path │ └── Common.hs │ ├── Revolution.hs │ ├── Solids.hs │ ├── Sweep.hs │ ├── Transforms.hs │ └── TwoD │ ├── Booleans.hs │ ├── Internal │ ├── Path2D.hs │ └── Shape.hs │ ├── Path2D.hs │ ├── Shape.hs │ ├── Text.hs │ └── Transforms.hs └── waterfall-cad.cabal /.gitignore: -------------------------------------------------------------------------------- 1 | .stack-work/ 2 | *~ -------------------------------------------------------------------------------- /Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /cabal.project: -------------------------------------------------------------------------------- 1 | packages: 2 | ./opencascade-hs/opencascade-hs.cabal 3 | ./waterfall-cad/waterfall-cad.cabal 4 | ./waterfall-cad-svg/waterfall-cad-svg.cabal 5 | ./waterfall-cad-examples/waterfall-cad-examples.cabal 6 | 7 | package * 8 | ghc-options: -haddock 9 | documentation: True 10 | -------------------------------------------------------------------------------- /images/bounding_boxes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/bounding_boxes.png -------------------------------------------------------------------------------- /images/csg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/csg.png -------------------------------------------------------------------------------- /images/fillet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/fillet.png -------------------------------------------------------------------------------- /images/fonts/varela/VarelaRound-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/fonts/varela/VarelaRound-Regular.ttf -------------------------------------------------------------------------------- /images/gear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/gear.png -------------------------------------------------------------------------------- /images/loft.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/loft.png -------------------------------------------------------------------------------- /images/logo/repository-open-graph-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/logo/repository-open-graph-image.png -------------------------------------------------------------------------------- /images/models/2d-booleans.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/2d-booleans.glb -------------------------------------------------------------------------------- /images/models/bounding-boxes.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/bounding-boxes.glb -------------------------------------------------------------------------------- /images/models/csg.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/csg.glb -------------------------------------------------------------------------------- /images/models/fillet.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/fillet.glb -------------------------------------------------------------------------------- /images/models/gear.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/gear.glb -------------------------------------------------------------------------------- /images/models/loft.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/loft.glb -------------------------------------------------------------------------------- /images/models/offset.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/offset.glb -------------------------------------------------------------------------------- /images/models/prism.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/prism.glb -------------------------------------------------------------------------------- /images/models/revolution.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/revolution.glb -------------------------------------------------------------------------------- /images/models/studio_small_03_1k.hdr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/studio_small_03_1k.hdr -------------------------------------------------------------------------------- /images/models/sweep.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/sweep.glb -------------------------------------------------------------------------------- /images/models/text.glb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/models/text.glb -------------------------------------------------------------------------------- /images/offset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/offset.png -------------------------------------------------------------------------------- /images/prism.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/prism.png -------------------------------------------------------------------------------- /images/revolution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/revolution.png -------------------------------------------------------------------------------- /images/sweep.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/sweep.png -------------------------------------------------------------------------------- /images/text.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joe-warren/opencascade-hs/288b0748c66c2241046b84b512203b8459ae40aa/images/text.png -------------------------------------------------------------------------------- /opencascade-hs/README.md: -------------------------------------------------------------------------------- 1 | # OpenCASCADE-hs 2 | 3 | ![OpenCASCADE-hs](https://raw.githubusercontent.com/joe-warren/opencascade-hs/main/images/logo/opencascade-hs-logo-name.svg) 4 | 5 | A third party Haskell wrapper to [Open CASCADE](https://dev.opencascade.org) ([wiki](https://en.wikipedia.org/wiki/Open_Cascade_Technology)), which is the underlying framework behind [FreeCAD](https://www.freecad.org/). 6 | 7 | The API is only partially complete, and largely consists of the modeling functionality (BRep/Boolean Ops/Curves/etc), ignoring the visualization components. 8 | 9 | ## Dependencies 10 | 11 | You'll need the main OpenCASCADE libraries/header files installed to use this. 12 | 13 | Please see the [main readme](https://github.com/joe-warren/opencascade-hs/#installing-dependencies) on Github for more information. 14 | 15 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BOPAlgo_BOP.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BOPAlgo_BOP.h" 3 | 4 | 5 | BOPAlgo_BOP * hs_new_BOPAlgo_BOP(){ 6 | return new BOPAlgo_BOP(); 7 | } 8 | 9 | void hs_delete_BOPAlgo_BOP(BOPAlgo_BOP * bop){ 10 | delete bop; 11 | } 12 | 13 | void hs_BOPAlgo_BOP_AddTool(BOPAlgo_BOP *bop, TopoDS_Shape * tool){ 14 | bop->AddTool(*tool); 15 | } 16 | 17 | void hs_BOPAlgo_BOP_SetOperation(BOPAlgo_BOP *bop, BOPAlgo_Operation operation){ 18 | bop->SetOperation(operation); 19 | } 20 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BOPAlgo_BOP.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BOPALGO_BOP_H 2 | #define HS_BOPALGO_BOP_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BOPAlgo_BOP * hs_new_BOPAlgo_BOP(); 11 | 12 | void hs_delete_BOPAlgo_BOP(BOPAlgo_BOP * bop); 13 | 14 | void hs_BOPAlgo_BOP_AddTool(BOPAlgo_BOP *bop, TopoDS_Shape * tool); 15 | 16 | void hs_BOPAlgo_BOP_SetOperation(BOPAlgo_BOP *bop, BOPAlgo_Operation operation); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif // HS_BOPALGO_BOP_H 23 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BOPAlgo_Builder.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BOPAlgo_Builder.h" 3 | 4 | BOPAlgo_Builder * hs_new_BOPAlgo_Builder(){ 5 | return new BOPAlgo_Builder(); 6 | } 7 | 8 | void hs_delete_BOPAlgo_Builder(BOPAlgo_Builder * builder){ 9 | delete builder; 10 | } 11 | 12 | void hs_BOPAlgo_Builder_AddArgument(BOPAlgo_Builder * builder, TopoDS_Shape * shape){ 13 | builder->AddArgument(*shape); 14 | } 15 | 16 | TopoDS_Shape * hs_BOPAlgo_Builder_Shape(BOPAlgo_Builder * builder){ 17 | return new TopoDS_Shape(builder->Shape()); 18 | } 19 | 20 | void hs_BOPAlgo_Builder_SetRunParallel(BOPAlgo_Builder * builder, bool runParallel){ 21 | builder->SetRunParallel(runParallel); 22 | } 23 | 24 | void hs_BOPAlgo_Builder_Perform(BOPAlgo_Builder * builder){ 25 | builder->Perform(); 26 | } 27 | 28 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BOPAlgo_Builder.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BOPALGO_BUILDER_H 2 | #define HS_BOPALGO_BUILDER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BOPAlgo_Builder * hs_new_BOPAlgo_Builder(); 11 | 12 | void hs_delete_BOPAlgo_Builder(BOPAlgo_Builder * builder); 13 | 14 | void hs_BOPAlgo_Builder_AddArgument(BOPAlgo_Builder * builder, TopoDS_Shape * shape); 15 | 16 | TopoDS_Shape * hs_BOPAlgo_Builder_Shape(BOPAlgo_Builder * builder); 17 | 18 | void hs_BOPAlgo_Builder_SetRunParallel(BOPAlgo_Builder * builder, bool runParallel); 19 | 20 | void hs_BOPAlgo_Builder_Perform(BOPAlgo_Builder * builder); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif // HS_BOPALGO_BUILDER_H 27 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepAdaptor_Curve.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREP_ADAPTOR_CURVE_H 2 | #define HS_BREP_ADAPTOR_CURVE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepAdaptor_Curve * hs_new_BRepAdaptor_Curve_fromEdge(TopoDS_Edge * edge); 11 | 12 | void hs_delete_BRepAdaptor_Curve(BRepAdaptor_Curve * curve); 13 | 14 | GeomAbs_CurveType hs_BRepAdaptor_Curve_curveType(BRepAdaptor_Curve* curve); 15 | 16 | Handle(Geom_BezierCurve) * hs_BRepAdaptor_Curve_bezier(BRepAdaptor_Curve * curve); 17 | 18 | Handle(Geom_BSplineCurve) * hs_BRepAdaptor_Curve_bspline(BRepAdaptor_Curve * curve); 19 | 20 | GeomAdaptor_Curve * hs_BRepAdaptor_Curve_curve(BRepAdaptor_Curve * curve); 21 | 22 | double hs_BRepAdaptor_Curve_firstParameter(BRepAdaptor_Curve *curve); 23 | 24 | double hs_BRepAdaptor_Curve_lastParameter(BRepAdaptor_Curve *curve); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif // HS_BREP_ADAPTOR_CURVE_H 31 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepAlgoAPI_Common.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepAlgoAPI_Common.h" 3 | 4 | #include 5 | 6 | TopoDS_Shape * hs_BRepAlgoAPI_Common(TopoDS_Shape * a, TopoDS_Shape * b){ 7 | auto builder = BRepAlgoAPI_Common(*a, *b); 8 | return new TopoDS_Shape(builder.Shape()); 9 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepAlgoAPI_Common.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HS_BREPALGOAPI_COMMON_H 3 | #define HS_BREPALGOAPI_COMMON_H 4 | 5 | #include "hs_types.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | TopoDS_Shape * hs_BRepAlgoAPI_Common(TopoDS_Shape * a, TopoDS_Shape * b); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif // HS_BREPALGOAPI_COMMON_H 18 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepAlgoAPI_Cut.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepAlgoAPI_Cut.h" 3 | 4 | #include 5 | 6 | TopoDS_Shape * hs_BRepAlgoAPI_Cut(TopoDS_Shape * a, TopoDS_Shape * b){ 7 | auto builder = BRepAlgoAPI_Cut(*a, *b); 8 | return new TopoDS_Shape(builder.Shape()); 9 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepAlgoAPI_Cut.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HS_BREPALGOAPI_CUT_H 3 | #define HS_BREPALGOAPI_CUT_H 4 | 5 | #include "hs_types.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | TopoDS_Shape * hs_BRepAlgoAPI_Cut(TopoDS_Shape * a, TopoDS_Shape * b); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif // HS_BREPALGOAPI_CUT_H 18 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepAlgoAPI_Fuse.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepAlgoAPI_Fuse.h" 3 | 4 | #include 5 | 6 | TopoDS_Shape * hs_BRepAlgoAPI_Fuse(TopoDS_Shape * a, TopoDS_Shape * b){ 7 | auto builder = BRepAlgoAPI_Fuse(*a, *b); 8 | return new TopoDS_Shape(builder.Shape()); 9 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepAlgoAPI_Fuse.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPALGOAPI_FUSE_H 2 | #define HS_BREPALGOAPI_FUSE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Shape * hs_BRepAlgoAPI_Fuse(TopoDS_Shape * a, TopoDS_Shape * b); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_BREPALGOAPI_FUSE_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBndLib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepBndLib.h" 3 | 4 | void hs_BRepBndLib_add(TopoDS_Shape * shape, Bnd_Box * box, bool useTriangulation){ 5 | BRepBndLib::Add(*shape, *box, useTriangulation); 6 | } 7 | 8 | void hs_BRepBndLib_addOptimal(TopoDS_Shape * shape, Bnd_Box * box, bool useTriangulation, bool useShapeTolerance){ 9 | BRepBndLib::AddOptimal(*shape, *box, useTriangulation, useShapeTolerance); 10 | } 11 | 12 | void hs_BRepBndLib_addOBB(TopoDS_Shape *shape, Bnd_OBB * obb, bool isTriangulationUsed, bool isOptimal, bool isShapeToleranceUsed){ 13 | BRepBndLib::AddOBB(*shape, *obb, isTriangulationUsed, isOptimal, isShapeToleranceUsed); 14 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBndLib.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPBNDLIB_H 2 | #define HS_BREPBNDLIB_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void hs_BRepBndLib_add(TopoDS_Shape * shape, Bnd_Box * box, bool useTriangulation); 11 | 12 | void hs_BRepBndLib_addOptimal(TopoDS_Shape * shape, Bnd_Box * box, bool useTriangulation, bool useShapeTolerance); 13 | 14 | void hs_BRepBndLib_addOBB(TopoDS_Shape *shape, Bnd_OBB * obb, bool isTriangulationUsed, bool isOptimal, bool isShapeToleranceUsed); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_BREPBNDLIB_H 21 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_Copy.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepBuilderAPI_Copy.h" 3 | 4 | TopoDS_Shape * hs_BRepBuilderAPI_Copy_copy(TopoDS_Shape *shape, bool copyGeom, bool copyMesh){ 5 | return new TopoDS_Shape(BRepBuilderAPI_Copy(*shape, copyGeom, copyMesh).Shape()); 6 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_Copy.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HS_BREPBUILDERAPI_COPY_H 3 | #define HS_BREPBUILDERAPI_COPY_H 4 | 5 | #include "hs_types.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | TopoDS_Shape * hs_BRepBuilderAPI_Copy_copy(TopoDS_Shape *shape, bool copyGeom, bool copyMesh); 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif // BREPBUILDERAPI_COPY 18 | 19 | 20 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_GTransform.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_BRepBuilderAPI_GTransform.h" 4 | 5 | TopoDS_Shape * hs_BRepBuilderAPI_GTransform_gtransform(TopoDS_Shape * shape, gp_GTrsf * trsf, bool copy){ 6 | auto builder = BRepBuilderAPI_GTransform(*shape, *trsf, copy); 7 | return new TopoDS_Shape(builder.Shape()); 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_GTransform.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPBUILDERAPI_GTRANSFORM_H 2 | #define HS_BREPBUILDERAPI_GTRANSFORM_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Shape * hs_BRepBuilderAPI_GTransform_gtransform(TopoDS_Shape * shape, gp_GTrsf * trsf, bool copy); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_BREPBUILDERAPI_GTRANSFORM_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_MakePolygon.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_BRepBuilderAPI_MakePolygon.h" 4 | 5 | TopoDS_Wire * hs_BRepBuilderAPI_MakePolygon_from3Pnts(gp_Pnt * n1, gp_Pnt *n2, gp_Pnt * n3, bool close){ 6 | auto builder = BRepBuilderAPI_MakePolygon(*n1, *n2, *n3, close); 7 | return new TopoDS_Wire(builder.Wire()); 8 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_MakePolygon.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPBUILDERAPI_MAKEPOLYGON_H 2 | #define HS_BREPBUILDERAPI_MAKEPOLYGON_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Wire * hs_BRepBuilderAPI_MakePolygon_from3Pnts(gp_Pnt * n1, gp_Pnt *n2, gp_Pnt * n3, bool close); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_BREPBUILDERAPI_MAKEPOLYGON_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_MakeShape.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_BRepBuilderAPI_MakeShape.h" 4 | 5 | TopoDS_Shape * hs_BRepBuilderAPI_MakeShape_shape(BRepBuilderAPI_MakeShape* builder){ 6 | return new TopoDS_Shape(builder->Shape()); 7 | } 8 | 9 | void hs_BRepBuilderAPI_MakeShape_build(BRepBuilderAPI_MakeShape* builder){ 10 | builder->Build(); 11 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_MakeShape.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPBUILDERAPI_MAKE_SHAPE_H 2 | #define HS_BREPBUILDERAPI_MAKE_SHAPE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Shape * hs_BRepBuilderAPI_MakeShape_shape(BRepBuilderAPI_MakeShape * builder); 11 | 12 | void hs_BRepBuilderAPI_MakeShape_build(BRepBuilderAPI_MakeShape* builder); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_BREPBUILDERAPI_MAKE_SHAPE_H 19 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_MakeSolid.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_BRepBuilderAPI_MakeSolid.h" 4 | 5 | BRepBuilderAPI_MakeSolid * hs_new_BRepBuilderAPI_MakeSolid(){ 6 | auto everywhere = BRepBuilderAPI_MakeSolid().Shape(); 7 | return new BRepBuilderAPI_MakeSolid(); 8 | } 9 | 10 | void hs_delete_BRepBuilderAPI_MakeSolid(BRepBuilderAPI_MakeSolid * builder){ 11 | delete builder; 12 | } 13 | 14 | void hs_BRepBuilderAPI_MakeSolid_add(BRepBuilderAPI_MakeSolid * builder, TopoDS_Shell * shell){ 15 | builder->Add(*shell); 16 | } 17 | 18 | TopoDS_Solid * hs_BRepBuilderAPI_MakeSolid_solid(BRepBuilderAPI_MakeSolid * builder){ 19 | return new TopoDS_Solid(builder->Solid()); 20 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_MakeSolid.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPBUILDERAPI_MAKESOLID_H 2 | #define HS_BREPBUILDERAPI_MAKESOLID_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepBuilderAPI_MakeSolid * hs_new_BRepBuilderAPI_MakeSolid(); 11 | 12 | void hs_delete_BRepBuilderAPI_MakeSolid(BRepBuilderAPI_MakeSolid * builder); 13 | 14 | void hs_BRepBuilderAPI_MakeSolid_add(BRepBuilderAPI_MakeSolid * builder, TopoDS_Shell * shell); 15 | 16 | TopoDS_Solid * hs_BRepBuilderAPI_MakeSolid_solid(BRepBuilderAPI_MakeSolid * builder); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif // HS_BREPBUILDERAPI_MAKESOLID_H 23 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_MakeVertex.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepBuilderAPI_MakeVertex.h" 3 | #include 4 | 5 | BRepBuilderAPI_MakeVertex * hs_new_BRepBuilderAPI_MakeVertex_fromPnt(gp_Pnt* pnt){ 6 | return new BRepBuilderAPI_MakeVertex(*pnt); 7 | } 8 | 9 | void hs_delete_BRepBuilderAPI_MakeVertex(BRepBuilderAPI_MakeVertex* builder){ 10 | delete builder; 11 | } 12 | 13 | TopoDS_Vertex * hs_BRepBuilderAPI_MakeVertex_vertex(BRepBuilderAPI_MakeVertex * builder){ 14 | return new TopoDS_Vertex(builder->Vertex()); 15 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_MakeVertex.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPBUILDERAPI_MAKEVERTEX_H 2 | #define HS_BREPBUILDERAPI_MAKEVERTEX_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepBuilderAPI_MakeVertex * hs_new_BRepBuilderAPI_MakeVertex_fromPnt(gp_Pnt* pnt); 11 | 12 | void hs_delete_BRepBuilderAPI_MakeVertex(BRepBuilderAPI_MakeVertex* builder); 13 | 14 | TopoDS_Vertex * hs_BRepBuilderAPI_MakeVertex_vertex(BRepBuilderAPI_MakeVertex * builder); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_BREPBUILDERAPI_MAKEVERTEX_H 21 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_MakeWire.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPBUILDERAPI_MAKEWIRE_H 2 | #define HS_BREPBUILDERAPI_MAKEWIRE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepBuilderAPI_MakeWire * hs_new_BRepBuilderAPI_MakeWire(); 11 | 12 | void hs_delete_BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeWire* builder); 13 | 14 | void hs_BRepBuilderAPI_MakeWire_AddEdge(BRepBuilderAPI_MakeWire* builder, TopoDS_Edge* edge); 15 | 16 | void hs_BRepBuilderAPI_MakeWire_AddWire(BRepBuilderAPI_MakeWire* builder, TopoDS_Wire* wire); 17 | 18 | void hs_BRepBuilderAPI_MakeWire_AddListOfShape(BRepBuilderAPI_MakeWire* builder, TopTools_ListOfShape *list); 19 | 20 | TopoDS_Wire * hs_BRepBuilderAPI_MakeWire_Wire(BRepBuilderAPI_MakeWire* builder); 21 | 22 | TopoDS_Vertex * hs_BRepBuilderAPI_MakeWire_Vertex(BRepBuilderAPI_MakeWire* builder); 23 | 24 | bool hs_BRepBuilderAPI_MakeWire_IsDone(BRepBuilderAPI_MakeWire* builder); 25 | 26 | BRepBuilderAPI_WireError hs_BRepBuilderAPI_MakeWire_Error(BRepBuilderAPI_MakeWire* builder); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif // HS_BREPBUILDERAPI_MAKEWIRE_H 33 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_Sewing.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPBUILDERAPI_SEWING_H 2 | #define HS_BREPBUILDERAPI_SEWING_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepBuilderAPI_Sewing * hs_new_BRepBuilderAPI_Sewing(double tolerance , bool option1, bool option2, bool option3, bool option4); 11 | 12 | void hs_delete_BRepBuilderAPI_Sewing(BRepBuilderAPI_Sewing * builder); 13 | 14 | void hs_BRepBuilderAPI_Sewing_load(BRepBuilderAPI_Sewing * builder, TopoDS_Shape * shape); 15 | 16 | void hs_BRepBuilderAPI_Sewing_add(BRepBuilderAPI_Sewing * builder, TopoDS_Shape * shape); 17 | 18 | void hs_BRepBuilderAPI_Sewing_perform(BRepBuilderAPI_Sewing * builder); 19 | 20 | TopoDS_Shape * hs_BRepBuilderAPI_Sewing_sewedShape(BRepBuilderAPI_Sewing * builder); 21 | 22 | int hs_BRepBuilderAPI_Sewing_nbFreeEdges(BRepBuilderAPI_Sewing * builder); 23 | 24 | int hs_BRepBuilderAPI_Sewing_nbContigousEdges(BRepBuilderAPI_Sewing * builder); 25 | 26 | int hs_BRepBuilderAPI_Sewing_nbMultipleEdges(BRepBuilderAPI_Sewing * builder); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif // HS_BREPBUILDERAPI_SEWING_H 33 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_Transform.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_BRepBuilderAPI_Transform.h" 4 | 5 | TopoDS_Shape * hs_BRepBuilderAPI_Transform_transform(TopoDS_Shape * shape, gp_Trsf * trsf, bool copy){ 6 | auto builder = BRepBuilderAPI_Transform(*shape, *trsf, copy); 7 | return new TopoDS_Shape(builder.Shape()); 8 | } 9 | 10 | 11 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepBuilderAPI_Transform.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPBUILDERAPI_TRANSFORM_H 2 | #define HS_BREPBUILDERAPI_TRANSFORM_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Shape * hs_BRepBuilderAPI_Transform_transform(TopoDS_Shape * shape, gp_Trsf * trsf, bool copy); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_BREPBUILDERAPI_TRANSFORM_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepFilletAPI_MakeChamfer.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPFILLETAPI_MAKECHAMFER_H 2 | #define HS_BREPFILLETAPI_MAKECHAMFER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepFilletAPI_MakeChamfer * hs_new_BRepFilletAPI_MakeChamfer_fromShape(TopoDS_Shape * shape) ; 11 | 12 | void hs_delete_BRepFilletAPI_MakeChamfer(BRepFilletAPI_MakeChamfer * builder) ; 13 | 14 | void hs_BRepFilletAPI_MakeChamfer_addEdge(BRepFilletAPI_MakeChamfer * builder, TopoDS_Edge *edge ); 15 | 16 | void hs_BRepFilletAPI_MakeChamfer_addEdgeWithDistance(BRepFilletAPI_MakeChamfer * builder, double d, TopoDS_Edge *edge ); 17 | 18 | void hs_BRepFilletAPI_MakeChamfer_reset(BRepFilletAPI_MakeChamfer * builder); 19 | 20 | int hs_BRepFilletAPI_MakeChamfer_nbEdges(BRepFilletAPI_MakeChamfer * builder, int contourIndex); 21 | 22 | TopoDS_Edge * hs_BRepFilletAPI_MakeChamfer_edge(BRepFilletAPI_MakeChamfer * builder, int contourIndex, int edgeIndex); 23 | 24 | void hs_BRepFilletAPI_MakeChamfer_remove(BRepFilletAPI_MakeChamfer * builder, TopoDS_Edge * edge); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif // HS_BREPFILLETAPI_MAKECHAMFER_H 31 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepGProp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepGProp.h" 3 | 4 | void hs_BRepGProp_VolumeProperties(TopoDS_Shape *shape, GProp_GProps *props, bool onlyClosed, bool skipShared, bool useTriangulation ){ 5 | BRepGProp::VolumeProperties(*shape, *props, onlyClosed, skipShared, useTriangulation); 6 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepGProp.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPGPROP_H 2 | #define HS_BREPGPROP_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void hs_BRepGProp_VolumeProperties(TopoDS_Shape * shape, GProp_GProps * props, bool onlyClosed, bool skipShared, bool useTriangulation ); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_BREPGPROP_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepLib.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepLib.h" 3 | 4 | bool hs_BRepLib_orientClosedSolid(TopoDS_Solid * solid){ 5 | return BRepLib::OrientClosedSolid(*solid); 6 | } 7 | 8 | bool hs_BRepLib_buildCurve3d(TopoDS_Edge* edge, double tolerance, GeomAbs_Shape continuity, int maxDegree, int maxSegment){ 9 | return BRepLib::BuildCurve3d(*edge, tolerance, continuity, maxDegree, maxSegment); 10 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepLib.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPLIB_H 2 | #define HS_BREPLIB_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | bool hs_BRepLib_orientClosedSolid(TopoDS_Solid * solid); 11 | 12 | bool hs_BRepLib_buildCurve3d(TopoDS_Edge* edge, double tolerance, GeomAbs_Shape continuity, int maxDegree, int maxSegment); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_BREPLIB_H 19 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepMesh_IncrementalMesh.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepMesh_IncrementalMesh.h" 3 | 4 | 5 | BRepMesh_IncrementalMesh * hs_BRepMesh_IncrementalMesh_fromShapeAndLinDeflection(TopoDS_Shape *shape, double theLinDeflection){ 6 | return new BRepMesh_IncrementalMesh(*shape, theLinDeflection); 7 | } 8 | 9 | void hs_delete_BRepMesh_IncrementalMesh(BRepMesh_IncrementalMesh * mesh){ 10 | delete mesh; 11 | } 12 | 13 | void hs_BRepMesh_IncrementalMesh_Perform(BRepMesh_IncrementalMesh * mesh){ 14 | mesh->Perform(); 15 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepMesh_IncrementalMesh.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPMESH_INCREMENTALMESH_H 2 | #define HS_BREPMESH_INCREMENTALMESH_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepMesh_IncrementalMesh * hs_BRepMesh_IncrementalMesh_fromShapeAndLinDeflection(TopoDS_Shape *shape, double theLinDeflection); 11 | 12 | void hs_delete_BRepMesh_IncrementalMesh(BRepMesh_IncrementalMesh * mesh); 13 | 14 | void hs_BRepMesh_IncrementalMesh_Perform(BRepMesh_IncrementalMesh * mesh); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_BREPMESH_INCREMENTALMESH_H 21 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepOffsetAPI_MakeOffsetShape.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepOffsetAPI_MakeOffsetShape.h" 3 | 4 | BRepOffsetAPI_MakeOffsetShape * hs_new_BRepOffsetAPI_MakeOffsetShape(){ 5 | return new BRepOffsetAPI_MakeOffsetShape(); 6 | } 7 | 8 | void hs_delete_BRepOffsetAPI_MakeOffsetShape(BRepOffsetAPI_MakeOffsetShape * builder){ 9 | delete builder; 10 | } 11 | 12 | void hs_BRepOffsetAPI_MakeOffsetShape_performBySimple(BRepOffsetAPI_MakeOffsetShape * builder, TopoDS_Shape * shape, double value){ 13 | builder->PerformBySimple(*shape, value); 14 | } 15 | 16 | void hs_BRepOffsetAPI_MakeOffsetShape_performByJoin( 17 | BRepOffsetAPI_MakeOffsetShape * builder, 18 | TopoDS_Shape * shape, 19 | double value, 20 | double tol, 21 | BRepOffset_Mode mode, 22 | bool intersection, 23 | bool selfInter, 24 | GeomAbs_JoinType join, 25 | bool removeIntEdges 26 | ){ 27 | builder->PerformByJoin(*shape, value, tol, mode, intersection, selfInter, join, removeIntEdges); 28 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepOffsetAPI_MakeOffsetShape.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPOFFSETAPI_MAKEOFFSETSHAPE_H 2 | #define HS_BREPOFFSETAPI_MAKEOFFSETSHAPE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepOffsetAPI_MakeOffsetShape * hs_new_BRepOffsetAPI_MakeOffsetShape(); 11 | 12 | void hs_delete_BRepOffsetAPI_MakeOffsetShape(BRepOffsetAPI_MakeOffsetShape * builder); 13 | 14 | void hs_BRepOffsetAPI_MakeOffsetShape_performBySimple(BRepOffsetAPI_MakeOffsetShape * builder, TopoDS_Shape * shape, double value); 15 | 16 | void hs_BRepOffsetAPI_MakeOffsetShape_performByJoin( 17 | BRepOffsetAPI_MakeOffsetShape * builder, 18 | TopoDS_Shape * shape, 19 | double value, 20 | double tol, 21 | BRepOffset_Mode mode, 22 | bool intersection, 23 | bool selfInter, 24 | GeomAbs_JoinType join, 25 | bool removeIntEdges 26 | ); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif // HS_BREPOFFSETAPI_MAKEOFFSETSHAPE_H 33 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepOffsetAPI_MakePipe.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepOffsetAPI_MakePipe.h" 3 | 4 | BRepOffsetAPI_MakePipe * hs_new_BRepOffsetAPI_MakePipe_fromWireAndShape(TopoDS_Wire * wire, TopoDS_Shape * profile){ 5 | return new BRepOffsetAPI_MakePipe(*wire, *profile); 6 | } 7 | 8 | BRepOffsetAPI_MakePipe * hs_new_BRepOffsetAPI_MakePipe_fromWireShapeTrihedronModeAndForceC1( 9 | TopoDS_Wire * wire, 10 | TopoDS_Shape * profile, 11 | GeomFill_Trihedron mode, 12 | bool forceApproxC1 ){ 13 | return new BRepOffsetAPI_MakePipe(*wire, *profile, mode, forceApproxC1); 14 | } 15 | 16 | void hs_delete_BRepOffsetAPI_MakePipe(BRepOffsetAPI_MakePipe * builder){ 17 | delete builder; 18 | } 19 | 20 | 21 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepOffsetAPI_MakePipe.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPOFFSETAPI_MAKEPIPE_H 2 | #define HS_BREPOFFSETAPI_MAKEPIPE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepOffsetAPI_MakePipe * hs_new_BRepOffsetAPI_MakePipe_fromWireAndShape(TopoDS_Wire * wire, TopoDS_Shape * profile); 11 | 12 | BRepOffsetAPI_MakePipe * hs_new_BRepOffsetAPI_MakePipe_fromWireShapeTrihedronModeAndForceC1( 13 | TopoDS_Wire * wire, 14 | TopoDS_Shape * profile, 15 | GeomFill_Trihedron mode, 16 | bool forceApproxC1 ); 17 | 18 | void hs_delete_BRepOffsetAPI_MakePipe(BRepOffsetAPI_MakePipe * builder); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif // HS_BREPOFFSETAPI_MAKEPIPE_H 25 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepOffsetAPI_ThruSections.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepOffsetAPI_ThruSections.h" 3 | 4 | BRepOffsetAPI_ThruSections * hs_new_BRepOffsetAPI_ThruSections(bool isSolid, bool ruled, double pres3d){ 5 | return new BRepOffsetAPI_ThruSections(isSolid, ruled, pres3d); 6 | } 7 | 8 | void hs_delete_BRepOffsetAPI_ThruSections(BRepOffsetAPI_ThruSections* thruSections){ 9 | delete thruSections; 10 | } 11 | 12 | void hs_BRepOffsetAPI_ThruSections_addWire(BRepOffsetAPI_ThruSections* thruSections, TopoDS_Wire * wire){ 13 | thruSections->AddWire(*wire); 14 | } 15 | 16 | void hs_BRepOffsetAPI_ThruSections_addVertex(BRepOffsetAPI_ThruSections* thruSections, TopoDS_Vertex* vertex){ 17 | thruSections->AddVertex(*vertex); 18 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepOffsetAPI_ThruSections.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HS_BREPOFFSETAPI_THRUSECTIONS_H 3 | #define HS_BREPOFFSETAPI_THRUSECTIONS_H 4 | 5 | #include "hs_types.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | BRepOffsetAPI_ThruSections * hs_new_BRepOffsetAPI_ThruSections(bool isSolid, bool ruled, double pres3d); 12 | 13 | void hs_delete_BRepOffsetAPI_ThruSections(BRepOffsetAPI_ThruSections* thruSections); 14 | 15 | void hs_BRepOffsetAPI_ThruSections_addWire(BRepOffsetAPI_ThruSections* thruSections, TopoDS_Wire * wire); 16 | 17 | void hs_BRepOffsetAPI_ThruSections_addVertex(BRepOffsetAPI_ThruSections* thruSections, TopoDS_Vertex* vertex); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif // HS_BREPOFFSETAPI_THRUSECTIONS_H 24 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeBox.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "hs_BRepPrimAPI_MakeBox.h" 5 | 6 | 7 | BRepPrimAPI_MakeBox * hs_new_BRepPrimAPI_MakeBox_fromPnts(gp_Pnt *a, gp_Pnt *b){ 8 | return new BRepPrimAPI_MakeBox(*a, *b); 9 | } 10 | 11 | void hs_delete_BRepPrimAPI_MakeBox(BRepPrimAPI_MakeBox* builder){ 12 | delete builder; 13 | } 14 | 15 | TopoDS_Shape * hs_BRepPrimAPI_MakeBox_Solid(BRepPrimAPI_MakeBox* builder){ 16 | return new TopoDS_Shape(builder->Solid()); 17 | } 18 | 19 | TopoDS_Shell * hs_BRepPrimAPI_MakeBox_Shell(BRepPrimAPI_MakeBox* builder){ 20 | return new TopoDS_Shell(builder->Shell()); 21 | } 22 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeBox.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPPRIMAPI_MAKEBOX_H 2 | #define HS_BREPPRIMAPI_MAKEBOX_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepPrimAPI_MakeBox * hs_new_BRepPrimAPI_MakeBox_fromPnts(gp_Pnt * a, gp_Pnt * b); 11 | 12 | void hs_delete_BRepPrimAPI_MakeBox(BRepPrimAPI_MakeBox* builder); 13 | 14 | TopoDS_Shape * hs_BRepPrimAPI_MakeBox_Solid(BRepPrimAPI_MakeBox* builder); 15 | 16 | TopoDS_Shell * hs_BRepPrimAPI_MakeBox_Shell(BRepPrimAPI_MakeBox* builder); 17 | 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif // HS_BREPPRIMAPI_MAKEBOX_H 24 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeCone.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepPrimAPI_MakeCone.h" 3 | 4 | TopoDS_Solid * hs_BRepPrimAPI_MakeCone_fromTwoRadiiAndHeight(double r1, double r2, double h){ 5 | auto builder = BRepPrimAPI_MakeCone(r1, r2, h); 6 | return new TopoDS_Solid(builder.Solid()); 7 | } 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeCone.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPPRIMAPI_MAKECONE_H 2 | #define HS_BREPPRIMAPI_MAKECONE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Solid * hs_BRepPrimAPI_MakeCone_fromTwoRadiiAndHeight(double r1, double r2, double h); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_BREPPRIMAPI_MAKECONE_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeCylinder.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepPrimAPI_MakeCylinder.h" 3 | 4 | TopoDS_Solid * hs_BRepPrimAPI_MakeCylinder_fromRadiusAndHeight(double r, double h){ 5 | auto builder = BRepPrimAPI_MakeCylinder(r, h); 6 | return new TopoDS_Solid(builder.Solid()); 7 | } 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeCylinder.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPPRIMAPI_MAKECYLINDER_H 2 | #define HS_BREPPRIMAPI_MAKECYLINDER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Solid * hs_BRepPrimAPI_MakeCylinder_fromRadiusAndHeight(double r, double h); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_BREPPRIMAPI_MAKECYLINDER_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakePrism.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepPrimAPI_MakePrism.h" 3 | 4 | 5 | TopoDS_Shape * hs_BRepPrimAPI_MakePrism_fromVec(TopoDS_Shape * shape, gp_Vec * vec, bool copy, bool canonize){ 6 | auto builder = BRepPrimAPI_MakePrism(*shape, *vec, copy, canonize); 7 | return new TopoDS_Shape(builder.Shape()); 8 | } 9 | 10 | TopoDS_Shape * hs_BRepPrimAPI_MakePrism_fromDir(TopoDS_Shape * shape, gp_Dir * dir, bool inf, bool copy, bool canonize){ 11 | auto builder = BRepPrimAPI_MakePrism(*shape, *dir, inf, copy, canonize); 12 | return new TopoDS_Shape(builder.Shape()); 13 | } 14 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakePrism.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPPRIMAPI_MAKEPRISM_H 2 | #define HS_BREPPRIMAPI_MAKEPRISM_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Shape * hs_BRepPrimAPI_MakePrism_fromVec(TopoDS_Shape * shape, gp_Vec * vec, bool copy, bool canonize); 11 | 12 | TopoDS_Shape * hs_BRepPrimAPI_MakePrism_fromDir(TopoDS_Shape * shape, gp_Dir * dir, bool inf, bool copy, bool canonize); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_BREPPRIMAPI_MAKEPRISM_H 19 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeRevol.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepPrimAPI_MakeRevol.h" 3 | 4 | BRepPrimAPI_MakeRevol * hs_new_BRepPrimAPI_MakeRevol_fromShapeAndAx1(TopoDS_Shape * shape, gp_Ax1 * axis, bool copy){ 5 | return new BRepPrimAPI_MakeRevol(*shape, *axis, copy); 6 | } 7 | 8 | void hs_delete_BRepPrimAPI_MakeRevol(BRepPrimAPI_MakeRevol * builder){ 9 | delete builder; 10 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeRevol.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPPRIMAPI_MAKEREVOL_H 2 | #define HS_BREPPRIMAPI_MAKEREVOL_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | BRepPrimAPI_MakeRevol * hs_new_BRepPrimAPI_MakeRevol_fromShapeAndAx1(TopoDS_Shape * shape, gp_Ax1 * axis, bool copy); 11 | 12 | void hs_delete_BRepPrimAPI_MakeRevol(BRepPrimAPI_MakeRevol * builder); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_BREPPRIMAPI_MAKEREVOL_H 19 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeSphere.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepPrimAPI_MakeSphere.h" 3 | 4 | 5 | TopoDS_Solid * hs_BRepPrimAPI_MakeSphere_fromRadius(double r){ 6 | auto builder = BRepPrimAPI_MakeSphere(r); 7 | return new TopoDS_Solid(builder.Solid()); 8 | } 9 | 10 | TopoDS_Solid * hs_BRepPrimAPI_MakeSphere_fromPntAndRadius(gp_Pnt * center, double r){ 11 | auto builder = BRepPrimAPI_MakeSphere(*center, r); 12 | return new TopoDS_Solid(builder.Solid()); 13 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepPrimAPI_MakeSphere.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPPRIMAPI_MAKESPHERE_H 2 | #define HS_BREPPRIMAPI_MAKESPHERE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Solid * hs_BRepPrimAPI_MakeSphere_fromRadius(double r); 11 | 12 | TopoDS_Solid * hs_BRepPrimAPI_MakeSphere_fromPntAndRadius(gp_Pnt * center, double r); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_BREPPRIMAPI_MAKESPHERE_H 19 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepTools_WireExplorer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_BRepTools_WireExplorer.h" 3 | 4 | BRepTools_WireExplorer * hs_new_BRepTools_WireExplorer_fromWire(TopoDS_Wire *wire){ 5 | return new BRepTools_WireExplorer(*wire); 6 | } 7 | 8 | void hs_delete_BRepTools_WireExplorer(BRepTools_WireExplorer * explorer){ 9 | delete explorer; 10 | } 11 | 12 | bool hs_BRepTools_WireExplorer_more(BRepTools_WireExplorer * explorer){ 13 | return explorer->More(); 14 | } 15 | 16 | void hs_BRepTools_WireExplorer_next(BRepTools_WireExplorer * explorer){ 17 | explorer->Next(); 18 | } 19 | 20 | TopoDS_Edge * hs_BRepTools_WireExplorer_current(BRepTools_WireExplorer * explorer){ 21 | return (TopoDS_Edge *) &(explorer->Current()); 22 | } 23 | 24 | TopAbs_Orientation hs_BRepTools_WireExplorer_orientation(BRepTools_WireExplorer * explorer){ 25 | return explorer->Orientation(); 26 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRepTools_WireExplorer.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPTOOLS_WIREEXPLORER_H 2 | #define HS_BREPTOOLS_WIREEXPLORER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | 11 | BRepTools_WireExplorer * hs_new_BRepTools_WireExplorer_fromWire(TopoDS_Wire *wire); 12 | 13 | void hs_delete_BRepTools_WireExplorer(BRepTools_WireExplorer * explorer); 14 | 15 | bool hs_BRepTools_WireExplorer_more(BRepTools_WireExplorer * explorer); 16 | 17 | void hs_BRepTools_WireExplorer_next(BRepTools_WireExplorer * explorer); 18 | 19 | TopoDS_Edge * hs_BRepTools_WireExplorer_current(BRepTools_WireExplorer * explorer); 20 | 21 | TopAbs_Orientation hs_BRepTools_WireExplorer_orientation(BRepTools_WireExplorer * explorer); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif // HS_BREPTOOLS_WIREEXPLORER_H 28 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRep_Tool.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_BRep_Tool.h" 4 | 5 | Handle(Geom_Curve) * hs_BRep_Tool_curve(TopoDS_Edge * edge){ 6 | double s, e; 7 | return new Handle(Geom_Curve)(BRep_Tool::Curve(*edge, s, e)); 8 | } 9 | 10 | double hs_BRep_Tool_curveParamFirst(TopoDS_Edge * edge){ 11 | double s, e; 12 | BRep_Tool::Curve(*edge, s, e); 13 | return s; 14 | } 15 | 16 | double hs_BRep_Tool_curveParamLast(TopoDS_Edge * edge){ 17 | double s, e; 18 | BRep_Tool::Curve(*edge, s, e); 19 | return e; 20 | } 21 | 22 | gp_Pnt * hs_BRep_Tool_pnt(TopoDS_Vertex * vertex){ 23 | return new gp_Pnt(BRep_Tool::Pnt(*vertex)); 24 | } 25 | 26 | Handle(Poly_Triangulation) * hs_BRep_Tool_triangulation(TopoDS_Face * face, TopLoc_Location * loc){ 27 | return new opencascade::handle(BRep_Tool::Triangulation(*face, *loc)); 28 | } 29 | 30 | 31 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_BRep_Tool.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREP_TOOL_H 2 | #define HS_BREP_TOOL_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Handle(Geom_Curve) * hs_BRep_Tool_curve(TopoDS_Edge * edge); 11 | 12 | double hs_BRep_Tool_curveParamFirst(TopoDS_Edge * edge); 13 | 14 | double hs_BRep_Tool_curveParamLast(TopoDS_Edge * edge); 15 | 16 | gp_Pnt * hs_BRep_Tool_pnt(TopoDS_Vertex * vertex); 17 | 18 | Handle(Poly_Triangulation) * hs_BRep_Tool_triangulation(TopoDS_Face * face, TopLoc_Location * loc); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif // HS_BREP_TOOL_H 25 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Bnd_Box.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_Bnd_Box.h" 3 | 4 | Bnd_Box * hs_new_Bnd_Box(){ 5 | return new Bnd_Box(); 6 | } 7 | 8 | void hs_delete_Bnd_Box(Bnd_Box * box){ 9 | delete box; 10 | } 11 | 12 | gp_Pnt * hs_Bnd_Box_cornerMin(Bnd_Box * box){ 13 | return new gp_Pnt(box->CornerMin()); 14 | } 15 | 16 | gp_Pnt * hs_Bnd_Box_cornerMax(Bnd_Box * box){ 17 | return new gp_Pnt(box->CornerMax()); 18 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Bnd_Box.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BND_BOX_H 2 | #define HS_BND_BOX_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Bnd_Box * hs_new_Bnd_Box(); 11 | 12 | void hs_delete_Bnd_Box(Bnd_Box * box); 13 | 14 | gp_Pnt * hs_Bnd_Box_cornerMin(Bnd_Box * box); 15 | 16 | gp_Pnt * hs_Bnd_Box_cornerMax(Bnd_Box * box); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif // HS_BND_BOX_H 23 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Bnd_OBB.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_Bnd_OBB.h" 3 | 4 | Bnd_OBB * hs_new_Bnd_OBB() { 5 | return new Bnd_OBB(); 6 | } 7 | 8 | void hs_delete_Bnd_OBB(Bnd_OBB * obb){ 9 | delete obb; 10 | } 11 | 12 | gp_XYZ * hs_Bnd_OBB_center(Bnd_OBB * obb){ 13 | return new gp_XYZ(obb->Center()); 14 | } 15 | 16 | gp_XYZ * hs_Bnd_OBB_xDirection(Bnd_OBB * obb){ 17 | return new gp_XYZ(obb->XDirection()); 18 | } 19 | 20 | gp_XYZ * hs_Bnd_OBB_yDirection(Bnd_OBB * obb){ 21 | return new gp_XYZ(obb->YDirection()); 22 | } 23 | 24 | gp_XYZ * hs_Bnd_OBB_zDirection(Bnd_OBB * obb){ 25 | return new gp_XYZ(obb->ZDirection()); 26 | } 27 | 28 | double hs_Bnd_OBB_xHSize(Bnd_OBB *obb){ 29 | return obb->XHSize(); 30 | } 31 | 32 | double hs_Bnd_OBB_yHSize(Bnd_OBB *obb){ 33 | return obb->YHSize(); 34 | } 35 | 36 | double hs_Bnd_OBB_zHSize(Bnd_OBB *obb){ 37 | return obb->ZHSize(); 38 | } 39 | 40 | gp_Ax3 * hs_Bnd_OBB_position(Bnd_OBB *obb){ 41 | return new gp_Ax3(obb->Position()); 42 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Bnd_OBB.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BND_OBB_H 2 | #define HS_BND_OBB_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Bnd_OBB * hs_new_Bnd_OBB(); 11 | 12 | void hs_delete_Bnd_OBB(Bnd_OBB * obb); 13 | 14 | gp_XYZ * hs_Bnd_OBB_center(Bnd_OBB * obb); 15 | 16 | gp_XYZ * hs_Bnd_OBB_xDirection(Bnd_OBB * obb); 17 | 18 | gp_XYZ * hs_Bnd_OBB_yDirection(Bnd_OBB * obb); 19 | 20 | gp_XYZ * hs_Bnd_OBB_zDirection(Bnd_OBB * obb); 21 | 22 | double hs_Bnd_OBB_xHSize(Bnd_OBB *obb); 23 | 24 | double hs_Bnd_OBB_yHSize(Bnd_OBB *obb); 25 | 26 | double hs_Bnd_OBB_zHSize(Bnd_OBB *obb); 27 | 28 | gp_Ax3 * hs_Bnd_OBB_position(Bnd_OBB *obb); 29 | 30 | #ifdef __cplusplus 31 | } 32 | #endif 33 | 34 | #endif // HS_BND_OBB_H 35 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Font_BRepFont.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_FONT_BREPFONT_H 2 | #define HS_FONT_BREPFONT_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Font_BRepFont * hs_new_Font_BRepFont(); 11 | 12 | Font_BRepFont * hs_new_Font_BRepFont_fromStringAndSize(char * path, double size); 13 | 14 | bool hs_Font_BRepFont_initPathAndSize(Font_BRepFont * font, char * path, double size); 15 | 16 | bool hs_Font_BRepFont_initNameAspectAndSize(Font_BRepFont * font, char * name, Font_FontAspect aspect, double size); 17 | 18 | void hs_delete_Font_BRepFont(Font_BRepFont * font); 19 | 20 | double hs_Font_BRepFont_ascender(Font_BRepFont * font); 21 | 22 | double hs_Font_BRepFont_descender(Font_BRepFont * font); 23 | 24 | double hs_Font_BRepFont_lineSpacing(Font_BRepFont * font); 25 | 26 | double hs_Font_BRepFont_pointSize(Font_BRepFont * font); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif // HS_FONT_BREPFONT_H 33 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Font_BRepTextBuilder.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_Font_BRepTextBuilder.h" 3 | 4 | Font_BRepTextBuilder * hs_new_Font_BRepTextBuilder(){ 5 | return new Font_BRepTextBuilder(); 6 | } 7 | 8 | void hs_delete_Font_BRepTextBuilder(Font_BRepTextBuilder * builder){ 9 | delete builder; 10 | } 11 | 12 | TopoDS_Shape * hs_Font_BRepTextBuilder_perform( 13 | Font_BRepTextBuilder * builder, 14 | Font_BRepFont * font, 15 | char * theString, 16 | gp_Ax3 * thePenLoc, 17 | Graphic3d_HorizontalTextAlignment theHAlign, 18 | Graphic3d_VerticalTextAlignment theVAlign 19 | ) { 20 | return new TopoDS_Shape (builder ->Perform(*font, theString, *thePenLoc, theHAlign, theVAlign)); 21 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Font_BRepTextBuilder.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_FONT_BREPTEXTBUILDER_H 2 | #define HS_FONT_BREPTEXTBUILDER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Font_BRepTextBuilder * hs_new_Font_BRepTextBuilder(); 11 | 12 | void hs_delete_Font_BRepTextBuilder(Font_BRepTextBuilder * builder); 13 | 14 | TopoDS_Shape * hs_Font_BRepTextBuilder_perform( 15 | Font_BRepTextBuilder * builder, 16 | Font_BRepFont * font, 17 | char * theString, 18 | gp_Ax3 * thePenLoc, 19 | Graphic3d_HorizontalTextAlignment theHAlign, 20 | Graphic3d_VerticalTextAlignment theVAlign 21 | ); 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif // HS_FONT_BREPFONT_H 27 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GC_MakeArcOfCircle.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_GC_MakeArcOfCircle.h" 3 | 4 | Handle(Geom_TrimmedCurve) * hs_GC_MakeArcOfCircle_from3Pnts(gp_Pnt * a, gp_Pnt * b, gp_Pnt * c){ 5 | return new opencascade::handle(GC_MakeArcOfCircle(*a, *b, *c).Value()); 6 | } 7 | 8 | Handle(Geom_TrimmedCurve) * hs_GC_MakeArcOfCircle_fromPntsAndVec(gp_Pnt * a, gp_Vec * b, gp_Pnt * c){ 9 | return new opencascade::handle(GC_MakeArcOfCircle(*a, *b, *c).Value()); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GC_MakeArcOfCircle.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GC_MAKEARCOFCIRCLE_H 2 | #define HS_GC_MAKEARCOFCIRCLE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Handle(Geom_TrimmedCurve) * hs_GC_MakeArcOfCircle_from3Pnts(gp_Pnt * a, gp_Pnt * b, gp_Pnt * c); 11 | 12 | Handle(Geom_TrimmedCurve) * hs_GC_MakeArcOfCircle_fromPntsAndVec(gp_Pnt * a, gp_Vec * b, gp_Pnt * c); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_GC_MAKEARCOFCIRCLE_H 19 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GC_MakeSegment.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_GC_MakeSegment.h" 3 | 4 | Handle(Geom_TrimmedCurve) * hs_GC_MakeSegment_fromPnts(gp_Pnt* a, gp_Pnt* b){ 5 | return new opencascade::handle(GC_MakeSegment(*a, *b).Value()); 6 | } 7 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GC_MakeSegment.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GC_SEGMENT_H 2 | #define HS_GC_SEGMENT_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Handle(Geom_TrimmedCurve) * hs_GC_MakeSegment_fromPnts(gp_Pnt* a, gp_Pnt* b); 11 | 12 | 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif // HS_GC_MAKESEGMENT_H 18 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GProp_GProps.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_GProp_GProps.h" 3 | 4 | GProp_GProps * hs_new_GProp_GProps(){ 5 | return new GProp_GProps(); 6 | } 7 | 8 | GProp_GProps * hs_new_GProp_GProps_fromSystemLocation(gp_Pnt * pnt){ 9 | return new GProp_GProps(*pnt); 10 | } 11 | 12 | void hs_delete_GProp_GProps(GProp_GProps * props){ 13 | delete props; 14 | } 15 | 16 | double hs_GProp_GProps_mass(GProp_GProps * props){ 17 | return props->Mass(); 18 | } 19 | 20 | gp_Pnt * hs_GProp_GProps_centreOfMass(GProp_GProps * props){ 21 | return new gp_Pnt(props->CentreOfMass()); 22 | } 23 | 24 | double hs_GProp_GProps_momentOfInertia(GProp_GProps * props, gp_Ax1 * ax){ 25 | return props->MomentOfInertia(*ax); 26 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GProp_GProps.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GPROP_GPROPS_H 2 | #define HS_GPROP_GPROPS_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | GProp_GProps * hs_new_GProp_GProps(); 11 | 12 | GProp_GProps * hs_new_GProp_GProps_fromSystemLocation(gp_Pnt * pnt); 13 | 14 | void hs_delete_GProp_GProps(GProp_GProps * props); 15 | 16 | double hs_GProp_GProps_mass(GProp_GProps * props); 17 | 18 | gp_Pnt * hs_GProp_GProps_centreOfMass(GProp_GProps * props); 19 | 20 | double hs_GProp_GProps_momentOfInertia(GProp_GProps * props, gp_Ax1 * ax); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif // HS_GPROP_GPROPS 27 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GeomAdaptor_Curve.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_GeomAdaptor_Curve.h" 3 | 4 | GeomAdaptor_Curve * hs_new_GeomAdaptor_Curve_fromHandle(Handle(Geom_Curve) *curve){ 5 | return new GeomAdaptor_Curve(*curve); 6 | } 7 | 8 | void hs_delete_GeomAdaptor_Curve(GeomAdaptor_Curve * adaptor){ 9 | delete adaptor; 10 | } 11 | 12 | double hs_GeomAdaptor_Curve_firstParameter(GeomAdaptor_Curve * adaptor){ 13 | return adaptor->FirstParameter(); 14 | } 15 | 16 | double hs_GeomAdaptor_Curve_lastParameter(GeomAdaptor_Curve * adaptor){ 17 | return adaptor->LastParameter(); 18 | } 19 | 20 | Handle(Geom_Curve)* hs_GeomAdaptor_Curve_curve(GeomAdaptor_Curve * adaptor){ 21 | return new opencascade::handle(adaptor->Curve()); 22 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GeomAdaptor_Curve.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GEOM_ADAPTOR_CURVE_H 2 | #define HS_GEOM_ADAPTOR_CURVE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | GeomAdaptor_Curve * hs_new_GeomAdaptor_Curve_fromHandle(Handle(Geom_Curve) *curve); 11 | 12 | void hs_delete_GeomAdaptor_Curve(GeomAdaptor_Curve * adaptor); 13 | 14 | double hs_GeomAdaptor_Curve_firstParameter(GeomAdaptor_Curve * adaptor); 15 | 16 | double hs_GeomAdaptor_Curve_lastParameter(GeomAdaptor_Curve * adaptor); 17 | 18 | Handle(Geom_Curve)* hs_GeomAdaptor_Curve_curve(GeomAdaptor_Curve * adaptor); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif // HS_GEOM_ADAPTOR_CURVE_H 25 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GeomConvert_ApproxCurve.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_GeomConvert_ApproxCurve.h" 4 | 5 | GeomConvert_ApproxCurve * hs_new_GeomConvert_ApproxCurve_fromCurveToleranceOrderSegmentsAndDegree( 6 | Handle(Geom_Curve) *curve, 7 | double tolerance, 8 | GeomAbs_Shape order, 9 | int maxSegments, 10 | int maxDegree 11 | ) { 12 | return new GeomConvert_ApproxCurve(*curve, tolerance, order, maxSegments, maxDegree); 13 | } 14 | 15 | void hs_delete_GeomConvert_ApproxCurve(GeomConvert_ApproxCurve * approxCurve){ 16 | delete approxCurve; 17 | } 18 | 19 | Handle(Geom_BSplineCurve) * hs_GeomConvert_ApproxCurve_curve(GeomConvert_ApproxCurve * approxCurve){ 20 | return new opencascade::handle(approxCurve->Curve()); 21 | } 22 | 23 | bool hs_GeomConvert_ApproxCurve_isDone(GeomConvert_ApproxCurve * approxCurve){ 24 | return approxCurve->IsDone(); 25 | } 26 | 27 | bool hs_GeomConvert_ApproxCurve_hasResult(GeomConvert_ApproxCurve * approxCurve){ 28 | return approxCurve->HasResult(); 29 | } 30 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GeomConvert_ApproxCurve.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GEOM_CONVERT_APPROX_CURVE_H 2 | #define HS_GEOM_CONVERT_APPROX_CURVE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | GeomConvert_ApproxCurve * hs_new_GeomConvert_ApproxCurve_fromCurveToleranceOrderSegmentsAndDegree( 11 | Handle(Geom_Curve) *curve, 12 | double tolerance, 13 | GeomAbs_Shape order, 14 | int maxSegments, 15 | int maxDegree 16 | ); 17 | 18 | void hs_delete_GeomConvert_ApproxCurve(GeomConvert_ApproxCurve * approxCurve); 19 | 20 | Handle(Geom_BSplineCurve) * hs_GeomConvert_ApproxCurve_curve(GeomConvert_ApproxCurve * approxCurve); 21 | 22 | bool hs_GeomConvert_ApproxCurve_isDone(GeomConvert_ApproxCurve * approxCurve); 23 | 24 | bool hs_GeomConvert_ApproxCurve_hasResult(GeomConvert_ApproxCurve * approxCurve); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif // HS_GEOM_CONVERT_APPROX_CURVE_H 31 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_GeomConvert_BSplineCurveToBezierCurve.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GEOM_CONVERT_BSPLINE_CURVE_TO_BEZIER_CURVE_H 2 | #define HS_GEOM_CONVERT_BSPLINE_CURVE_TO_BEZIER_CURVE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | GeomConvert_BSplineCurveToBezierCurve * hs_new_GeomConvert_BSplineCurveToBezierCurve_fromHandle (Handle(Geom_BSplineCurve) *basisCurve); 11 | 12 | GeomConvert_BSplineCurveToBezierCurve * hs_new_GeomConvert_BSplineCurveToBezierCurve_fromHandleParametersAndTolerance ( 13 | Handle(Geom_BSplineCurve) *basisCurve, 14 | double firstParameter, 15 | double secondParameter, 16 | double tolerance ); 17 | 18 | void hs_delete_GeomConvert_BSplineCurveToBezierCurve(GeomConvert_BSplineCurveToBezierCurve* ptr); 19 | 20 | int hs_GeomConvert_BSplineCurveToBezierCurve_nbArcs(GeomConvert_BSplineCurveToBezierCurve* ptr); 21 | 22 | Handle(Geom_BezierCurve) * hs_GeomConvert_BSplineCurveToBezierCurve_arc(GeomConvert_BSplineCurveToBezierCurve * ptr, int n); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif // HS_GEOM_CONVERT_BSPLINE_CURVE_TO_BEZIER_CURVE_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Geom_BSplineCurve.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "hs_Geom_BSplineCurve.h" 6 | 7 | Handle(Geom_BSplineCurve) * hs_Geom_BSplineCurve_toHandle(Geom_BSplineCurve * curve){ 8 | return new Handle(Geom_BSplineCurve)(new Geom_BSplineCurve(*curve)); 9 | } 10 | 11 | void hs_delete_Handle_Geom_BSplineCurve(Handle(Geom_BSplineCurve)* h){ 12 | delete h; 13 | } 14 | 15 | void hs_delete_Geom_BSplineCurve(Geom_BSplineCurve * curve){ 16 | delete curve; 17 | } 18 | 19 | int hs_Geom_BSplineCurve_nbPoles(Handle(Geom_BSplineCurve)* h){ 20 | return (*h)->NbPoles(); 21 | } 22 | 23 | gp_Pnt * hs_Geom_BSplineCurve_pole(Handle(Geom_BSplineCurve)* h, int index){ 24 | return new gp_Pnt((*h)->Pole(index)); 25 | } 26 | 27 | bool hs_Geom_BSplineCurve_isRational(Handle(Geom_BSplineCurve) *h) { 28 | return (*h)->IsRational(); 29 | } 30 | 31 | void hs_Geom_BSplineCurve_segment(Handle(Geom_BSplineCurve) *h, double u1, double u2, double confusion){ 32 | (*h)->Segment(u1, u2, confusion); 33 | } 34 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Geom_BSplineCurve.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HS_GEOM_BSPLINECURVE_H 3 | #define HS_GEOM_BSPLINECURVE_H 4 | 5 | #include "hs_types.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | Handle(Geom_BSplineCurve) * hs_Geom_BSplineCurve_toHandle(Geom_BSplineCurve * curve); 12 | 13 | void hs_delete_Handle_Geom_BSplineCurve(Handle(Geom_BSplineCurve)* h); 14 | 15 | void hs_delete_Geom_BSplineCurve(Geom_BSplineCurve * curve); 16 | 17 | int hs_Geom_BSplineCurve_nbPoles(Handle(Geom_BSplineCurve)* h); 18 | 19 | gp_Pnt * hs_Geom_BSplineCurve_pole(Handle(Geom_BSplineCurve)* h, int index); 20 | 21 | bool hs_Geom_BSplineCurve_isRational(Handle(Geom_BSplineCurve) *h); 22 | 23 | void hs_Geom_BSplineCurve_segment(Handle(Geom_BSplineCurve) *h, double u1, double u2, double confusion); 24 | 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif // HS_GEOM_BSPLINECURVE_H 31 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Geom_BezierCurve.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GEOM_BEZIERCURVE_H 2 | #define HS_GEOM_BEZIERCURVE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Geom_BezierCurve * hs_new_Geom_BezierCurve_fromPnts(ARRAY_1(gp_Pnt) * pnts); 11 | 12 | Handle(Geom_BezierCurve) * hs_Geom_BezierCurve_toHandle(Geom_BezierCurve * curve); 13 | 14 | int hs_Geom_BezierCurve_nbPoles(Handle(Geom_BezierCurve)* h); 15 | 16 | gp_Pnt * hs_Geom_BezierCurve_pole(Handle(Geom_BezierCurve)* h, int index); 17 | 18 | bool hs_Geom_BezierCurve_isRational(Handle(Geom_BezierCurve) *h); 19 | 20 | void hs_delete_Handle_Geom_BezierCurve(Handle(Geom_BezierCurve)* h); 21 | 22 | void hs_delete_Geom_BezierCurve(Geom_BezierCurve * curve); 23 | 24 | void hs_Geom_BezierCurve_segment(Handle(Geom_BezierCurve) *h, double u1, double u2); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif // HS_GEOM_BEZIERCURVE_H 31 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Geom_Curve.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "hs_Geom_Curve.h" 6 | 7 | void hs_delete_Handle_Geom_Curve(Handle(Geom_Curve) * handle){ 8 | delete handle; 9 | } 10 | 11 | gp_Pnt * hs_Geom_Curve_value(Handle(Geom_Curve) * curve, double u){ 12 | return new gp_Pnt((*curve)->Value(u)); 13 | } 14 | 15 | double hs_Geom_Curve_firstParameter(Handle(Geom_Curve) * curve){ 16 | return (*curve)->FirstParameter(); 17 | } 18 | 19 | double hs_Geom_Curve_lastParameter(Handle(Geom_Curve) * curve){ 20 | return (*curve)->LastParameter(); 21 | } 22 | 23 | gp_Vec * hs_Geom_Curve_dn(Handle (Geom_Curve) * curve, double u, int n){ 24 | return new gp_Vec((*curve)->DN(u, n)); 25 | } 26 | 27 | double hs_Geom_Curve_reversedParameter(Handle (Geom_Curve) * curve, double parameter){ 28 | return (*curve)->ReversedParameter(parameter); 29 | } 30 | 31 | Handle (Geom_Curve) * hs_Geom_Curve_reversed(Handle (Geom_Curve) * curve){ 32 | return new opencascade::handle((*curve)->Reversed()); 33 | } 34 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Geom_Curve.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GEOM_CURVE_H 2 | #define HS_GEOM_CURVE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | void hs_delete_Handle_Geom_Curve(Handle(Geom_Curve) * handle); 10 | 11 | gp_Pnt * hs_Geom_Curve_value(Handle(Geom_Curve) * curve, double u); 12 | 13 | double hs_Geom_Curve_firstParameter(Handle(Geom_Curve) * curve); 14 | 15 | double hs_Geom_Curve_lastParameter(Handle(Geom_Curve) * curve); 16 | 17 | gp_Vec * hs_Geom_Curve_dn(Handle (Geom_Curve) * curve, double u, int n); 18 | 19 | double hs_Geom_Curve_reversedParameter(Handle (Geom_Curve) * curve, double parameter); 20 | 21 | Handle (Geom_Curve) * hs_Geom_Curve_reversed(Handle (Geom_Curve) * curve); 22 | 23 | #ifdef __cplusplus 24 | } 25 | #endif 26 | 27 | #endif // HS_GEOM_CURVE_H 28 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Geom_TrimmedCurve.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_Geom_TrimmedCurve.h" 3 | 4 | void hs_delete_Handle_Geom_TrimmedCurve(Handle(Geom_TrimmedCurve)* h){ 5 | delete h; 6 | } 7 | 8 | 9 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Geom_TrimmedCurve.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GEOM_TRIMMED_CURVE_H 2 | #define HS_GEOM_TRIMMED_CURVE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void hs_delete_Handle_Geom_TrimmedCurve(Handle(Geom_TrimmedCurve)* h); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_GEOM_TRIMMED_CURVE_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_HLRAlgo_Projector.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_HLRAlgo_Projector.h" 3 | 4 | HLRAlgo_Projector * hs_new_HLRAlgo_Projector_fromAx2(gp_Ax2* axis){ 5 | return new HLRAlgo_Projector(*axis); 6 | } 7 | 8 | void hs_delete_HLRAlgo_Projector(HLRAlgo_Projector* projector){ 9 | delete projector; 10 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_HLRAlgo_Projector.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_HLR_ALGO_PROJECTOR_H 2 | #define HS_HLR_ALGO_PROJECTOR_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | HLRAlgo_Projector * hs_new_HLRAlgo_Projector_fromAx2(gp_Ax2* axis); 11 | 12 | void hs_delete_HLRAlgo_Projector(HLRAlgo_Projector* projector); 13 | #ifdef __cplusplus 14 | } 15 | #endif 16 | 17 | #endif // HS_HLR_ALGO_PROJECTOR_H 18 | 19 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_HLRBRep_Algo.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_HLRBRep_Algo.h" 3 | #include 4 | 5 | Handle(HLRBRep_Algo) * hs_new_HLRBRep_Algo(){ 6 | return new Handle(HLRBRep_Algo)(new HLRBRep_Algo()); 7 | } 8 | 9 | void hs_delete_HLRBRep_Algo(Handle(HLRBRep_Algo) * algo){ 10 | delete algo; 11 | } 12 | 13 | void hs_HLRBRep_Algo_projector(Handle(HLRBRep_Algo) * algo, HLRAlgo_Projector * projector){ 14 | (*algo)->Projector(*projector); 15 | } 16 | 17 | void hs_HLRBRep_Algo_update(Handle(HLRBRep_Algo) * algo){ 18 | (*algo)->Update(); 19 | } 20 | 21 | void hs_HLRBRep_Algo_hide(Handle(HLRBRep_Algo) * algo){ 22 | (*algo)->Hide(); 23 | } 24 | 25 | void hs_HLRBRep_Algo_add(Handle(HLRBRep_Algo) * algo, TopoDS_Shape * shape){ 26 | (*algo)->Add(*shape); 27 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_HLRBRep_Algo.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_HLRBREP_ALGO_H 2 | #define HS_HLRBREP_ALGO_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Handle(HLRBRep_Algo) * hs_new_HLRBRep_Algo(); 11 | 12 | void hs_delete_HLRBRep_Algo(Handle(HLRBRep_Algo) * algo); 13 | 14 | void hs_HLRBRep_Algo_projector(Handle(HLRBRep_Algo) * algo, HLRAlgo_Projector * projector); 15 | 16 | void hs_HLRBRep_Algo_update(Handle(HLRBRep_Algo) * algo); 17 | 18 | void hs_HLRBRep_Algo_hide(Handle(HLRBRep_Algo) * algo); 19 | 20 | void hs_HLRBRep_Algo_add(Handle(HLRBRep_Algo) * algo, TopoDS_Shape * shape); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif // HS_HLRBREP_ALGO_H 27 | 28 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_HLRBRep_HLRToShape.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_HLRBRep_HLRToShape.h" 3 | 4 | HLRBRep_HLRToShape * hs_new_HLRBRep_HLRToShape_fromHandleAlgo(Handle(HLRBRep_Algo) * algo){ 5 | return new HLRBRep_HLRToShape(*algo); 6 | } 7 | 8 | void hs_delete_HLRBRep_HLRToShape(HLRBRep_HLRToShape *hlrToShape){ 9 | delete hlrToShape; 10 | } 11 | 12 | TopoDS_Shape * hs_HLRBRep_HLRToShape_compoundOfEdges(HLRBRep_HLRToShape * toShape, HLRBRep_TypeOfResultingEdge edgeType, bool visible, bool in3d){ 13 | return new TopoDS_Shape(toShape->CompoundOfEdges(edgeType, visible, in3d)); 14 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_HLRBRep_HLRToShape.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_HLRBREP_HLRTOSHAPE_H 2 | #define HS_HLRBREP_HLRTOSHAPE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | HLRBRep_HLRToShape * hs_new_HLRBRep_HLRToShape_fromHandleAlgo(Handle(HLRBRep_Algo) * algo); 11 | 12 | void hs_delete_HLRBRep_HLRToShape(HLRBRep_HLRToShape *hlrToShape); 13 | 14 | TopoDS_Shape * hs_HLRBRep_HLRToShape_compoundOfEdges(HLRBRep_HLRToShape * toShape, HLRBRep_TypeOfResultingEdge edgeType, bool visible, bool in3d); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_HLRBREP_HLRTOSHAPE_H 21 | 22 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Message_ProgressRange.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_Message_ProgressRange.h" 3 | 4 | Message_ProgressRange * hs_new_Message_ProgressRange(){ 5 | return new Message_ProgressRange(); 6 | } 7 | 8 | void hs_delete_Message_ProgressRange(Message_ProgressRange * theRange){ 9 | delete theRange; 10 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Message_ProgressRange.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_MESSAGE_PROGRESSRANGE_H 2 | #define HS_MESSAGE_PROGRESSRANGE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Message_ProgressRange * hs_new_Message_ProgressRange(); 11 | 12 | void hs_delete_Message_ProgressRange(Message_ProgressRange * theRange); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_MESSAGE_PROGRESSRANGE_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_NCollection_Array1.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_NCollection_Array1.h" 4 | 5 | ARRAY_1(gp_Pnt) * hs_new_NCollection_Array1_gp_Pnt(int lower, int upper){ 6 | return new NCollection_Array1(lower, upper); 7 | } 8 | 9 | void hs_NCollection_Array1_gp_Pnt_setValue(ARRAY_1(gp_Pnt) * arr, int index, gp_Pnt * value){ 10 | arr->SetValue(index, *value); 11 | } 12 | 13 | void hs_delete_NCollection_Array1_gp_Pnt(ARRAY_1(gp_Pnt) * arr){ 14 | delete arr; 15 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_NCollection_Array1.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_NCOLLECTION_ARRAY1_H 2 | #define HS_NCOLLECTION_ARRAY1_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | ARRAY_1(gp_Pnt) * hs_new_NCollection_Array1_gp_Pnt(int lower, int upper); 11 | 12 | void hs_NCollection_Array1_gp_Pnt_setValue(ARRAY_1(gp_Pnt) * arr, int index, gp_Pnt * value); 13 | 14 | void hs_delete_NCollection_Array1_gp_Pnt(ARRAY_1(gp_Pnt) * arr); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_NCOLLECTION_ARRAY1_H 21 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Poly_Triangle.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_Poly_Triangle.h" 3 | 4 | Poly_Triangle * hs_new_Poly_Triangle_fromIndices(int n1, int n2, int n3){ 5 | return new Poly_Triangle(n1, n2, n3); 6 | } 7 | 8 | void hs_delete_Poly_Triangle(Poly_Triangle * triangle){ 9 | delete triangle; 10 | } 11 | 12 | int hs_Poly_Triangle_value(Poly_Triangle * triangle, int index){ 13 | return triangle->Value(index); 14 | } 15 | 16 | void hs_Poly_Triangle_setValue(Poly_Triangle * triangle, int index, int node){ 17 | triangle->Set(index, node); 18 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Poly_Triangle.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_POLY_TRIANGLE_H 2 | #define HS_POLY_TRIANGLE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Poly_Triangle * hs_new_Poly_Triangle_fromIndices(int n1, int n2, int n3); 11 | 12 | void hs_delete_Poly_Triangle(Poly_Triangle * triangle); 13 | 14 | int hs_Poly_Triangle_value(Poly_Triangle * triangle, int index); 15 | 16 | void hs_Poly_Triangle_setValue(Poly_Triangle * triangle, int index, int node); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif // HS_POLY_TRIANGLE_H 23 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_Poly_Triangulation.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_POLY_TRIANGULATION_H 2 | #define HS_POLY_TRIANGULATION_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Handle(Poly_Triangulation) * hs_new_Poly_Triangulation(int nbNodes, int nbTriangles, bool hasUVNodes, bool hasNormals); 11 | 12 | void hs_delete_Poly_Triangulation(Handle(Poly_Triangulation) * triangulation); 13 | 14 | int hs_Poly_Triangulation_nbNodes(Handle(Poly_Triangulation) * triangulation); 15 | 16 | int hs_Poly_Triangulation_nbTriangles(Handle(Poly_Triangulation) * triangulation); 17 | 18 | gp_Pnt * hs_Poly_Triangulation_node(Handle(Poly_Triangulation) * triangulation, int index); 19 | 20 | void hs_Poly_Triangulation_setNode(Handle(Poly_Triangulation) * triangulation, int index, gp_Pnt * pnt); 21 | 22 | Poly_Triangle * hs_Poly_Triangulation_triangle(Handle(Poly_Triangulation) * triangulation, int index); 23 | 24 | void hs_Poly_Triangulation_setTriangle(Handle(Poly_Triangulation) * triangulation, int index, Poly_Triangle * triangle); 25 | 26 | #ifdef __cplusplus 27 | } 28 | #endif 29 | 30 | #endif // HS_POLY_TRIANGULATION_H 31 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWGltf_CafReader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_RWGltf_CafReader.h" 3 | 4 | RWGltf_CafReader * hs_new_RWGltf_CafReader(void){ 5 | return new RWGltf_CafReader(); 6 | } 7 | 8 | void hs_RWGltf_CafReader_setDoublePrecision(RWGltf_CafReader *reader, bool isDouble){ 9 | reader->SetDoublePrecision(isDouble); 10 | } 11 | 12 | void hs_delete_RWGltf_CafReader(RWGltf_CafReader *reader){ 13 | delete reader; 14 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWGltf_CafReader.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_RWGLTF_CAFREADER_H 2 | #define HS_RWGLTF_CAFREADER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | RWGltf_CafReader * hs_new_RWGltf_CafReader(void); 11 | 12 | void hs_RWGltf_CafReader_setDoublePrecision(RWGltf_CafReader *reader, bool isDouble); 13 | 14 | void hs_delete_RWGltf_CafReader(RWGltf_CafReader *reader); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_RWGLTF_CAFREADER_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWGltf_CafWriter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_RWGltf_CafWriter.h" 3 | 4 | RWGltf_CafWriter * hs_new_RWGltf_CafWriter(char * theFile, bool isBinary){ 5 | return new RWGltf_CafWriter(theFile, isBinary); 6 | } 7 | 8 | void hs_delete_RWGltf_CafWriter(RWGltf_CafWriter * theWriter){ 9 | delete theWriter; 10 | } 11 | 12 | void hs_RWGltf_CafWriter_Perform(RWGltf_CafWriter * theWriter, Handle(TDocStd_Document) * theDocument, TColStd_IndexedDataMapOfStringString * theFileInfo, Message_ProgressRange * theProgress){ 13 | theWriter->Perform(*theDocument, *theFileInfo, *theProgress); 14 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWGltf_CafWriter.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_RWGLTF_CAFWRITER_H 2 | #define HS_RWGLTF_CAFWRITER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | RWGltf_CafWriter * hs_new_RWGltf_CafWriter(char * theFile, bool isBinary); 11 | 12 | void hs_delete_RWGltf_CafWriter(RWGltf_CafWriter * theWriter); 13 | 14 | void hs_RWGltf_CafWriter_Perform(RWGltf_CafWriter * theWriter, Handle(TDocStd_Document) * theDocument, TColStd_IndexedDataMapOfStringString * theFileInfo, Message_ProgressRange * theProgress); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_RWGLTF_CAFWRITER_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWMesh_CafReader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_RWMesh_CafReader.h" 3 | 4 | void hs_RWMesh_CafReader_setDocument(RWMesh_CafReader * reader, Handle(TDocStd_Document) * document){ 5 | reader->SetDocument(*document); 6 | } 7 | 8 | void hs_RWMesh_CafReader_setFileLengthUnit(RWMesh_CafReader * reader, double scale){ 9 | reader->SetFileLengthUnit(scale); 10 | } 11 | 12 | TopoDS_Shape * hs_RWMesh_CafReader_singleShape(RWMesh_CafReader * reader){ 13 | return new TopoDS_Shape(reader->SingleShape()); 14 | } 15 | 16 | bool hs_RWMesh_CafReader_perform(RWMesh_CafReader * reader, char * filename, Message_ProgressRange * progress){ 17 | return reader->Perform(filename, *progress); 18 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWMesh_CafReader.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_RWMESH_CAFREADER_H 2 | #define HS_RWMESH_CAFREADER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void hs_RWMesh_CafReader_setDocument(RWMesh_CafReader * reader, Handle(TDocStd_Document) * document); 11 | 12 | void hs_RWMesh_CafReader_setFileLengthUnit(RWMesh_CafReader * reader, double scale); 13 | 14 | TopoDS_Shape * hs_RWMesh_CafReader_singleShape(RWMesh_CafReader * reader); 15 | 16 | bool hs_RWMesh_CafReader_perform(RWMesh_CafReader * reader, char * filename, Message_ProgressRange * progress); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif // HS_RWMESH_CAFREADER_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWObj_CafReader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_RWObj_CafReader.h" 3 | 4 | RWObj_CafReader * hs_new_RWObj_CafReader(void){ 5 | return new RWObj_CafReader(); 6 | } 7 | 8 | void hs_RWObj_CafReader_setSinglePrecision(RWObj_CafReader *reader, bool isSingle){ 9 | reader->SetSinglePrecision(isSingle); 10 | } 11 | 12 | void hs_delete_RWObj_CafReader(RWObj_CafReader *reader){ 13 | delete reader; 14 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWObj_CafReader.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_RWOBJ_CAFREADER_H 2 | #define HS_RWOBJ_CAFREADER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | RWObj_CafReader * hs_new_RWObj_CafReader(void); 11 | 12 | void hs_RWObj_CafReader_setSinglePrecision(RWObj_CafReader *reader, bool isSingle); 13 | 14 | void hs_delete_RWObj_CafReader(RWObj_CafReader *reader); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_RWOBJ_CAFREADER_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWObj_CafWriter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_RWObj_CafWriter.h" 3 | 4 | RWObj_CafWriter * hs_new_RWObj_CafWriter(char * filename){ 5 | return new RWObj_CafWriter(filename); 6 | } 7 | 8 | void hs_delete_RWObj_CafWriter(RWObj_CafWriter * writer){ 9 | delete writer; 10 | } 11 | 12 | void hs_RWObj_CafWriter_Perform(RWObj_CafWriter * theWriter, Handle(TDocStd_Document) * theDocument, TColStd_IndexedDataMapOfStringString * theFileInfo, Message_ProgressRange * theProgress){ 13 | theWriter->Perform(*theDocument, *theFileInfo, *theProgress); 14 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_RWObj_CafWriter.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_RWOBJ_CAFWRITER_H 2 | #define HS_RWOBJ_CAFWRITER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | RWObj_CafWriter * hs_new_RWObj_CafWriter(char * theFile); 11 | 12 | void hs_delete_RWObj_CafWriter(RWObj_CafWriter * theWriter); 13 | 14 | void hs_RWObj_CafWriter_Perform(RWObj_CafWriter * theWriter, Handle(TDocStd_Document) * theDocument, TColStd_IndexedDataMapOfStringString * theFileInfo, Message_ProgressRange * theProgress); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_RWOBJ_CAFWRITER_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_STEPControl_Reader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_STEPControl_Reader.h" 3 | 4 | STEPControl_Reader * hs_new_STEPControl_Reader(void){ 5 | return new STEPControl_Reader(); 6 | } 7 | 8 | void hs_delete_STEPControl_Reader(STEPControl_Reader * reader){ 9 | delete reader; 10 | } 11 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_STEPControl_Reader.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_STEPCONTROL_READER_H 2 | #define HS_STEPCONTROL_READER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | STEPControl_Reader * hs_new_STEPControl_Reader(void); 11 | 12 | void hs_delete_STEPControl_Reader(STEPControl_Reader * reader); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_STEPCONTROL_READER_H 19 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_STEPControl_Writer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_STEPControl_Writer.h" 3 | 4 | STEPControl_Writer * hs_new_STEPControl_Writer(){ 5 | return new STEPControl_Writer(); 6 | } 7 | 8 | void hs_delete_STEPControl_Writer(STEPControl_Writer * writer){ 9 | delete writer; 10 | } 11 | 12 | void hs_STEPControl_Writer_setTolerance(STEPControl_Writer * writer, double tolerance){ 13 | writer->SetTolerance(tolerance); 14 | } 15 | 16 | void hs_STEPControl_Writer_unsetTolerance(STEPControl_Writer * writer){ 17 | writer->UnsetTolerance(); 18 | } 19 | 20 | IFSelect_ReturnStatus hs_STEPControl_Writer_transfer(STEPControl_Writer * writer, TopoDS_Shape * shape, STEPControl_StepModelType mode, bool compgraph){ 21 | return writer->Transfer(*shape, mode, compgraph); 22 | } 23 | 24 | IFSelect_ReturnStatus hs_STEPControl_Writer_write(STEPControl_Writer* writer, char* filename){ 25 | return writer->Write(filename); 26 | } 27 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_STEPControl_Writer.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_STEPCONTROL_WRITER_H 2 | #define HS_STEPCONTROL_WRITER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | STEPControl_Writer * hs_new_STEPControl_Writer(); 11 | 12 | void hs_delete_STEPControl_Writer(STEPControl_Writer * writer); 13 | 14 | void hs_STEPControl_Writer_setTolerance(STEPControl_Writer * writer, double tolerance); 15 | 16 | void hs_STEPControl_Writer_unsetTolerance(STEPControl_Writer * writer); 17 | 18 | IFSelect_ReturnStatus hs_STEPControl_Writer_transfer(STEPControl_Writer * writer, TopoDS_Shape * shape, STEPControl_StepModelType mode, bool compgraph); 19 | 20 | IFSelect_ReturnStatus hs_STEPControl_Writer_write(STEPControl_Writer* writer, char* filename); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif // HS_STEPCONTROL_WRITER_H 27 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_ShapeConstruct_Curve.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_ShapeConstruct_Curve.h" 4 | 5 | ShapeConstruct_Curve * hs_new_ShapeConstruct_Curve(){ 6 | return new ShapeConstruct_Curve(); 7 | } 8 | 9 | void hs_delete_ShapeConstruct_Curve(ShapeConstruct_Curve* shapeConstruct){ 10 | delete shapeConstruct; 11 | } 12 | 13 | Handle(Geom_BSplineCurve) * hs_ShapeConstruct_Curve_convertToBSpline( 14 | ShapeConstruct_Curve* shapeConstruct, 15 | Handle(Geom_Curve)* curve, 16 | double first, 17 | double last, 18 | double precision 19 | ){ 20 | return new opencascade::handle(shapeConstruct->ConvertToBSpline(*curve, first, last, precision)); 21 | } 22 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_ShapeConstruct_Curve.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_SHAPECONSTRUCT_CURVE_H 2 | #define HS_SHAPECONSTRUCT_CURVE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | ShapeConstruct_Curve * hs_new_ShapeConstruct_Curve(); 11 | 12 | void hs_delete_ShapeConstruct_Curve(ShapeConstruct_Curve* shapeConstruct); 13 | 14 | Handle(Geom_BSplineCurve) * hs_ShapeConstruct_Curve_convertToBSpline( 15 | ShapeConstruct_Curve* shapeConstruct, 16 | Handle(Geom_Curve)* curve, 17 | double first, 18 | double last, 19 | double precision 20 | ); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif // HS_SHAPECONSTRUCT_CURVE_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_ShapeExtend_WireData.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_ShapeExtend_WireData.h" 3 | 4 | #include 5 | 6 | ShapeExtend_WireData * hs_new_ShapeExtend_WireData_fromWireChainedAndManifold(TopoDS_Wire* wire, bool chained, bool manifoldMode){ 7 | return new ShapeExtend_WireData(*wire, chained, manifoldMode); 8 | } 9 | 10 | void hs_delete_ShapeExtend_WireData(ShapeExtend_WireData * wireData){ 11 | delete wireData; 12 | } 13 | 14 | void hs_ShapeExtend_WireData_reverse(ShapeExtend_WireData * wireData){ 15 | wireData->Reverse(); 16 | } 17 | 18 | TopoDS_Wire * hs_ShapeExtend_WireData_wire(ShapeExtend_WireData * wireData){ 19 | return new TopoDS_Wire(wireData->Wire()); 20 | } 21 | 22 | 23 | TopoDS_Wire * hs_ShapeExtend_WireData_wireAPIMake(ShapeExtend_WireData * wireData){ 24 | return new TopoDS_Wire(wireData->WireAPIMake()); 25 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_ShapeExtend_WireData.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_SHAPEEXTEND_WIREDATA_H 2 | #define HS_SHAPEEXTEND_WIREDATA_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | ShapeExtend_WireData * hs_new_ShapeExtend_WireData_fromWireChainedAndManifold(TopoDS_Wire* wire, bool chained, bool manifoldMode); 11 | 12 | void hs_delete_ShapeExtend_WireData(ShapeExtend_WireData * wireData); 13 | 14 | void hs_ShapeExtend_WireData_reverse(ShapeExtend_WireData * wireData); 15 | 16 | TopoDS_Wire * hs_ShapeExtend_WireData_wire(ShapeExtend_WireData * wireData); 17 | 18 | TopoDS_Wire * hs_ShapeExtend_WireData_wireAPIMake(ShapeExtend_WireData * wireData); 19 | 20 | #ifdef __cplusplus 21 | } 22 | #endif 23 | 24 | #endif // HS_SHAPEEXTEND_WIREDATA_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_ShapeFix_Solid.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "hs_ShapeFix_Solid.h" 5 | 6 | ShapeFix_Solid * hs_new_ShapeFix_Solid(){ 7 | return new ShapeFix_Solid(); 8 | } 9 | 10 | ShapeFix_Solid * hs_new_ShapeFix_Solid_fromSolid(TopoDS_Solid * solid){ 11 | return new ShapeFix_Solid(*solid); 12 | } 13 | 14 | void hs_delete_ShapeFix_Solid(ShapeFix_Solid * shapeFix){ 15 | delete shapeFix; 16 | } 17 | 18 | TopoDS_Solid * hs_ShapeFix_Solid_solidFromShell(ShapeFix_Solid * shapeFix, TopoDS_Shell * shell){ 19 | return new TopoDS_Solid(shapeFix->SolidFromShell(*shell)); 20 | } 21 | 22 | bool hs_ShapeFix_Solid_perform(ShapeFix_Solid * shapeFix, Message_ProgressRange * progress){ 23 | return shapeFix->Perform(*progress); 24 | } 25 | 26 | TopoDS_Shape * hs_ShapeFix_Solid_solid(ShapeFix_Solid * shapeFix){ 27 | return new TopoDS_Shape(shapeFix->Solid()); 28 | } 29 | 30 | bool hs_ShapeFix_Solid_status(ShapeFix_Solid * shapeFix, ShapeExtend_Status status){ 31 | return shapeFix->Status(status); 32 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_ShapeFix_Solid.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_SHAPEFIX_SOLID_H 2 | #define HS_SHAPEFIX_SOLID_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | ShapeFix_Solid * hs_new_ShapeFix_Solid(); 11 | 12 | ShapeFix_Solid * hs_new_ShapeFix_Solid_fromSolid(TopoDS_Solid * solid); 13 | 14 | void hs_delete_ShapeFix_Solid(ShapeFix_Solid * shapeFix); 15 | 16 | TopoDS_Solid * hs_ShapeFix_Solid_solidFromShell(ShapeFix_Solid * shapeFix, TopoDS_Shell * shell); 17 | 18 | bool hs_ShapeFix_Solid_perform(ShapeFix_Solid * shapeFix, Message_ProgressRange * progress); 19 | 20 | TopoDS_Shape * hs_ShapeFix_Solid_solid(ShapeFix_Solid * shapeFix); 21 | 22 | bool hs_ShapeFix_Solid_status(ShapeFix_Solid * shapeFix, ShapeExtend_Status status); 23 | 24 | #ifdef __cplusplus 25 | } 26 | #endif 27 | 28 | #endif // HS_SHAPEFIX_SOLID_H 29 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_StlAPI_Reader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_StlAPI_Writer.h" 3 | 4 | StlAPI_Writer * hs_new_StlAPI_Writer(){ 5 | return new StlAPI_Writer(); 6 | } 7 | 8 | void hs_delete_StlAPI_Writer(StlAPI_Writer * writer){ 9 | delete writer; 10 | } 11 | 12 | void hs_StlAPI_Writer_setAsciiMode(StlAPI_Writer * writer, bool asciiMode){ 13 | writer->ASCIIMode() = asciiMode; 14 | } 15 | 16 | bool hs_StlAPI_Writer_write(StlAPI_Writer * writer, TopoDS_Shape * shape, char* filename){ 17 | return writer->Write(*shape, filename); 18 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_StlAPI_Reader.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HS_STLAPI_READER_H 3 | #define HS_STLAPI_READER_H 4 | 5 | #include "hs_types.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | 12 | StlAPI_Reader * hs_new_StlAPI_Reader(); 13 | 14 | void hs_delete_StlAPI_Reader(StlAPI_Reader * reader); 15 | 16 | bool hs_StlAPI_Reader_read(StlAPI_Reader * reader, TopoDS_Shape * shape, char* filename); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif // HS_STLAPI_READER_H 23 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_StlAPI_Writer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_StlAPI_Reader.h" 3 | 4 | StlAPI_Reader * hs_new_StlAPI_Reader(){ 5 | return new StlAPI_Reader(); 6 | } 7 | 8 | void hs_delete_StlAPI_Reader(StlAPI_Reader * reader){ 9 | delete reader; 10 | } 11 | 12 | bool hs_StlAPI_Reader_read(StlAPI_Reader * reader, TopoDS_Shape * shape, char* filename){ 13 | return reader->Read(*shape, filename); 14 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_StlAPI_Writer.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef HS_STLAPI_WRITER_H 3 | #define HS_STLAPI_WRITER_H 4 | 5 | #include "hs_types.h" 6 | 7 | #ifdef __cplusplus 8 | extern "C" { 9 | #endif 10 | 11 | StlAPI_Writer * hs_new_StlAPI_Writer(); 12 | 13 | void hs_delete_StlAPI_Writer(StlAPI_Writer * writer); 14 | 15 | void hs_StlAPI_Writer_setAsciiMode(StlAPI_Writer * writer, bool asciiMode); 16 | 17 | bool hs_StlAPI_Writer_write(StlAPI_Writer * writer, TopoDS_Shape * shape, char* filename); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif // HS_STLAPI_WRITER_H 24 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TColStd_IndexedDataMapOfStringString.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TColStd_IndexedDataMapOfStringString.h" 3 | 4 | TColStd_IndexedDataMapOfStringString * hs_new_TColStd_IndexedDataMapOfStringString(){ 5 | return new TColStd_IndexedDataMapOfStringString(); 6 | } 7 | 8 | void hs_delete_TColStd_IndexedDataMapOfStringString(TColStd_IndexedDataMapOfStringString * theMap){ 9 | delete theMap; 10 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TColStd_IndexedDataMapOfStringString.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TCOLSTD_INDEXEDDATAMAPOFSTRINGSTRING_H 2 | #define HS_TCOLSTD_INDEXEDDATAMAPOFSTRINGSTRING_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TColStd_IndexedDataMapOfStringString * hs_new_TColStd_IndexedDataMapOfStringString(); 11 | 12 | void hs_delete_TColStd_IndexedDataMapOfStringString(TColStd_IndexedDataMapOfStringString * theMap); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_TCOLSTD_INDEXEDDATAMAPOFSTRINGSTRING_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TDF_Label.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TDF_Label.h" 3 | 4 | void hs_delete_TDF_Label(TDF_Label * theLabel){ 5 | delete theLabel; 6 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TDF_Label.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TDF_LABEL_H 2 | #define HS_TDF_LABEL_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void hs_delete_TDF_Label(TDF_Label * theLabel); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_TDF_LABEL_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TDocStd_Document.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "hs_TDocStd_Document.h" 4 | 5 | Handle(TDocStd_Document) * hs_new_TDocStd_Document(char * storageFormat){ 6 | return new opencascade::handle(new TDocStd_Document(storageFormat)); 7 | } 8 | 9 | void hs_delete_TDocStd_Document(Handle(TDocStd_Document) * theDocument){ 10 | delete theDocument; 11 | } 12 | 13 | TDF_Label * hs_TDocStd_Document_main(Handle(TDocStd_Document) *theDocument){ 14 | return new TDF_Label(theDocument->get()->Main()); 15 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TDocStd_Document.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TDOCSTD_DOCUMENT_H 2 | #define HS_TDOCSTD_DOCUMENT_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Handle(TDocStd_Document) * hs_new_TDocStd_Document(char * storageFormat); 11 | 12 | void hs_delete_TDocStd_Document(Handle(TDocStd_Document) * theDocument); 13 | 14 | TDF_Label * hs_TDocStd_Document_main(Handle(TDocStd_Document) *theDocument); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_TDOCSTD_DOCUMENT_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopExp_Explorer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopExp_Explorer.h" 3 | 4 | TopExp_Explorer * hs_new_TopExp_Explorer(TopoDS_Shape * shape, TopAbs_ShapeEnum toFind){ 5 | return new TopExp_Explorer(*shape, toFind); 6 | } 7 | 8 | void hs_delete_TopExp_Explorer(TopExp_Explorer * explorer){ 9 | delete explorer; 10 | } 11 | 12 | bool hs_TopExp_Explorer_more(TopExp_Explorer * explorer){ 13 | return explorer->More(); 14 | } 15 | 16 | void hs_TopExp_Explorer_next(TopExp_Explorer * explorer){ 17 | return explorer->Next(); 18 | } 19 | 20 | TopoDS_Shape * hs_TopExp_Explorer_value(TopExp_Explorer * explorer){ 21 | return (TopoDS_Shape *) &(explorer->Value()); 22 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopExp_Explorer.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_BREPFILLETAPI_MAKEFILLET_H 2 | #define HS_BREPFILLETAPI_MAKEFILLET_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopExp_Explorer * hs_new_TopExp_Explorer(TopoDS_Shape * shape, TopAbs_ShapeEnum toFind); 11 | 12 | void hs_delete_TopExp_Explorer(TopExp_Explorer * explorer); 13 | 14 | bool hs_TopExp_Explorer_more(TopExp_Explorer * explorer); 15 | 16 | void hs_TopExp_Explorer_next(TopExp_Explorer * explorer); 17 | 18 | TopoDS_Shape * hs_TopExp_Explorer_value(TopExp_Explorer * explorer); 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif // HS_TOPEXP_EXPLORER_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopTools_ShapeMapHasher.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopTools_ShapeMapHasher.h" 3 | 4 | int hs_TopTools_ShapeMapHasher_hash(TopoDS_Shape * shape){ 5 | auto hasher = TopTools_ShapeMapHasher(); 6 | return hasher(*shape); 7 | } 8 | 9 | bool hs_TopTools_ShapeMapHasher_isEqual(TopoDS_Shape * shapeA, TopoDS_Shape * shapeB){ 10 | auto hasher = TopTools_ShapeMapHasher(); 11 | return hasher(*shapeA, *shapeB); 12 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopTools_ShapeMapHasher.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPTOOLS_SHAPEMAPHASHER_H 2 | #define HS_TOPTOOLS_SHAPEMAPHASHER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | int hs_TopTools_ShapeMapHasher_hash(TopoDS_Shape * shape); 11 | 12 | bool hs_TopTools_ShapeMapHasher_isEqual(TopoDS_Shape * shapeA, TopoDS_Shape * shapeB); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_TOPTOOLS_SHAPEMAPHASHER_H 19 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Builder.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPODS_BUILDER_H 2 | #define HS_TOPODS_BUILDER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Builder * hs_new_TopoDS_Builder(void); 11 | 12 | void hs_delete_TopoDS_Builder(TopoDS_Builder * builder); 13 | 14 | void hs_TopoDS_Builder_makeWire(TopoDS_Builder * builder, TopoDS_Wire * wire); 15 | 16 | void hs_TopoDS_Builder_makeShell(TopoDS_Builder * builder, TopoDS_Shell * shell); 17 | 18 | void hs_TopoDS_Builder_makeSolid(TopoDS_Builder * builder, TopoDS_Solid * solid); 19 | 20 | void hs_TopoDS_Builder_makeCompSolid(TopoDS_Builder * builder, TopoDS_CompSolid * solid); 21 | 22 | void hs_TopoDS_Builder_makeCompound(TopoDS_Builder * builder, TopoDS_Compound * compound); 23 | 24 | void hs_TopoDS_Builder_add(TopoDS_Builder * builder, TopoDS_Shape * s, TopoDS_Shape * c); 25 | 26 | void hs_TopoDS_Builder_remove(TopoDS_Builder * builder, TopoDS_Shape * s, TopoDS_Shape * c); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif // HS_TOPODS_BUILDER_H 33 | 34 | 35 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_CompSolid.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopoDS_CompSolid.h" 3 | 4 | TopoDS_CompSolid * hs_new_TopoDS_CompSolid(){ 5 | return new TopoDS_CompSolid(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_CompSolid.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPODS_COMPSOLID_H 2 | #define HS_TOPODS_COMPSOLID_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_CompSolid * hs_new_TopoDS_CompSolid(); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_TOPODS_COMPSOLID_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Compound.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopoDS_Compound.h" 3 | 4 | TopoDS_Compound * hs_new_TopoDS_Compound(){ 5 | return new TopoDS_Compound(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Compound.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPODS_COMPOUND_H 2 | #define HS_TOPODS_COMPOUND_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Compound * hs_new_TopoDS_Compound(); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_TOPODS_COMPOUND_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Edge.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopoDS_Edge.h" 3 | 4 | TopoDS_Edge * hs_new_TopoDS_Edge(){ 5 | return new TopoDS_Edge(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Edge.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPODS_EDGE_H 2 | #define HS_TOPODS_EDGE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Edge * hs_new_TopoDS_Edge(); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_TOPODS_EDGE_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Face.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopoDS_Face.h" 3 | 4 | TopoDS_Face * hs_new_TopoDS_Face(){ 5 | return new TopoDS_Face(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Face.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPODS_FACE_H 2 | #define HS_TOPODS_FACE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Face * hs_new_TopoDS_Face(); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_TOPODS_FACE_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Shell.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopoDS_Shell.h" 3 | 4 | TopoDS_Shell * hs_new_TopoDS_Shell(){ 5 | return new TopoDS_Shell(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Shell.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPODS_SHELL_H 2 | #define HS_TOPODS_SHELL_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Shell * hs_new_TopoDS_Shell(); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_TOPODS_SHELL_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Solid.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopoDS_Solid.h" 3 | 4 | TopoDS_Solid * hs_new_TopoDS_Solid(){ 5 | return new TopoDS_Solid(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Solid.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPODS_SOLID_H 2 | #define HS_TOPODS_SOLID_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Solid * hs_new_TopoDS_Solid(); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_TOPODS_SOLID_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Vertex.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopoDS_Vertex.h" 3 | 4 | TopoDS_Vertex * hs_new_TopoDS_Vertex(){ 5 | return new TopoDS_Vertex(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Vertex.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPODS_VERTEX_H 2 | #define HS_TOPODS_VERTEX_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Vertex * hs_new_TopoDS_Vertex(); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_TOPODS_VERTEX_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Wire.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_TopoDS_Wire.h" 3 | 4 | TopoDS_Wire * hs_new_TopoDS_Wire(){ 5 | return new TopoDS_Wire(); 6 | } 7 | 8 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_TopoDS_Wire.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_TOPODS_WIRE_H 2 | #define HS_TOPODS_WIRE_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | TopoDS_Wire * hs_new_TopoDS_Wire(); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_TOPODS_WIRE_H 17 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_XCAFDoc_DocumentTool.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_XCAFDoc_DocumentTool.h" 3 | 4 | Handle (XCAFDoc_ShapeTool) * hs_XCAFDoc_DocumentTool_shapeTool(TDF_Label * label){ 5 | return new opencascade::handle(XCAFDoc_DocumentTool::ShapeTool(*label)); 6 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_XCAFDoc_DocumentTool.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_XCAFDOC_DOCUMENTTOOL_H 2 | #define HS_XCAFDOC_DOCUMENTTOOL_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | Handle (XCAFDoc_ShapeTool) * hs_XCAFDoc_DocumentTool_shapeTool(TDF_Label * label); 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | 16 | #endif // HS_XCAFDOC_DOCUMENTTOOL_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_XCAFDoc_ShapeTool.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_XCAFDoc_ShapeTool.h" 3 | 4 | void hs_delete_XCAFDoc_ShapeTool(Handle(XCAFDoc_ShapeTool) * shapeTool){ 5 | delete shapeTool; 6 | } 7 | 8 | TDF_Label * hs_XCAFDoc_ShapeTool_addShape(Handle(XCAFDoc_ShapeTool) *shapeTool, TopoDS_Shape *theShape, bool makeAssembly, bool makePrepare){ 9 | return new TDF_Label(shapeTool->get()->AddShape(*theShape, makeAssembly, makePrepare)); 10 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_XCAFDoc_ShapeTool.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_XCAFDOC_SHAPETOOL_H 2 | #define HS_XCAFDOC_SHAPETOOL_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | void hs_delete_XCAFDoc_ShapeTool(Handle(XCAFDoc_ShapeTool) * shapeTool); 11 | 12 | TDF_Label * hs_XCAFDoc_ShapeTool_addShape(Handle(XCAFDoc_ShapeTool) *shapeTool, TopoDS_Shape *theShape, bool makeAssembly, bool makePrepare); 13 | 14 | #ifdef __cplusplus 15 | } 16 | #endif 17 | 18 | #endif // HS_XCAFDOC_SHAPETOOL_H -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_XSControl_Reader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_XSControl_Reader.h" 3 | 4 | IFSelect_ReturnStatus hs_XSControl_Reader_readFile(XSControl_Reader * reader, char * filename){ 5 | return reader->ReadFile(filename); 6 | } 7 | 8 | bool hs_XSControl_Reader_transferRoots(XSControl_Reader * reader){ 9 | return reader->TransferRoots(); 10 | } 11 | 12 | TopoDS_Shape * hs_XSControl_Reader_oneShape(XSControl_Reader * reader){ 13 | return new TopoDS_Shape(reader->OneShape()); 14 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_XSControl_Reader.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_XSCONTROL_READER_H 2 | #define HS_XSCONTROL_READER_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | IFSelect_ReturnStatus hs_XSControl_Reader_readFile(XSControl_Reader * reader, char * filename); 11 | 12 | bool hs_XSControl_Reader_transferRoots(XSControl_Reader * reader); 13 | 14 | TopoDS_Shape * hs_XSControl_Reader_oneShape(XSControl_Reader * reader); 15 | 16 | #ifdef __cplusplus 17 | } 18 | #endif 19 | 20 | #endif // HS_XSCONTROL_READER_H 21 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_gp.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GP_H 2 | #define HS_GP_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | gp_Pnt * hs_gp_Origin(); 11 | 12 | gp_Dir * hs_gp_DX(); 13 | 14 | gp_Dir * hs_gp_DY(); 15 | 16 | gp_Dir * hs_gp_DZ(); 17 | 18 | gp_Ax1 * hs_gp_OX(); 19 | 20 | gp_Ax1 * hs_gp_OY(); 21 | 22 | gp_Ax1 * hs_gp_OZ(); 23 | 24 | gp_Ax2 * hs_gp_XOY(); 25 | 26 | gp_Ax2 * hs_gp_YOZ(); 27 | 28 | gp_Ax2 * hs_gp_ZOX(); 29 | 30 | gp_Pnt2d * hs_gp_Origin2d(); 31 | 32 | gp_Dir2d * hs_gp_DX2d(); 33 | 34 | gp_Dir2d * hs_gp_DY2d(); 35 | 36 | gp_Ax2d * hs_gp_OX2d(); 37 | 38 | gp_Ax2d * hs_gp_OY2d(); 39 | 40 | #ifdef __cplusplus 41 | } 42 | #endif 43 | 44 | #endif // HS_GP_H 45 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_gp_GTrsf.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_gp_GTrsf.h" 3 | 4 | gp_GTrsf * hs_new_gp_GTrsf(){ 5 | return new gp_GTrsf(); 6 | } 7 | 8 | void hs_delete_gp_GTrsf(gp_GTrsf * t){ 9 | delete t; 10 | } 11 | 12 | void hs_gp_GTrsf_setValue(gp_GTrsf * trsf, int row, int col, double value){ 13 | trsf->SetValue(row, col, value); 14 | } 15 | 16 | 17 | void hs_gp_GTrsf_setForm(gp_GTrsf * trsf){ 18 | trsf->SetForm(); 19 | } -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_gp_GTrsf.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GP_GTRSF_H 2 | #define HS_GP_GTRSF_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | 11 | gp_GTrsf * hs_new_gp_GTrsf(); 12 | 13 | void hs_delete_gp_GTrsf(gp_GTrsf * t); 14 | 15 | void hs_gp_GTrsf_setValue(gp_GTrsf * trsf, int row, int col, double value); 16 | 17 | void hs_gp_GTrsf_setForm(gp_GTrsf * trsf); 18 | 19 | #ifdef __cplusplus 20 | } 21 | #endif 22 | 23 | #endif // HS_GP_GTRSF_H 24 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_gp_XYZ.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "hs_gp_XYZ.h" 3 | 4 | gp_XYZ * hs_new_gp_XYZ(){ 5 | return new gp_XYZ(); 6 | } 7 | 8 | gp_XYZ * hs_new_gp_XYZ_fromDoubles(double x, double y, double z){ 9 | return new gp_XYZ(x, y, z); 10 | } 11 | 12 | void hs_delete_gp_XYZ(gp_XYZ * xyz){ 13 | delete xyz; 14 | } 15 | 16 | void hs_gp_XYZ_setX(gp_XYZ * xyz, double x){ 17 | xyz->SetX(x); 18 | } 19 | 20 | void hs_gp_XYZ_setY(gp_XYZ * xyz, double y){ 21 | xyz->SetY(y); 22 | } 23 | 24 | void hs_gp_XYZ_setZ(gp_XYZ * xyz, double z){ 25 | xyz->SetZ(z); 26 | } 27 | 28 | double hs_gp_XYZ_x(gp_XYZ * xyz){ 29 | return xyz->X(); 30 | } 31 | 32 | double hs_gp_XYZ_y(gp_XYZ * xyz){ 33 | return xyz->Y(); 34 | } 35 | 36 | double hs_gp_XYZ_z(gp_XYZ * xyz){ 37 | return xyz->Z(); 38 | } 39 | 40 | -------------------------------------------------------------------------------- /opencascade-hs/cpp/hs_gp_XYZ.h: -------------------------------------------------------------------------------- 1 | #ifndef HS_GP_XYZ_H 2 | #define HS_GP_XYZ_H 3 | 4 | #include "hs_types.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" { 8 | #endif 9 | 10 | gp_XYZ * hs_new_gp_XYZ(); 11 | 12 | gp_XYZ * hs_new_gp_XYZ_fromDoubles(double x, double y, double z); 13 | 14 | void hs_delete_gp_XYZ(gp_XYZ * xyz); 15 | 16 | void hs_gp_XYZ_setX(gp_XYZ * xyz, double x); 17 | 18 | void hs_gp_XYZ_setY(gp_XYZ * xyz, double y); 19 | 20 | void hs_gp_XYZ_setZ(gp_XYZ * xyz, double z); 21 | 22 | double hs_gp_XYZ_x(gp_XYZ * xyz); 23 | 24 | double hs_gp_XYZ_y(gp_XYZ * xyz); 25 | 26 | double hs_gp_XYZ_z(gp_XYZ * xyz); 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | 32 | #endif // HS_GP_XYZ_H 33 | 34 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BOPAlgo/BOP.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BOPAlgo.BOP 3 | ( BOP 4 | , new 5 | , addTool 6 | , setOperation 7 | ) where 8 | 9 | import OpenCascade.BOPAlgo.Types 10 | import OpenCascade.BOPAlgo.Internal.Destructors (deleteBOP) 11 | import OpenCascade.BOPAlgo.Operation (Operation) 12 | import qualified OpenCascade.TopoDS.Types as TopoDS 13 | 14 | import Foreign.Ptr (Ptr) 15 | import Data.Acquire (Acquire, mkAcquire) 16 | import Foreign.C (CInt (..)) 17 | 18 | 19 | foreign import capi unsafe "hs_BOPAlgo_BOP.h hs_new_BOPAlgo_BOP" rawNew :: IO (Ptr BOP) 20 | 21 | new :: Acquire (Ptr BOP) 22 | new = mkAcquire rawNew deleteBOP 23 | 24 | foreign import capi unsafe "hs_BOPAlgo_BOP.h hs_BOPAlgo_BOP_AddTool" addTool :: Ptr BOP -> Ptr TopoDS.Shape -> IO () 25 | 26 | foreign import capi unsafe "hs_BOPAlgo_BOP.h hs_BOPAlgo_BOP_SetOperation" rawSetOperation :: Ptr BOP -> CInt -> IO () 27 | 28 | setOperation :: Ptr BOP -> Operation -> IO () 29 | setOperation bop op = rawSetOperation bop (fromIntegral . fromEnum $ op) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BOPAlgo/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BOPAlgo.Internal.Destructors 3 | ( deleteBuilder 4 | , deleteBOP 5 | ) where 6 | 7 | import OpenCascade.BOPAlgo.Types 8 | import Foreign.Ptr 9 | 10 | foreign import capi unsafe "hs_BOPAlgo_Builder.h hs_delete_BOPAlgo_Builder" deleteBuilder :: Ptr Builder -> IO () 11 | foreign import capi unsafe "hs_BOPAlgo_BOP.h hs_delete_BOPAlgo_BOP" deleteBOP :: Ptr BOP -> IO () 12 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BOPAlgo/Operation.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BOPAlgo.Operation 2 | ( Operation (..) 3 | ) where 4 | 5 | -- this should match the enumeration in BOPAlgo_Operation 6 | data Operation = Common | Fuse | Cut | Cut21 | Section | Unknown 7 | deriving (Show, Eq, Enum) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BOPAlgo/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | {-# LANGUAGE EmptyDataDecls #-} 3 | module OpenCascade.BOPAlgo.Types 4 | ( Builder 5 | , BOP 6 | ) where 7 | 8 | import qualified OpenCascade.Inheritance as Inheritance 9 | 10 | data Builder 11 | data BOP 12 | 13 | instance Inheritance.SubTypeOf Builder BOP 14 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepAdaptor.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepAdaptor 2 | (Curve 3 | ) where 4 | 5 | import OpenCascade.BRepAdaptor.Types (Curve) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepAdaptor/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepAdaptor.Internal.Destructors 3 | ( deleteCurve 4 | ) where 5 | 6 | import OpenCascade.BRepAdaptor.Types (Curve) 7 | import Foreign.Ptr 8 | 9 | foreign import capi unsafe "hs_BRepAdaptor_Curve.h hs_delete_BRepAdaptor_Curve" deleteCurve :: Ptr Curve -> IO () 10 | 11 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepAdaptor/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.BRepAdaptor.Types 3 | ( Curve 4 | ) where 5 | 6 | data Curve -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepAlgoAPI/Common.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepAlgoAPI.Common 3 | ( common 4 | ) where 5 | 6 | import qualified OpenCascade.TopoDS as TopoDS 7 | import OpenCascade.TopoDS.Internal.Destructors (deleteShape) 8 | import Foreign.Ptr 9 | import Data.Acquire 10 | 11 | 12 | foreign import capi unsafe "hs_BRepAlgoAPI_Common.h hs_BRepAlgoAPI_Common" rawCommon :: Ptr TopoDS.Shape -> Ptr TopoDS.Shape -> IO (Ptr TopoDS.Shape) 13 | 14 | common :: Ptr TopoDS.Shape -> Ptr TopoDS.Shape -> Acquire (Ptr TopoDS.Shape) 15 | common a b = mkAcquire (rawCommon a b) deleteShape -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepAlgoAPI/Cut.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepAlgoAPI.Cut 3 | ( cut 4 | ) where 5 | 6 | import qualified OpenCascade.TopoDS as TopoDS 7 | import OpenCascade.TopoDS.Internal.Destructors (deleteShape) 8 | import Foreign.Ptr 9 | import Data.Acquire 10 | 11 | 12 | foreign import capi unsafe "hs_BRepAlgoAPI_Cut.h hs_BRepAlgoAPI_Cut" rawCut :: Ptr TopoDS.Shape -> Ptr TopoDS.Shape -> IO (Ptr TopoDS.Shape) 13 | 14 | cut :: Ptr TopoDS.Shape -> Ptr TopoDS.Shape -> Acquire (Ptr TopoDS.Shape) 15 | cut a b = mkAcquire (rawCut a b) deleteShape -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepAlgoAPI/Fuse.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepAlgoAPI.Fuse 3 | ( fuse 4 | ) where 5 | 6 | import qualified OpenCascade.TopoDS as TopoDS 7 | import OpenCascade.TopoDS.Internal.Destructors (deleteShape) 8 | import Foreign.Ptr 9 | import Data.Acquire 10 | 11 | 12 | foreign import capi unsafe "hs_BRepAlgoAPI_Fuse.h hs_BRepAlgoAPI_Fuse" rawFuse :: Ptr TopoDS.Shape -> Ptr TopoDS.Shape -> IO (Ptr TopoDS.Shape) 13 | 14 | fuse :: Ptr TopoDS.Shape -> Ptr TopoDS.Shape -> Acquire (Ptr TopoDS.Shape) 15 | fuse a b = mkAcquire (rawFuse a b) deleteShape -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepBuilderAPI 2 | ( module OpenCascade.BRepBuilderAPI.Types 3 | ) where 4 | 5 | import OpenCascade.BRepBuilderAPI.Types 6 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI/Copy.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepBuilderAPI.Copy 3 | ( copy 4 | ) where 5 | 6 | import qualified OpenCascade.TopoDS as TopoDS 7 | import OpenCascade.Internal.Bool 8 | import qualified OpenCascade.TopoDS.Internal.Destructors as TopoDS.Destructors 9 | import Foreign.C 10 | import Foreign.Ptr 11 | import Data.Acquire 12 | 13 | foreign import capi unsafe "hs_BRepBuilderAPI_Copy.h hs_BRepBuilderAPI_Copy_copy" rawCopy :: Ptr TopoDS.Shape -> CBool -> CBool -> IO (Ptr TopoDS.Shape) 14 | 15 | copy :: Ptr TopoDS.Shape -> Bool -> Bool -> Acquire (Ptr TopoDS.Shape) 16 | copy shape copyGeom copyMesh = mkAcquire (rawCopy shape (boolToCBool copyMesh) (boolToCBool copyGeom)) TopoDS.Destructors.deleteShape -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI/FaceError.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepBuilderAPI.FaceError 2 | ( FaceError (..) 3 | ) where 4 | 5 | -- order must match the definition of BRepBuilderAPI FaceError 6 | data FaceError = FaceDone | NoFace | NotPlanar | CurveProjectionFailed | ParametersOutOfRange deriving (Eq, Enum) 7 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI/GTransform.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepBuilderAPI.GTransform 3 | ( gtransform 4 | ) where 5 | 6 | import qualified OpenCascade.GP as GP 7 | import qualified OpenCascade.TopoDS as TopoDS 8 | import OpenCascade.Internal.Bool 9 | import qualified OpenCascade.TopoDS.Internal.Destructors as TopoDS.Destructors 10 | import Foreign.C 11 | import Foreign.Ptr 12 | import Data.Acquire 13 | 14 | foreign import capi unsafe "hs_BRepBuilderAPI_GTransform.h hs_BRepBuilderAPI_GTransform_gtransform" rawGTransform :: Ptr TopoDS.Shape -> Ptr GP.GTrsf -> CBool -> IO (Ptr TopoDS.Shape) 15 | 16 | gtransform :: Ptr TopoDS.Shape -> Ptr GP.GTrsf -> Bool -> Acquire (Ptr TopoDS.Shape) 17 | gtransform shape trsf copy = mkAcquire (rawGTransform shape trsf (boolToCBool copy)) TopoDS.Destructors.deleteShape 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepBuilderAPI.Internal.Destructors 3 | ( deleteMakeVertex 4 | , deleteMakeWire 5 | , deleteMakeFace 6 | , deleteMakeSolid 7 | , deleteSewing 8 | ) where 9 | 10 | import OpenCascade.BRepBuilderAPI.Types 11 | 12 | import Foreign.Ptr 13 | 14 | foreign import capi unsafe "hs_BRepBuilderAPI_MakeVertex.h hs_delete_BRepBuilderAPI_MakeVertex" deleteMakeVertex :: Ptr MakeVertex -> IO () 15 | foreign import capi unsafe "hs_BRepBuilderAPI_MakeWire.h hs_delete_BRepBuilderAPI_MakeWire" deleteMakeWire :: Ptr MakeWire -> IO () 16 | foreign import capi unsafe "hs_BRepBuilderAPI_MakeFace.h hs_delete_BRepBuilderAPI_MakeFace" deleteMakeFace :: Ptr MakeFace -> IO () 17 | foreign import capi unsafe "hs_BRepBuilderAPI_MakeSolid.h hs_delete_BRepBuilderAPI_MakeSolid" deleteMakeSolid :: Ptr MakeSolid -> IO () 18 | foreign import capi unsafe "hs_BRepBuilderAPI_Sewing.h hs_delete_BRepBuilderAPI_Sewing" deleteSewing :: Ptr Sewing -> IO () 19 | 20 | 21 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI/MakePolygon.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepBuilderAPI.MakePolygon 3 | ( from3Pnts 4 | ) where 5 | 6 | import qualified OpenCascade.GP as GP 7 | import qualified OpenCascade.TopoDS as TopoDS 8 | import OpenCascade.TopoDS.Internal.Destructors (deleteShape) 9 | import OpenCascade.Inheritance (upcast) 10 | import Foreign.C (CBool (..)) 11 | import Foreign.Ptr (Ptr) 12 | import Data.Acquire (Acquire, mkAcquire) 13 | import OpenCascade.Internal.Bool (boolToCBool) 14 | 15 | foreign import capi unsafe "hs_BRepBuilderAPI_MakePolygon.h hs_BRepBuilderAPI_MakePolygon_from3Pnts" rawFrom3Pnts :: Ptr GP.Pnt -> Ptr GP.Pnt -> Ptr GP.Pnt -> CBool -> IO (Ptr TopoDS.Wire) 16 | 17 | from3Pnts :: Ptr GP.Pnt -> Ptr GP.Pnt -> Ptr GP.Pnt -> Bool -> Acquire (Ptr TopoDS.Wire) 18 | from3Pnts p1 p2 p3 close = mkAcquire (rawFrom3Pnts p1 p2 p3 (boolToCBool close)) (deleteShape . upcast) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI/MakeShape.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepBuilderAPI.MakeShape 3 | ( MakeShape 4 | , shape 5 | , build 6 | ) where 7 | import OpenCascade.BRepBuilderAPI.Types 8 | import qualified OpenCascade.TopoDS as TopoDS 9 | import OpenCascade.TopoDS.Internal.Destructors (deleteShape) 10 | import Foreign.Ptr 11 | import Data.Acquire 12 | 13 | foreign import capi unsafe "hs_BRepBuilderAPI_MakeShape.h hs_BRepBuilderAPI_MakeShape_shape" rawShape :: Ptr MakeShape -> IO (Ptr TopoDS.Shape) 14 | 15 | shape :: Ptr MakeShape -> Acquire (Ptr TopoDS.Shape) 16 | shape builder = mkAcquire (rawShape builder) (deleteShape) 17 | 18 | foreign import capi unsafe "hs_BRepBuilderAPI_MakeShape.h hs_BRepBuilderAPI_MakeShape_build" build :: Ptr MakeShape -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI/Transform.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepBuilderAPI.Transform 3 | ( transform 4 | ) where 5 | 6 | import qualified OpenCascade.GP as GP 7 | import qualified OpenCascade.TopoDS as TopoDS 8 | import OpenCascade.Internal.Bool 9 | import qualified OpenCascade.TopoDS.Internal.Destructors as TopoDS.Destructors 10 | import Foreign.C 11 | import Foreign.Ptr 12 | import Data.Acquire 13 | 14 | foreign import capi unsafe "hs_BRepBuilderAPI_Transform.h hs_BRepBuilderAPI_Transform_transform" rawTransform :: Ptr TopoDS.Shape -> Ptr GP.Trsf -> CBool -> IO (Ptr TopoDS.Shape) 15 | 16 | transform :: Ptr TopoDS.Shape -> Ptr GP.Trsf -> Bool -> Acquire (Ptr TopoDS.Shape) 17 | transform shape trsf copy = mkAcquire (rawTransform shape trsf (boolToCBool copy)) TopoDS.Destructors.deleteShape 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | {-# LANGUAGE EmptyDataDecls #-} 3 | module OpenCascade.BRepBuilderAPI.Types 4 | ( MakeVertex 5 | , MakeWire 6 | , MakeFace 7 | , MakeSolid 8 | , MakeShape 9 | , Sewing 10 | ) where 11 | 12 | import qualified OpenCascade.Inheritance as Inheritance 13 | 14 | data MakeVertex 15 | data MakeWire 16 | data MakeFace 17 | data MakeSolid 18 | 19 | data MakeShape 20 | 21 | data Sewing 22 | 23 | instance Inheritance.SubTypeOf MakeShape MakeVertex 24 | instance Inheritance.SubTypeOf MakeShape MakeWire 25 | instance Inheritance.SubTypeOf MakeShape MakeSolid 26 | instance Inheritance.SubTypeOf MakeShape MakeFace 27 | 28 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepBuilderAPI/WireError.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepBuilderAPI.WireError 2 | ( WireError (..) 3 | ) where 4 | 5 | -- order must match the definition of BRepBuilderAPI_WireError 6 | data WireError = WireDone | EmptyWire | DisconnectedWire | NonManifoldWire deriving (Eq, Enum, Show) 7 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepFilletAPI.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepFilletAPI 2 | ( module OpenCascade.BRepFilletAPI.Types 3 | ) where 4 | 5 | import OpenCascade.BRepFilletAPI.Types -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepFilletAPI/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepFilletAPI.Internal.Destructors 3 | ( deleteMakeFillet 4 | , deleteMakeChamfer 5 | ) where 6 | 7 | import OpenCascade.BRepFilletAPI.Types 8 | 9 | import Foreign.Ptr 10 | 11 | foreign import capi unsafe "hs_BRepFilletAPI_MakeFillet.h hs_delete_BRepFilletAPI_MakeFillet" deleteMakeFillet :: Ptr MakeFillet -> IO () 12 | 13 | foreign import capi unsafe "hs_BRepFilletAPI_MakeChamfer.h hs_delete_BRepFilletAPI_MakeChamfer" deleteMakeChamfer :: Ptr MakeChamfer -> IO () 14 | 15 | 16 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepFilletAPI/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | {-# LANGUAGE EmptyDataDecls #-} 3 | module OpenCascade.BRepFilletAPI.Types 4 | ( MakeFillet 5 | , MakeChamfer 6 | ) where 7 | 8 | import qualified OpenCascade.Inheritance as Inheritance 9 | import OpenCascade.BRepBuilderAPI.MakeShape (MakeShape) 10 | 11 | data MakeFillet 12 | data MakeChamfer 13 | 14 | instance Inheritance.SubTypeOf MakeShape MakeFillet 15 | instance Inheritance.SubTypeOf MakeShape MakeChamfer -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepGProp.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepGProp (volumeProperties) where 3 | 4 | import OpenCascade.TopoDS.Types (Shape) 5 | import OpenCascade.GProp.Types (GProps) 6 | import Foreign.Ptr (Ptr) 7 | import Foreign.C (CBool (..)) 8 | import OpenCascade.Internal.Bool (boolToCBool) 9 | 10 | foreign import capi unsafe "hs_BRepGProp.h hs_BRepGProp_VolumeProperties" rawVolumeProperties :: Ptr Shape -> Ptr GProps -> CBool -> CBool -> CBool -> IO () 11 | 12 | volumeProperties :: Ptr Shape -> Ptr GProps -> Bool -> Bool -> Bool -> IO () 13 | volumeProperties shape props onlyClosed skipShared useTriangulation = 14 | rawVolumeProperties shape props (boolToCBool onlyClosed) (boolToCBool skipShared) (boolToCBool useTriangulation) 15 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepLib.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI#-} 2 | module OpenCascade.BRepLib 3 | ( orientClosedSolid 4 | , buildCurve3d 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types (Solid, Edge) 8 | import qualified OpenCascade.GeomAbs.Shape as GeomAbs.Shape 9 | import Foreign.Ptr (Ptr) 10 | import Foreign.C (CBool (..), CDouble (..), CInt (..)) 11 | import OpenCascade.Internal.Bool (cBoolToBool) 12 | import Data.Coerce (coerce) 13 | 14 | foreign import capi unsafe "hs_BRepLib.h hs_BRepLib_orientClosedSolid" rawOrientClosedSolid :: Ptr Solid -> IO (CBool) 15 | 16 | orientClosedSolid :: Ptr Solid -> IO Bool 17 | orientClosedSolid s = cBoolToBool <$> rawOrientClosedSolid s 18 | 19 | 20 | foreign import capi unsafe "hs_BRepLib.h hs_BRepLib_buildCurve3d" rawBuildCurve3d :: Ptr Edge -> CDouble -> CInt -> CInt -> CInt -> IO CBool 21 | 22 | buildCurve3d :: Ptr Edge -> Double -> GeomAbs.Shape.Shape -> Int -> Int -> IO Bool 23 | buildCurve3d edge tolerance continuity maxDegree maxSegment = 24 | cBoolToBool <$> rawBuildCurve3d edge (coerce tolerance) (fromIntegral . fromEnum $ continuity) (fromIntegral maxDegree) (fromIntegral maxSegment) 25 | 26 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepMesh.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepMesh 2 | ( module OpenCascade.BRepMesh.Types 3 | ) where 4 | 5 | import OpenCascade.BRepMesh.Types -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepMesh/IncrementalMesh.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepMesh.IncrementalMesh 3 | ( fromShapeAndLinDeflection 4 | , perform 5 | ) where 6 | 7 | import OpenCascade.BRepMesh.Types (IncrementalMesh) 8 | import OpenCascade.BRepMesh.Internal.Destructors (deleteIncrementalMesh) 9 | import qualified OpenCascade.TopoDS as TopoDS 10 | import Foreign.Ptr 11 | import Data.Acquire 12 | import Data.Coerce (coerce) 13 | 14 | 15 | foreign import capi unsafe "hs_BRepMesh_IncrementalMesh.h hs_BRepMesh_IncrementalMesh_fromShapeAndLinDeflection" rawFromShapeAndLinDeflection :: Ptr TopoDS.Shape -> Double -> IO (Ptr IncrementalMesh) 16 | 17 | fromShapeAndLinDeflection :: Ptr TopoDS.Shape -> Double -> Acquire (Ptr IncrementalMesh) 18 | fromShapeAndLinDeflection shape linDeflection = mkAcquire (rawFromShapeAndLinDeflection shape (coerce linDeflection)) deleteIncrementalMesh 19 | 20 | foreign import capi unsafe "hs_BRepMesh_IncrementalMesh.h hs_BRepMesh_IncrementalMesh_Perform" perform :: Ptr IncrementalMesh -> IO () 21 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepMesh/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepMesh.Internal.Destructors 3 | ( deleteIncrementalMesh 4 | ) where 5 | 6 | import OpenCascade.BRepMesh.Types 7 | 8 | import Foreign.Ptr 9 | 10 | foreign import capi unsafe "hs_BRepMesh_IncrementalMesh.h hs_delete_BRepMesh_IncrementalMesh" deleteIncrementalMesh :: Ptr IncrementalMesh -> IO () 11 | 12 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepMesh/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.BRepMesh.Types 3 | ( IncrementalMesh 4 | ) where 5 | 6 | data IncrementalMesh 7 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepOffset/Mode.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepOffset.Mode 2 | (Mode (..) 3 | ) where 4 | 5 | data Mode = Skin | Pipe | RectoVerso deriving (Enum, Show) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepOffsetAPI.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepOffsetAPI 2 | ( module OpenCascade.BRepOffsetAPI.Types 3 | ) where 4 | 5 | import OpenCascade.BRepOffsetAPI.Types -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepOffsetAPI/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepOffsetAPI.Internal.Destructors 3 | ( deleteMakePipe 4 | , deleteMakeOffsetShape 5 | , deleteThruSections 6 | ) where 7 | 8 | import OpenCascade.BRepOffsetAPI.Types 9 | 10 | import Foreign.Ptr 11 | 12 | foreign import capi unsafe "hs_BRepOffsetAPI_MakePipe.h hs_delete_BRepOffsetAPI_MakePipe" deleteMakePipe :: Ptr MakePipe -> IO () 13 | foreign import capi unsafe "hs_BRepOffsetAPI_MakeOffsetShape.h hs_delete_BRepOffsetAPI_MakeOffsetShape" deleteMakeOffsetShape :: Ptr MakeOffsetShape -> IO () 14 | foreign import capi unsafe "hs_BRepOffsetAPI_ThruSections.h hs_delete_BRepOffsetAPI_ThruSections" deleteThruSections :: Ptr ThruSections -> IO () 15 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepOffsetAPI/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | {-# LANGUAGE EmptyDataDecls #-} 3 | module OpenCascade.BRepOffsetAPI.Types 4 | ( MakePipe 5 | , MakeOffsetShape 6 | , ThruSections 7 | ) where 8 | 9 | import qualified OpenCascade.Inheritance as Inheritance 10 | import OpenCascade.BRepBuilderAPI.MakeShape (MakeShape) 11 | 12 | data MakePipe 13 | data MakeOffsetShape 14 | data ThruSections 15 | 16 | instance Inheritance.SubTypeOf MakeShape MakePipe 17 | instance Inheritance.SubTypeOf MakeShape MakeOffsetShape 18 | instance Inheritance.SubTypeOf MakeShape ThruSections -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepPrimAPI.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepPrimAPI 2 | ( module OpenCascade.BRepPrimAPI.Types 3 | ) where 4 | 5 | import OpenCascade.BRepPrimAPI.Types 6 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepPrimAPI/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepPrimAPI.Internal.Destructors 3 | ( deleteMakeBox 4 | , deleteMakeRevol 5 | ) where 6 | 7 | import OpenCascade.BRepPrimAPI.Types 8 | 9 | import Foreign.Ptr 10 | 11 | foreign import capi unsafe "hs_BRepPrimAPI_MakeBox.h hs_delete_BRepPrimAPI_MakeBox" deleteMakeBox :: Ptr MakeBox -> IO () 12 | foreign import capi unsafe "hs_BRepPrimAPI_MakeRevol.h hs_delete_BRepPrimAPI_MakeRevol" deleteMakeRevol :: Ptr MakeRevol -> IO () 13 | 14 | 15 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepPrimAPI/MakeCone.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepPrimAPI.MakeCone 3 | ( fromTwoRadiiAndHeight 4 | ) where 5 | 6 | import qualified OpenCascade.TopoDS as TopoDS 7 | import qualified OpenCascade.TopoDS.Internal.Destructors as TopoDS.Destructors 8 | import Foreign.C 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | import Data.Coerce (coerce) 12 | 13 | foreign import capi unsafe "hs_BRepPrimAPI_MakeCone.h hs_BRepPrimAPI_MakeCone_fromTwoRadiiAndHeight" rawFromTwoRadiiAndHeight :: CDouble -> CDouble -> CDouble -> IO (Ptr TopoDS.Solid) 14 | 15 | fromTwoRadiiAndHeight :: Double -> Double -> Double -> Acquire (Ptr TopoDS.Solid) 16 | fromTwoRadiiAndHeight r1 r2 h = mkAcquire ((coerce rawFromTwoRadiiAndHeight) r1 r2 h) (TopoDS.Destructors.deleteShape . castPtr) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepPrimAPI/MakeCylinder.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepPrimAPI.MakeCylinder 3 | ( fromRadiusAndHeight 4 | ) where 5 | 6 | import qualified OpenCascade.TopoDS as TopoDS 7 | import qualified OpenCascade.TopoDS.Internal.Destructors as TopoDS.Destructors 8 | import Foreign.C 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | import Data.Coerce (coerce) 12 | 13 | foreign import capi unsafe "hs_BRepPrimAPI_MakeCylinder.h hs_BRepPrimAPI_MakeCylinder_fromRadiusAndHeight" rawFromRadiusAndHeight :: CDouble -> CDouble -> IO (Ptr TopoDS.Solid) 14 | 15 | fromRadiusAndHeight :: Double -> Double -> Acquire (Ptr TopoDS.Solid) 16 | fromRadiusAndHeight r h = mkAcquire (rawFromRadiusAndHeight (coerce r) (coerce h)) (TopoDS.Destructors.deleteShape . castPtr) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepPrimAPI/MakeRevol.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepPrimAPI.MakeRevol 3 | ( MakeRevol 4 | , fromShapeAndAx1 5 | ) where 6 | 7 | import OpenCascade.BRepPrimAPI.Types (MakeRevol) 8 | import OpenCascade.BRepPrimAPI.Internal.Destructors (deleteMakeRevol) 9 | 10 | import qualified OpenCascade.TopoDS as TopoDS 11 | import qualified OpenCascade.GP as GP 12 | import OpenCascade.Internal.Bool (boolToCBool) 13 | import Foreign.C 14 | import Foreign.Ptr 15 | import Data.Acquire 16 | 17 | foreign import capi unsafe "hs_BRepPrimAPI_MakeRevol.h hs_new_BRepPrimAPI_MakeRevol_fromShapeAndAx1" rawFromShapeAndAx1 :: Ptr TopoDS.Shape -> Ptr GP.Ax1 -> CBool -> IO (Ptr MakeRevol) 18 | 19 | fromShapeAndAx1 :: Ptr TopoDS.Shape -> Ptr GP.Ax1 -> Bool -> Acquire (Ptr MakeRevol) 20 | fromShapeAndAx1 shape axis copy = mkAcquire (rawFromShapeAndAx1 shape axis (boolToCBool copy)) deleteMakeRevol 21 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepPrimAPI/MakeSphere.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepPrimAPI.MakeSphere 3 | ( fromRadius 4 | , fromPntAndRadius 5 | ) where 6 | 7 | import qualified OpenCascade.GP as GP 8 | import qualified OpenCascade.TopoDS as TopoDS 9 | import qualified OpenCascade.TopoDS.Internal.Destructors as TopoDS.Destructors 10 | import Foreign.C 11 | import Foreign.Ptr 12 | import Data.Acquire 13 | import Data.Coerce (coerce) 14 | 15 | foreign import capi unsafe "hs_BRepPrimAPI_MakeSphere.h hs_BRepPrimAPI_MakeSphere_fromRadius" rawFromRadius :: CDouble -> IO (Ptr TopoDS.Solid) 16 | 17 | fromRadius :: Double -> Acquire (Ptr TopoDS.Solid) 18 | fromRadius r = mkAcquire (rawFromRadius (coerce r)) (TopoDS.Destructors.deleteShape . castPtr) 19 | 20 | foreign import capi unsafe "hs_BRepPrimAPI_MakeSphere.h hs_BRepPrimAPI_MakeSphere_fromPntAndRadius" rawFromPntAndRadius :: Ptr GP.Pnt -> CDouble -> IO (Ptr TopoDS.Solid) 21 | 22 | fromPntAndRadius :: Ptr GP.Pnt -> Double -> Acquire (Ptr TopoDS.Solid) 23 | fromPntAndRadius center radius = mkAcquire (rawFromPntAndRadius center (coerce radius)) (TopoDS.Destructors.deleteShape . castPtr) 24 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepPrimAPI/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | {-# LANGUAGE EmptyDataDecls #-} 3 | module OpenCascade.BRepPrimAPI.Types 4 | ( MakeBox 5 | , MakeRevol 6 | ) where 7 | 8 | import OpenCascade.BRepBuilderAPI.MakeShape 9 | import qualified OpenCascade.Inheritance as Inheritance 10 | 11 | data MakeBox 12 | data MakeRevol 13 | 14 | instance Inheritance.SubTypeOf MakeShape MakeBox 15 | instance Inheritance.SubTypeOf MakeShape MakeRevol -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepTools.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.BRepTools 2 | ( module OpenCascade.BRepTools.Types 3 | ) where 4 | 5 | import OpenCascade.BRepTools.Types -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepTools/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.BRepTools.Internal.Destructors 3 | ( deleteWireExplorer 4 | ) where 5 | 6 | import OpenCascade.BRepTools.Types 7 | 8 | import Foreign.Ptr 9 | 10 | foreign import capi unsafe "hs_BRepTools_WireExplorer.h hs_delete_BRepTools_WireExplorer" deleteWireExplorer :: Ptr WireExplorer -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/BRepTools/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.BRepTools.Types 3 | ( WireExplorer 4 | ) where 5 | 6 | data WireExplorer -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Bnd/Box.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.Bnd.Box 3 | ( Box 4 | , new 5 | , cornerMin 6 | , cornerMax 7 | ) where 8 | 9 | import OpenCascade.Bnd.Types 10 | import OpenCascade.Bnd.Internal.Destructors (deleteBox) 11 | import OpenCascade.GP.Types (Pnt) 12 | import OpenCascade.GP.Internal.Destructors (deletePnt) 13 | import Data.Acquire (Acquire, mkAcquire) 14 | import Foreign.Ptr (Ptr) 15 | 16 | foreign import capi unsafe "hs_Bnd_Box.h hs_new_Bnd_Box" rawNew :: IO (Ptr Box) 17 | 18 | new :: Acquire (Ptr Box) 19 | new = mkAcquire rawNew deleteBox 20 | 21 | foreign import capi unsafe "hs_Bnd_Box.h hs_Bnd_Box_cornerMin" rawCornerMin :: Ptr Box -> IO (Ptr Pnt) 22 | 23 | cornerMin :: Ptr Box -> Acquire (Ptr Pnt) 24 | cornerMin box = mkAcquire (rawCornerMin box) deletePnt 25 | 26 | foreign import capi unsafe "hs_Bnd_Box.h hs_Bnd_Box_cornerMax" rawCornerMax :: Ptr Box -> IO (Ptr Pnt) 27 | 28 | cornerMax :: Ptr Box -> Acquire (Ptr Pnt) 29 | cornerMax box = mkAcquire (rawCornerMax box) deletePnt -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Bnd/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.Bnd.Internal.Destructors 3 | ( deleteBox 4 | , deleteOBB 5 | ) where 6 | 7 | import Foreign.Ptr 8 | import OpenCascade.Bnd.Types 9 | 10 | foreign import capi unsafe "hs_Bnd_Box.h hs_delete_Bnd_Box" deleteBox :: Ptr Box -> IO () 11 | foreign import capi unsafe "hs_Bnd_OBB.h hs_delete_Bnd_OBB" deleteOBB :: Ptr OBB -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Bnd/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.Bnd.Types 3 | ( Box 4 | , OBB 5 | ) where 6 | 7 | data Box 8 | data OBB -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Font/FontAspect.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.Font.FontAspect 2 | ( FontAspect (..) 3 | ) where 4 | 5 | data FontAspect = Undefined | Regular | Bold | Italic | BoldItalic deriving (Enum, Show) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Font/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.Font.Internal.Destructors 3 | ( deleteBRepFont 4 | , deleteBRepTextBuilder 5 | ) where 6 | 7 | 8 | import OpenCascade.Font.Types 9 | 10 | import Foreign.Ptr 11 | 12 | foreign import capi unsafe "hs_Font_BRepFont.h hs_delete_Font_BRepFont" deleteBRepFont :: Ptr BRepFont -> IO () 13 | 14 | foreign import capi unsafe "hs_Font_BRepTextBuilder.h hs_delete_Font_BRepTextBuilder" deleteBRepTextBuilder :: Ptr BRepTextBuilder -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Font/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.Font.Types 3 | ( BRepFont 4 | , BRepTextBuilder 5 | ) where 6 | 7 | data BRepFont 8 | data BRepTextBuilder -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GC/MakeSegment.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.GC.MakeSegment 3 | ( fromPnts 4 | ) where 5 | 6 | import qualified OpenCascade.Geom.Internal.Destructors as Geom.Destructors 7 | import qualified OpenCascade.GP as GP 8 | import qualified OpenCascade.Geom as Geom 9 | import OpenCascade.Handle 10 | import Foreign.Ptr 11 | import Data.Acquire 12 | 13 | 14 | -- fromPnts 15 | 16 | foreign import capi unsafe "hs_GC_MakeSegment.h hs_GC_MakeSegment_fromPnts" rawFromPnts :: Ptr GP.Pnt -> Ptr GP.Pnt -> IO (Ptr (Handle (Geom.TrimmedCurve))) 17 | 18 | fromPnts :: Ptr GP.Pnt -> Ptr GP.Pnt -> Acquire (Ptr (Handle Geom.TrimmedCurve)) 19 | fromPnts start end = mkAcquire (rawFromPnts start end) Geom.Destructors.deleteHandleTrimmedCurve 20 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GP/GTrsf.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.GP.GTrsf 3 | ( GTrsf 4 | , new 5 | , setValue 6 | , setForm 7 | ) where 8 | 9 | import OpenCascade.GP.Types 10 | import OpenCascade.GP.Internal.Destructors 11 | import Foreign.C 12 | import Foreign.Ptr 13 | import Data.Coerce (coerce) 14 | import Data.Acquire 15 | 16 | foreign import capi unsafe "hs_gp_GTrsf.h hs_new_gp_GTrsf" rawNew ::IO (Ptr GTrsf) 17 | 18 | new :: Acquire (Ptr GTrsf) 19 | new = mkAcquire rawNew deleteGTrsf 20 | 21 | foreign import capi unsafe "hs_gp_GTrsf.h hs_gp_GTrsf_setValue" rawSetValue :: Ptr GTrsf -> CInt -> CInt -> CDouble -> IO () 22 | 23 | setValue :: Ptr GTrsf -> Int -> Int -> Double -> IO () 24 | setValue trsf row column value = rawSetValue trsf (fromIntegral row) (fromIntegral column) (coerce value) 25 | 26 | foreign import capi unsafe "hs_gp_GTrsf.h hs_gp_GTrsf_setForm" setForm :: Ptr GTrsf -> IO () 27 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GP/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.GP.Types 3 | ( Pnt 4 | , Pnt2d 5 | , Ax1 6 | , Ax2 7 | , Ax2d 8 | , Ax3 9 | , Dir 10 | , Dir2d 11 | , Vec 12 | , Vec2d 13 | , Trsf 14 | , Trsf2d 15 | , GTrsf 16 | , XYZ 17 | ) where 18 | 19 | data Pnt 20 | data Pnt2d 21 | data Ax1 22 | data Ax2 23 | data Ax2d 24 | data Ax3 25 | data Dir 26 | data Dir2d 27 | data Vec 28 | data Vec2d 29 | data Trsf 30 | data Trsf2d 31 | data GTrsf 32 | data XYZ 33 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GProp/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.GProp.Internal.Destructors 3 | ( deleteGProps 4 | ) where 5 | 6 | import OpenCascade.GProp.Types 7 | 8 | import Foreign.Ptr (Ptr) 9 | 10 | foreign import capi unsafe "hs_GProp_GProps.h hs_delete_GProp_GProps" deleteGProps :: Ptr GProps-> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GProp/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.GProp.Types 3 | ( GProps 4 | ) where 5 | 6 | data GProps -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Geom.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.Geom 2 | ( module OpenCascade.Geom.Types 3 | ) where 4 | 5 | import OpenCascade.Geom.Types 6 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Geom/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.Geom.Internal.Destructors 3 | ( deleteHandleCurve 4 | , deleteHandleTrimmedCurve 5 | , deleteHandleBezierCurve 6 | , deleteHandleBSplineCurve 7 | , deleteBezierCurve 8 | ) where 9 | 10 | import OpenCascade.Geom.Types 11 | 12 | import OpenCascade.Handle 13 | 14 | import Foreign.Ptr 15 | 16 | foreign import capi unsafe "hs_Geom_Curve.h hs_delete_Handle_Geom_Curve" deleteHandleCurve :: Ptr (Handle Curve) -> IO () 17 | 18 | foreign import capi unsafe "hs_Geom_TrimmedCurve.h hs_delete_Handle_Geom_TrimmedCurve" deleteHandleTrimmedCurve :: Ptr (Handle TrimmedCurve) -> IO () 19 | 20 | foreign import capi unsafe "hs_Geom_BezierCurve.h hs_delete_Handle_Geom_BezierCurve" deleteHandleBezierCurve :: Ptr (Handle BezierCurve) -> IO () 21 | 22 | foreign import capi unsafe "hs_Geom_BSplineCurve.h hs_delete_Handle_Geom_BSplineCurve" deleteHandleBSplineCurve :: Ptr (Handle BSplineCurve) -> IO () 23 | 24 | foreign import capi unsafe "hs_Geom_BezierCurve.h hs_delete_Geom_BezierCurve" deleteBezierCurve :: Ptr BezierCurve -> IO () 25 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Geom/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | {-# LANGUAGE EmptyDataDecls #-} 3 | module OpenCascade.Geom.Types 4 | ( Curve 5 | , TrimmedCurve 6 | , BezierCurve 7 | , BSplineCurve 8 | , Surface 9 | ) where 10 | 11 | import OpenCascade.Inheritance 12 | 13 | data Curve 14 | data TrimmedCurve 15 | data BezierCurve 16 | data BSplineCurve 17 | data Surface 18 | 19 | instance SubTypeOf Curve TrimmedCurve 20 | instance SubTypeOf Curve BezierCurve 21 | instance SubTypeOf Curve BSplineCurve 22 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GeomAbs/CurveType.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.GeomAbs.CurveType 2 | ( CurveType (..) 3 | ) where 4 | 5 | -- This needs to stay up to date with GeomAbs_CurveType.hxx 6 | data CurveType 7 | = Line 8 | | Circle 9 | | Ellipse 10 | | Hyperbola 11 | | Parabola 12 | | BezierCurve 13 | | BSplineCurve 14 | | OffsetCurve 15 | | OtherCurve 16 | deriving (Enum, Show) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GeomAbs/JoinType.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.GeomAbs.JoinType 2 | ( JoinType (..) 3 | ) where 4 | 5 | -- This needs to stay up to date with GeomAbs_JoinType.hxx 6 | data JoinType = Arc | Tangent | Intersection deriving (Enum, Show) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GeomAbs/Shape.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.GeomAbs.Shape 2 | ( Shape (..) 3 | ) where 4 | 5 | -- This needs to stay up to date with GeomAbs_Shape.hxx 6 | data Shape = C0 | G1 | C1 | G2 | C2 | C3 | CN 7 | deriving (Enum, Show) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GeomAdaptor/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.GeomAdaptor.Internal.Destructors 3 | ( deleteCurve 4 | ) where 5 | 6 | import OpenCascade.GeomAdaptor.Types (Curve) 7 | import Foreign.Ptr 8 | 9 | foreign import capi unsafe "hs_GeomAdaptor_Curve.h hs_delete_GeomAdaptor_Curve" deleteCurve :: Ptr Curve -> IO () 10 | 11 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GeomAdaptor/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.GeomAdaptor.Types 3 | ( Curve 4 | ) where 5 | 6 | data Curve -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GeomConvert/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.GeomConvert.Internal.Destructors 3 | ( deleteBSplineCurveToBezierCurve 4 | , deleteApproxCurve 5 | ) where 6 | 7 | import OpenCascade.GeomConvert.Types 8 | 9 | import Foreign.Ptr 10 | 11 | foreign import capi unsafe "hs_GeomConvert_BSplineCurveToBezierCurve.h hs_delete_GeomConvert_BSplineCurveToBezierCurve" deleteBSplineCurveToBezierCurve :: Ptr BSplineCurveToBezierCurve -> IO () 12 | foreign import capi unsafe "hs_GeomConvert_ApproxCurve.h hs_delete_GeomConvert_ApproxCurve" deleteApproxCurve :: Ptr ApproxCurve -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GeomConvert/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.GeomConvert.Types 3 | ( BSplineCurveToBezierCurve 4 | , ApproxCurve 5 | ) where 6 | 7 | data BSplineCurveToBezierCurve 8 | data ApproxCurve 9 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GeomFill.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.GeomFill ( 2 | Trihedron 3 | ) where 4 | import OpenCascade.GeomFill.Trihedron -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/GeomFill/Trihedron.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.GeomFill.Trihedron 2 | ( Trihedron (..) 3 | ) where 4 | 5 | -- this should match the enumeration in GeomFill_Trihedron 6 | data Trihedron = IsCorrectedFrenet | IsFixed | IsFrenet | IsConstantNormal | 7 | IsDarboux | IsGuideAC | IsGuidePlan | IsGuideACWithContact | 8 | IsGuidePlanWithContact | IsDiscreteTrihedron deriving (Show, Eq, Enum) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Graphic3D/HorizontalTextAlignment.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.Graphic3D.HorizontalTextAlignment 2 | ( HorizontalTextAlignment (..) 3 | ) where 4 | 5 | import Prelude hiding (Either (..)) 6 | 7 | -- Should match the order in Graphic3D.HorizontalTextAlignment.hxx 8 | data HorizontalTextAlignment = Left | Center | Right deriving (Enum, Show) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Graphic3D/VerticalTextAlignment.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.Graphic3D.VerticalTextAlignment 2 | ( VerticalTextAlignment (..) 3 | ) where 4 | 5 | -- Should match the order in Graphic3D.HorizontalTextAlignment.hxx 6 | data VerticalTextAlignment = Bottom | Center | Top | TopFirstLine deriving (Enum, Show) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/HLRAlgo/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.HLRAlgo.Internal.Destructors 3 | ( deleteProjector 4 | ) where 5 | 6 | import OpenCascade.HLRAlgo.Types 7 | 8 | 9 | import Foreign.Ptr 10 | 11 | foreign import capi unsafe "hs_HLRAlgo_Projector.h hs_delete_HLRAlgo_Projector" deleteProjector :: Ptr Projector -> IO () 12 | 13 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/HLRAlgo/Projector.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.HLRAlgo.Projector 3 | ( Projector 4 | , fromAx2 5 | ) where 6 | import qualified OpenCascade.GP.Types as GP 7 | import OpenCascade.HLRAlgo.Types (Projector) 8 | import OpenCascade.HLRAlgo.Internal.Destructors (deleteProjector) 9 | import Foreign.Ptr 10 | import Data.Acquire (mkAcquire, Acquire) 11 | 12 | foreign import capi unsafe "hs_HLRAlgo_Projector.h hs_new_HLRAlgo_Projector_fromAx2" rawFromAx2 :: Ptr GP.Ax2 -> IO (Ptr Projector) 13 | 14 | fromAx2 :: Ptr GP.Ax2 -> Acquire (Ptr Projector) 15 | fromAx2 ax2 = mkAcquire (rawFromAx2 ax2) deleteProjector 16 | 17 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/HLRAlgo/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.HLRAlgo.Types 3 | ( Projector 4 | ) where 5 | 6 | data Projector -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/HLRBRep/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.HLRBRep.Internal.Destructors 3 | ( deleteAlgo 4 | , deleteHLRToShape 5 | ) where 6 | 7 | import OpenCascade.HLRBRep.Types 8 | import OpenCascade.Handle 9 | 10 | import Foreign.Ptr 11 | 12 | foreign import capi unsafe "hs_HLRBRep_Algo.h hs_delete_HLRBRep_Algo" deleteAlgo :: Ptr (Handle Algo) -> IO () 13 | foreign import capi unsafe "hs_HLRBRep_HLRToShape.h hs_delete_HLRBRep_HLRToShape" deleteHLRToShape :: Ptr HLRToShape -> IO () 14 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/HLRBRep/TypeOfResultingEdge.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.HLRBRep.TypeOfResultingEdge 2 | ( TypeOfResultingEdge (..) 3 | ) where 4 | 5 | data TypeOfResultingEdge 6 | = Undefined 7 | | IsoLine 8 | | OutLine 9 | | Rg1Line 10 | | RgNLine 11 | | Sharp 12 | deriving (Eq, Ord, Enum, Show) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/HLRBRep/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.HLRBRep.Types 3 | ( Algo 4 | , HLRToShape 5 | ) where 6 | 7 | data Algo 8 | data HLRToShape -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Handle.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | {-# LANGUAGE EmptyDataDecls #-} 3 | module OpenCascade.Handle 4 | ( Handle 5 | ) where 6 | import OpenCascade.Inheritance 7 | 8 | data Handle a 9 | 10 | instance SubTypeOf a b => SubTypeOf (Handle a) (Handle b) 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/IFSelect/ReturnStatus.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.IFSelect.ReturnStatus 2 | ( ReturnStatus (..) 3 | ) where 4 | 5 | -- Should match the order in IFSelect_ReturnStatus.hxx 6 | data ReturnStatus = Void | Done | Error | Fail | Stop deriving (Eq, Enum, Show) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Inheritance.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE MultiParamTypeClasses #-} 2 | 3 | module OpenCascade.Inheritance 4 | ( SubTypeOf (..) 5 | , DiscriminatedSubTypeOf (..) 6 | , unsafeDowncast 7 | ) where 8 | 9 | import Foreign.Ptr 10 | 11 | class SubTypeOf a b where 12 | upcast :: Ptr b -> Ptr a 13 | upcast = castPtr 14 | 15 | class SubTypeOf a b => DiscriminatedSubTypeOf a b where 16 | downcast :: Ptr a -> IO (Maybe (Ptr b)) 17 | 18 | unsafeDowncast :: DiscriminatedSubTypeOf a b => Ptr a -> IO (Ptr b) 19 | unsafeDowncast p = do 20 | maybeT <- downcast p 21 | maybe (error "Incorrect subtype in cast") pure maybeT 22 | 23 | 24 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Internal/Bool.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.Internal.Bool 2 | ( boolToCBool 3 | , cBoolToBool 4 | ) where 5 | 6 | 7 | import Foreign.C 8 | 9 | boolToCBool :: Bool -> CBool 10 | boolToCBool b = if b then 1 else 0 11 | 12 | cBoolToBool :: CBool -> Bool 13 | cBoolToBool = (/=0) 14 | 15 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Message/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.Message.Internal.Destructors 3 | ( deleteProgressRange 4 | ) where 5 | 6 | import OpenCascade.Message.Types 7 | import Foreign.Ptr 8 | 9 | foreign import capi unsafe "hs_Message_ProgressRange.h hs_delete_Message_ProgressRange" deleteProgressRange :: Ptr ProgressRange -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Message/ProgressRange.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.Message.ProgressRange 3 | ( ProgressRange 4 | , new 5 | ) where 6 | 7 | import OpenCascade.Message.Types (ProgressRange) 8 | import OpenCascade.Message.Internal.Destructors (deleteProgressRange) 9 | import Foreign.Ptr (Ptr) 10 | import Data.Acquire (Acquire, mkAcquire) 11 | 12 | foreign import capi unsafe "hs_Message_ProgressRange.h hs_new_Message_ProgressRange" rawNew :: IO (Ptr ProgressRange) 13 | 14 | new :: Acquire (Ptr ProgressRange) 15 | new = mkAcquire rawNew deleteProgressRange -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Message/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.Message.Types 3 | ( ProgressRange 4 | ) where 5 | 6 | data ProgressRange -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/NCollection.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.NCollection ( 2 | module OpenCascade.NCollection.Types 3 | ) where 4 | 5 | import OpenCascade.NCollection.Types -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/NCollection/Array1.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.NCollection.Array1 3 | ( 4 | newGPPntArray, 5 | setValueGPPnt 6 | ) where 7 | 8 | import Data.Acquire 9 | import Foreign.Ptr 10 | import Foreign.C 11 | import OpenCascade.GP.Types 12 | import OpenCascade.NCollection.Types 13 | import OpenCascade.NCollection.Internal.Destructors 14 | 15 | foreign import capi unsafe "hs_NCollection_Array1.h hs_new_NCollection_Array1_gp_Pnt" rawNewGPPntArray :: CInt -> CInt -> IO (Ptr (Array1 Pnt)) 16 | 17 | newGPPntArray :: Int -> Int -> Acquire (Ptr (Array1 Pnt)) 18 | newGPPntArray lo hi = mkAcquire (rawNewGPPntArray (fromIntegral lo) (fromIntegral hi)) deletePntArray 19 | 20 | foreign import capi unsafe "hs_NCollection_Array1.h hs_NCollection_Array1_gp_Pnt_setValue" rawSetValueGPPnt :: Ptr (Array1 Pnt) -> CInt -> Ptr Pnt -> IO () 21 | 22 | setValueGPPnt :: Ptr (Array1 Pnt) -> Int -> Ptr Pnt -> IO () 23 | setValueGPPnt arr i p = rawSetValueGPPnt arr (fromIntegral i) p 24 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/NCollection/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.NCollection.Internal.Destructors 3 | ( deletePntArray 4 | ) where 5 | 6 | import OpenCascade.NCollection.Types 7 | import OpenCascade.GP.Types 8 | import Foreign.Ptr 9 | 10 | foreign import capi unsafe "hs_NCollection_Array1.h hs_delete_NCollection_Array1_gp_Pnt" deletePntArray :: Ptr (Array1 Pnt) -> IO () 11 | 12 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/NCollection/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.NCollection.Types 3 | ( Array1 4 | ) where 5 | 6 | data Array1 a -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Poly/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.Poly.Internal.Destructors 3 | ( deleteHandleTriangulation 4 | , deleteTriangle 5 | ) where 6 | 7 | import OpenCascade.Poly.Types 8 | import OpenCascade.Handle (Handle) 9 | import Foreign.Ptr (Ptr) 10 | 11 | foreign import capi unsafe "hs_Poly_Triangulation.h hs_delete_Poly_Triangulation" deleteHandleTriangulation :: Ptr (Handle Triangulation) -> IO () 12 | 13 | foreign import capi unsafe "hs_Poly_Triangle.h hs_delete_Poly_Triangle" deleteTriangle :: Ptr Triangle -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/Poly/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.Poly.Types 3 | (Triangulation 4 | , Triangle 5 | ) where 6 | 7 | data Triangulation 8 | data Triangle -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/RWGltf/CafReader.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.RWGltf.CafReader 3 | ( CafReader 4 | , new 5 | , setDoublePrecision 6 | ) where 7 | 8 | import OpenCascade.RWGltf.Types (CafReader) 9 | import OpenCascade.RWGltf.Internal.Destructors (deleteCafReader) 10 | import Data.Acquire (Acquire, mkAcquire) 11 | import OpenCascade.Internal.Bool (boolToCBool) 12 | import Foreign.C (CBool (..)) 13 | import Foreign.Ptr (Ptr) 14 | 15 | foreign import capi unsafe "hs_RWGltf_CafReader.h hs_new_RWGltf_CafReader" rawNew :: IO (Ptr CafReader) 16 | 17 | new :: Acquire (Ptr CafReader) 18 | new = mkAcquire rawNew deleteCafReader 19 | 20 | 21 | foreign import capi unsafe "hs_RWGltf_CafReader.h hs_RWGltf_CafReader_setDoublePrecision" rawSetDoublePrecision :: Ptr CafReader -> CBool -> IO () 22 | 23 | setDoublePrecision :: Ptr CafReader -> Bool -> IO () 24 | setDoublePrecision reader isDouble = rawSetDoublePrecision reader (boolToCBool isDouble) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/RWGltf/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.RWGltf.Internal.Destructors 3 | ( deleteCafWriter 4 | , deleteCafReader 5 | ) where 6 | 7 | import OpenCascade.RWGltf.Types 8 | import Foreign.Ptr 9 | 10 | foreign import capi unsafe "hs_RWGltf_CafWriter.h hs_delete_RWGltf_CafWriter" deleteCafWriter :: Ptr CafWriter -> IO () 11 | foreign import capi unsafe "hs_RWGltf_CafReader.h hs_delete_RWGltf_CafReader" deleteCafReader :: Ptr CafReader -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/RWGltf/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | module OpenCascade.RWGltf.Types 4 | ( CafWriter 5 | , CafReader 6 | ) where 7 | 8 | import OpenCascade.Inheritance (SubTypeOf) 9 | import qualified OpenCascade.RWMesh.Types as RWMesh 10 | 11 | data CafWriter 12 | data CafReader 13 | 14 | instance SubTypeOf RWMesh.CafReader CafReader -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/RWMesh/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.RWMesh.Types 3 | ( CafReader 4 | ) where 5 | 6 | data CafReader -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/RWObj/CafReader.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.RWObj.CafReader 3 | ( CafReader 4 | , new 5 | , setSinglePrecision 6 | ) where 7 | 8 | import OpenCascade.RWObj.Types (CafReader) 9 | import OpenCascade.RWObj.Internal.Destructors (deleteCafReader) 10 | import Data.Acquire (Acquire, mkAcquire) 11 | import OpenCascade.Internal.Bool (boolToCBool) 12 | import Foreign.C (CBool (..)) 13 | import Foreign.Ptr (Ptr) 14 | 15 | foreign import capi unsafe "hs_RWObj_CafReader.h hs_new_RWObj_CafReader" rawNew :: IO (Ptr CafReader) 16 | 17 | new :: Acquire (Ptr CafReader) 18 | new = mkAcquire rawNew deleteCafReader 19 | 20 | 21 | foreign import capi unsafe "hs_RWObj_CafReader.h hs_RWObj_CafReader_setSinglePrecision" rawSetSinglePrecision :: Ptr CafReader -> CBool -> IO () 22 | 23 | setSinglePrecision :: Ptr CafReader -> Bool -> IO () 24 | setSinglePrecision reader isSingle = rawSetSinglePrecision reader (boolToCBool isSingle) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/RWObj/CafWriter.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.RWObj.CafWriter 3 | ( CafWriter 4 | , new 5 | , perform 6 | ) where 7 | 8 | import OpenCascade.RWObj.Types (CafWriter) 9 | import OpenCascade.RWObj.Internal.Destructors (deleteCafWriter) 10 | import Foreign.Ptr (Ptr) 11 | import Foreign.C.String (CString, withCString) 12 | import Data.Acquire (Acquire, mkAcquire) 13 | import OpenCascade.Handle (Handle) 14 | import qualified OpenCascade.TDocStd.Types as TDocStd 15 | import qualified OpenCascade.TColStd.Types as TColStd 16 | import qualified OpenCascade.Message.Types as Message 17 | 18 | foreign import capi unsafe "hs_RWObj_CafWriter.h hs_new_RWObj_CafWriter" rawNew :: CString -> IO (Ptr CafWriter) 19 | 20 | new :: String -> Acquire (Ptr CafWriter) 21 | new filepath = mkAcquire (withCString filepath rawNew) deleteCafWriter 22 | 23 | foreign import capi unsafe "hs_RWObj_CafWriter.h hs_RWObj_CafWriter_Perform" perform :: Ptr CafWriter -> Ptr (Handle TDocStd.Document) -> Ptr (TColStd.IndexedDataMapOfStringString) -> Ptr (Message.ProgressRange) -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/RWObj/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | 2 | {-# LANGUAGE CApiFFI #-} 3 | module OpenCascade.RWObj.Internal.Destructors 4 | ( deleteCafWriter 5 | , deleteCafReader 6 | ) where 7 | 8 | import OpenCascade.RWObj.Types 9 | import Foreign.Ptr 10 | 11 | foreign import capi unsafe "hs_RWObj_CafWriter.h hs_delete_RWObj_CafWriter" deleteCafWriter :: Ptr CafWriter -> IO () 12 | foreign import capi unsafe "hs_RWObj_CafReader.h hs_delete_RWObj_CafReader" deleteCafReader :: Ptr CafReader -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/RWObj/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | module OpenCascade.RWObj.Types 4 | ( CafWriter 5 | , CafReader 6 | ) where 7 | 8 | import OpenCascade.Inheritance (SubTypeOf) 9 | import qualified OpenCascade.RWMesh.Types as RWMesh 10 | 11 | data CafWriter 12 | data CafReader 13 | 14 | instance SubTypeOf RWMesh.CafReader CafReader -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/STEPControl.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.STEPControl 2 | ( module OpenCascade.STEPControl.Types 3 | ) where 4 | 5 | import OpenCascade.STEPControl.Types -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/STEPControl/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.STEPControl.Internal.Destructors 3 | ( deleteWriter 4 | , deleteReader 5 | ) where 6 | 7 | import OpenCascade.STEPControl.Types 8 | 9 | import Foreign.Ptr 10 | 11 | foreign import capi unsafe "hs_STEPControl_Writer.h hs_delete_STEPControl_Writer" deleteWriter :: Ptr Writer -> IO () 12 | foreign import capi unsafe "hs_STEPControl_Reader.h hs_delete_STEPControl_Reader" deleteReader :: Ptr Reader -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/STEPControl/Reader.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.STEPControl.Reader 3 | ( Reader 4 | , new 5 | ) where 6 | 7 | import OpenCascade.STEPControl.Types (Reader) 8 | import OpenCascade.STEPControl.Internal.Destructors (deleteReader) 9 | import Foreign.Ptr (Ptr) 10 | import Data.Acquire (Acquire, mkAcquire) 11 | 12 | 13 | foreign import capi unsafe "hs_STEPControl_Reader.h hs_new_STEPControl_Reader" rawNew :: IO (Ptr Reader) 14 | 15 | new :: Acquire (Ptr Reader) 16 | new = mkAcquire rawNew deleteReader -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/STEPControl/StepModelType.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.STEPControl.StepModelType 2 | ( StepModelType(..) 3 | ) where 4 | 5 | -- this should match the order defined in StepModelType 6 | data StepModelType = 7 | Asls | 8 | ManifoldSolidBrep | 9 | BrepWithVoids | 10 | FacetedBrep | 11 | FacetedBrepAndBrepWithVoids | 12 | ShellBasedSurfaceModel | 13 | GeometricCurveSet | 14 | Hybrid 15 | deriving Enum -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/STEPControl/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | module OpenCascade.STEPControl.Types 4 | ( Writer 5 | , Reader 6 | ) where 7 | 8 | import OpenCascade.Inheritance 9 | import qualified OpenCascade.XSControl.Types as XSControl 10 | data Writer 11 | data Reader 12 | 13 | instance SubTypeOf XSControl.Reader Reader -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/ShapeConstruct/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.ShapeConstruct.Internal.Destructors 3 | ( deleteCurve 4 | ) where 5 | 6 | import OpenCascade.ShapeConstruct.Types 7 | import Foreign.Ptr 8 | 9 | foreign import capi unsafe "hs_ShapeConstruct_Curve.h hs_delete_ShapeConstruct_Curve" deleteCurve :: Ptr Curve -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/ShapeConstruct/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.ShapeConstruct.Types 3 | ( Curve 4 | ) where 5 | 6 | data Curve -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/ShapeExtend/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.ShapeExtend.Internal.Destructors 3 | ( deleteWireData 4 | ) where 5 | 6 | import OpenCascade.ShapeExtend.Types (WireData) 7 | 8 | import Foreign.Ptr 9 | 10 | foreign import capi unsafe "hs_ShapeExtend_WireData.h hs_delete_ShapeExtend_WireData" deleteWireData :: Ptr WireData -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/ShapeExtend/Status.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.ShapeExtend.Status 2 | ( Status (..) 3 | ) where 4 | 5 | -- This needs to match the definition in ShapeExtend_Status.hxx 6 | data Status = 7 | OK | 8 | DONE1 | 9 | DONE2 | 10 | DONE3 | 11 | DONE4 | 12 | DONE5 | 13 | DONE6 | 14 | DONE7 | 15 | DONE8 | 16 | DONE | 17 | FAIL1 | 18 | FAIL2 | 19 | FAIL3 | 20 | FAIL4 | 21 | FAIL5 | 22 | FAIL6 | 23 | FAIL7 | 24 | FAIL8 | 25 | FAIL deriving (Show, Eq, Enum) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/ShapeExtend/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.ShapeExtend.Types 3 | ( WireData 4 | ) where 5 | 6 | data WireData -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/ShapeFix/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.ShapeFix.Internal.Destructors (deleteSolid) where 3 | 4 | import OpenCascade.ShapeFix.Types (Solid) 5 | import Foreign.Ptr (Ptr) 6 | 7 | foreign import capi unsafe "hs_ShapeFix_Solid.h hs_delete_ShapeFix_Solid" deleteSolid :: Ptr Solid -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/ShapeFix/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.ShapeFix.Types 3 | ( Solid 4 | ) where 5 | 6 | data Solid -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/StlAPI.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.StlAPI 2 | ( module OpenCascade.StlAPI.Types 3 | ) where 4 | 5 | import OpenCascade.StlAPI.Types 6 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/StlAPI/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.StlAPI.Internal.Destructors 3 | ( deleteWriter 4 | , deleteReader 5 | ) where 6 | 7 | import OpenCascade.StlAPI.Types 8 | 9 | import Foreign.Ptr 10 | 11 | foreign import capi unsafe "hs_StlAPI_Writer.h hs_delete_StlAPI_Writer" deleteWriter :: Ptr Writer -> IO () 12 | foreign import capi unsafe "hs_StlAPI_Reader.h hs_delete_StlAPI_Reader" deleteReader :: Ptr Reader -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/StlAPI/Reader.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.StlAPI.Reader 3 | ( Reader 4 | , new 5 | , read 6 | ) where 7 | 8 | import Prelude hiding (read) 9 | import OpenCascade.StlAPI.Types (Reader) 10 | import OpenCascade.StlAPI.Internal.Destructors (deleteReader) 11 | import qualified OpenCascade.TopoDS as TopoDS 12 | import Foreign.C 13 | import Foreign.Ptr 14 | import Data.Acquire 15 | import OpenCascade.Internal.Bool (cBoolToBool) 16 | 17 | foreign import capi unsafe "hs_StlAPI_Reader.h hs_new_StlAPI_Reader" rawNew :: IO (Ptr Reader) 18 | 19 | new :: Acquire (Ptr Reader) 20 | new = mkAcquire rawNew deleteReader 21 | 22 | foreign import capi unsafe "hs_StlAPI_Reader.h hs_StlAPI_Reader_read" rawRead :: Ptr Reader -> Ptr TopoDS.Shape -> CString -> IO (CBool) 23 | 24 | read :: Ptr Reader -> Ptr TopoDS.Shape -> String -> IO (Bool) 25 | read reader shape filename = cBoolToBool <$> withCString filename (rawRead reader shape) -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/StlAPI/Types.hs: -------------------------------------------------------------------------------- 1 | 2 | {-# LANGUAGE EmptyDataDecls #-} 3 | module OpenCascade.StlAPI.Types 4 | ( Writer 5 | , Reader 6 | ) where 7 | 8 | data Writer 9 | data Reader -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TColStd/IndexedDataMapOfStringString.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TColStd.IndexedDataMapOfStringString 3 | ( IndexedDataMapOfStringString 4 | , new 5 | ) where 6 | 7 | import OpenCascade.TColStd.Types (IndexedDataMapOfStringString) 8 | import OpenCascade.TColStd.Internal.Destructors (deleteIndexedDataMapOfStringString) 9 | import Foreign.Ptr (Ptr) 10 | import Data.Acquire (Acquire, mkAcquire) 11 | 12 | foreign import capi unsafe "hs_TColStd_IndexedDataMapOfStringString.h hs_new_TColStd_IndexedDataMapOfStringString" rawNew :: IO (Ptr IndexedDataMapOfStringString) 13 | 14 | new :: Acquire (Ptr IndexedDataMapOfStringString) 15 | new = mkAcquire rawNew deleteIndexedDataMapOfStringString -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TColStd/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TColStd.Internal.Destructors 3 | ( deleteIndexedDataMapOfStringString 4 | ) where 5 | 6 | import OpenCascade.TColStd.Types 7 | import Foreign.Ptr 8 | 9 | foreign import capi unsafe "hs_TColStd_IndexedDataMapOfStringString.h hs_delete_TColStd_IndexedDataMapOfStringString" deleteIndexedDataMapOfStringString :: Ptr (IndexedDataMapOfStringString) -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TColStd/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.TColStd.Types 3 | ( IndexedDataMapOfStringString 4 | ) where 5 | 6 | data IndexedDataMapOfStringString -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TDF/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TDF.Internal.Destructors 3 | ( deleteLabel 4 | ) where 5 | import OpenCascade.TDF.Types 6 | import Foreign.Ptr (Ptr) 7 | 8 | 9 | foreign import capi unsafe "hs_TDF_Label.h hs_delete_TDF_Label" deleteLabel :: Ptr Label -> IO () 10 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TDF/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.TDF.Types 3 | ( Label 4 | ) where 5 | 6 | data Label -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TDocStd/Document.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TDocStd.Document 3 | ( Document 4 | , fromStorageFormat 5 | , main 6 | ) where 7 | 8 | import OpenCascade.TDocStd.Types (Document) 9 | import OpenCascade.TDocStd.Internal.Destructors (deleteDocumentHandle) 10 | import OpenCascade.TDF.Types (Label) 11 | import OpenCascade.TDF.Internal.Destructors (deleteLabel) 12 | import OpenCascade.Handle (Handle) 13 | import Data.Acquire (Acquire, mkAcquire) 14 | import Foreign.Ptr (Ptr) 15 | import Foreign.C.String (CString, withCString) 16 | 17 | foreign import capi unsafe "hs_TDocStd_Document.h hs_new_TDocStd_Document" rawNew :: CString -> IO (Ptr (Handle Document)) 18 | 19 | fromStorageFormat :: String -> Acquire (Ptr (Handle Document)) 20 | fromStorageFormat fmt = mkAcquire (withCString fmt rawNew) deleteDocumentHandle 21 | 22 | foreign import capi unsafe "hs_TDocStd_Document.h hs_TDocStd_Document_main" rawMain :: Ptr (Handle Document) -> IO (Ptr Label) 23 | 24 | main :: Ptr (Handle Document) -> Acquire (Ptr Label) 25 | main doc = mkAcquire (rawMain doc) deleteLabel -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TDocStd/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TDocStd.Internal.Destructors (deleteDocumentHandle) where 3 | 4 | import OpenCascade.Handle (Handle) 5 | import OpenCascade.TDocStd.Types (Document) 6 | import Foreign.Ptr (Ptr) 7 | 8 | foreign import capi unsafe "hs_TDocStd_Document.h hs_delete_TDocStd_Document" deleteDocumentHandle :: Ptr (Handle Document) -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TDocStd/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.TDocStd.Types (Document) where 3 | 4 | data Document -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopAbs.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.TopAbs 2 | ( Orientation 3 | , ShapeEnum 4 | ) 5 | where 6 | import OpenCascade.TopAbs.Orientation 7 | import OpenCascade.TopAbs.ShapeEnum 8 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopAbs/Orientation.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.TopAbs.Orientation 2 | ( Orientation (..) 3 | ) where 4 | 5 | -- this should match the orientation in TopAbs_Orientation 6 | data Orientation = Forward | Reversed | Internal | External deriving (Show, Enum, Eq) 7 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopAbs/ShapeEnum.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.TopAbs.ShapeEnum 2 | ( ShapeEnum (..) 3 | ) where 4 | 5 | -- this should match the enumeration in TopAbs_ShapeEnum 6 | data ShapeEnum = Compound | CompSolid | Solid | Shell | Face | Wire | Edge | Vertex | Shape deriving (Show, Eq, Enum) 7 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopExp.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.TopExp 2 | ( module OpenCascade.TopExp.Types 3 | ) where 4 | 5 | import OpenCascade.TopExp.Types 6 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopExp/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopExp.Internal.Destructors 3 | ( deleteExplorer 4 | ) where 5 | 6 | import OpenCascade.TopExp.Types 7 | 8 | import Foreign.Ptr 9 | 10 | foreign import capi unsafe "hs_TopExp_Explorer.h hs_delete_TopExp_Explorer" deleteExplorer :: Ptr Explorer -> IO () 11 | 12 | 13 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopExp/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.TopExp.Types 3 | ( Explorer 4 | ) where 5 | 6 | data Explorer -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopLoc.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.TopLoc 2 | ( module OpenCascade.TopLoc.Types 3 | ) where 4 | import OpenCascade.TopLoc.Types 5 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopLoc/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopLoc.Internal.Destructors 3 | ( deleteLocation 4 | ) where 5 | 6 | import OpenCascade.TopLoc.Types 7 | 8 | import Foreign.Ptr 9 | 10 | foreign import capi unsafe "hs_TopLoc_Location.h hs_delete_TopLoc_Location" deleteLocation :: Ptr Location -> IO () 11 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopLoc/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.TopLoc.Types 3 | ( Location 4 | ) where 5 | 6 | data Location 7 | 8 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopTools.hs: -------------------------------------------------------------------------------- 1 | module OpenCascade.TopTools 2 | ( module OpenCascade.TopTools.Types 3 | ) where 4 | import OpenCascade.TopTools.Types 5 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopTools/ShapeMapHasher.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopTools.ShapeMapHasher 3 | ( hash 4 | , isEqual 5 | ) where 6 | 7 | import qualified OpenCascade.TopoDS.Types as TopoDS 8 | import Foreign.Ptr (Ptr) 9 | import Foreign.C (CInt (..), CBool (..)) 10 | import OpenCascade.Internal.Bool (cBoolToBool) 11 | 12 | foreign import capi unsafe "hs_TopTools_ShapeMapHasher.h hs_TopTools_ShapeMapHasher_hash" rawHash :: Ptr TopoDS.Shape -> IO (CInt) 13 | 14 | hash :: Ptr TopoDS.Shape -> IO Int 15 | hash s = fromIntegral <$> rawHash s 16 | 17 | foreign import capi unsafe "hs_TopTools_ShapeMapHasher.h hs_TopTools_ShapeMapHasher_isEqual" rawIsEqual :: Ptr TopoDS.Shape -> Ptr TopoDS.Shape -> IO (CBool) 18 | 19 | isEqual :: Ptr TopoDS.Shape -> Ptr TopoDS.Shape -> IO Bool 20 | isEqual a b = cBoolToBool <$> rawIsEqual a b -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopTools/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.TopTools.Types 3 | ( ListOfShape 4 | ) where 5 | 6 | data ListOfShape 7 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE ScopedTypeVariables #-} 2 | {-# LANGUAGE MultiParamTypeClasses #-} 3 | module OpenCascade.TopoDS 4 | ( module OpenCascade.TopoDS.Types 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS/CompSolid.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopoDS.CompSolid 3 | ( CompSolid 4 | , new 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types 8 | import OpenCascade.TopoDS.Internal.Destructors 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | 12 | -- new 13 | 14 | foreign import capi unsafe "hs_TopoDS_CompSolid.h hs_new_TopoDS_CompSolid" rawNew :: IO (Ptr CompSolid) 15 | 16 | new :: Acquire (Ptr CompSolid) 17 | new = mkAcquire rawNew (deleteShape . castPtr) 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS/Compound.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopoDS.Compound 3 | ( Compound 4 | , new 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types 8 | import OpenCascade.TopoDS.Internal.Destructors 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | 12 | -- new 13 | 14 | foreign import capi unsafe "hs_TopoDS_Compound.h hs_new_TopoDS_Compound" rawNew :: IO (Ptr Compound) 15 | 16 | new :: Acquire (Ptr Compound) 17 | new = mkAcquire rawNew (deleteShape . castPtr) 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS/Edge.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopoDS.Edge 3 | ( Edge 4 | , new 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types 8 | import OpenCascade.TopoDS.Internal.Destructors 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | 12 | -- new 13 | 14 | foreign import capi unsafe "hs_TopoDS_Edge.h hs_new_TopoDS_Edge" rawNew :: IO (Ptr Edge) 15 | 16 | new :: Acquire (Ptr Edge) 17 | new = mkAcquire rawNew (deleteShape . castPtr) 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS/Face.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopoDS.Face 3 | ( Face 4 | , new 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types 8 | import OpenCascade.TopoDS.Internal.Destructors 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | 12 | -- new 13 | 14 | foreign import capi unsafe "hs_TopoDS_Face.h hs_new_TopoDS_Face" rawNew :: IO (Ptr Face) 15 | 16 | new :: Acquire (Ptr Face) 17 | new = mkAcquire rawNew (deleteShape . castPtr) 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopoDS.Internal.Destructors 3 | ( deleteShape 4 | , deleteBuilder 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types 8 | 9 | import Foreign.Ptr 10 | 11 | foreign import capi unsafe "hs_TopoDS_Shape.h hs_delete_TopoDS_Shape" deleteShape :: Ptr Shape -> IO () 12 | 13 | foreign import capi unsafe "hs_TopoDS_Builder.h hs_delete_TopoDS_Builder" deleteBuilder :: Ptr Builder -> IO () 14 | 15 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS/Shell.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopoDS.Shell 3 | ( Shell 4 | , new 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types 8 | import OpenCascade.TopoDS.Internal.Destructors 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | 12 | -- new 13 | 14 | foreign import capi unsafe "hs_TopoDS_Shell.h hs_new_TopoDS_Shell" rawNew :: IO (Ptr Shell) 15 | 16 | new :: Acquire (Ptr Shell) 17 | new = mkAcquire rawNew (deleteShape . castPtr) 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS/Solid.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopoDS.Solid 3 | ( Solid 4 | , new 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types 8 | import OpenCascade.TopoDS.Internal.Destructors 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | 12 | -- new 13 | 14 | foreign import capi unsafe "hs_TopoDS_Solid.h hs_new_TopoDS_Solid" rawNew :: IO (Ptr Solid) 15 | 16 | new :: Acquire (Ptr Solid) 17 | new = mkAcquire rawNew (deleteShape . castPtr) 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS/Vertex.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopoDS.Vertex 3 | ( Vertex 4 | , new 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types 8 | import OpenCascade.TopoDS.Internal.Destructors 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | 12 | -- new 13 | 14 | foreign import capi unsafe "hs_TopoDS_Vertex.h hs_new_TopoDS_Vertex" rawNew :: IO (Ptr Vertex) 15 | 16 | new :: Acquire (Ptr Vertex) 17 | new = mkAcquire rawNew (deleteShape . castPtr) 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/TopoDS/Wire.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.TopoDS.Wire 3 | ( Wire 4 | , new 5 | ) where 6 | 7 | import OpenCascade.TopoDS.Types 8 | import OpenCascade.TopoDS.Internal.Destructors 9 | import Foreign.Ptr 10 | import Data.Acquire 11 | 12 | -- new 13 | 14 | foreign import capi unsafe "hs_TopoDS_Wire.h hs_new_TopoDS_Wire" rawNew :: IO (Ptr Wire) 15 | 16 | new :: Acquire (Ptr Wire) 17 | new = mkAcquire rawNew (deleteShape . castPtr) 18 | -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/XCAFDoc/DocumentTool.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.XCAFDoc.DocumentTool 3 | ( shapeTool 4 | ) where 5 | 6 | import OpenCascade.XCAFDoc.Types (ShapeTool) 7 | import OpenCascade.XCAFDoc.Internal.Destructors (deleteShapeToolHandle) 8 | import OpenCascade.TDF.Types (Label) 9 | import OpenCascade.Handle (Handle) 10 | import Foreign.Ptr (Ptr) 11 | import Data.Acquire (Acquire, mkAcquire) 12 | 13 | foreign import capi unsafe "hs_XCAFDoc_DocumentTool.h hs_XCAFDoc_DocumentTool_shapeTool" rawShapeTool :: Ptr Label -> IO (Ptr (Handle ShapeTool)) 14 | 15 | shapeTool :: Ptr Label -> Acquire (Ptr (Handle ShapeTool)) 16 | shapeTool label = mkAcquire (rawShapeTool label) deleteShapeToolHandle -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/XCAFDoc/Internal/Destructors.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.XCAFDoc.Internal.Destructors 3 | ( deleteShapeToolHandle 4 | ) where 5 | 6 | import OpenCascade.XCAFDoc.Types 7 | import OpenCascade.Handle 8 | import Foreign.Ptr 9 | 10 | foreign import capi unsafe "hs_XCAFDoc_ShapeTool.h hs_delete_XCAFDoc_ShapeTool" deleteShapeToolHandle :: Ptr (Handle ShapeTool) -> IO () -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/XCAFDoc/ShapeTool.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE CApiFFI #-} 2 | module OpenCascade.XCAFDoc.ShapeTool 3 | ( ShapeTool 4 | , addShape 5 | ) where 6 | 7 | import OpenCascade.XCAFDoc.Types (ShapeTool) 8 | import qualified OpenCascade.TopoDS.Types as TopoDS 9 | import OpenCascade.Handle (Handle) 10 | import OpenCascade.TDF.Types (Label) 11 | import OpenCascade.TDF.Internal.Destructors (deleteLabel) 12 | import OpenCascade.Internal.Bool (boolToCBool) 13 | import Data.Acquire (Acquire, mkAcquire) 14 | import Foreign.C (CBool (..)) 15 | import Foreign.Ptr (Ptr) 16 | 17 | foreign import capi unsafe "hs_XCAFDoc_ShapeTool.h hs_XCAFDoc_ShapeTool_addShape" rawAddShape :: Ptr (Handle ShapeTool) -> Ptr TopoDS.Shape -> CBool -> CBool -> IO (Ptr Label) 18 | 19 | addShape :: Ptr (Handle ShapeTool) -> Ptr TopoDS.Shape -> Bool -> Bool -> Acquire (Ptr Label) 20 | addShape tool shape makeAssembly makePrepare = mkAcquire (rawAddShape tool shape (boolToCBool makeAssembly) (boolToCBool makePrepare)) deleteLabel -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/XCAFDoc/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.XCAFDoc.Types 3 | ( ShapeTool 4 | ) where 5 | 6 | data ShapeTool -------------------------------------------------------------------------------- /opencascade-hs/src/OpenCascade/XSControl/Types.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE EmptyDataDecls #-} 2 | module OpenCascade.XSControl.Types 3 | ( Reader 4 | ) where 5 | 6 | data Reader -------------------------------------------------------------------------------- /package-defaults.yaml: -------------------------------------------------------------------------------- 1 | _version: &version "0.6.0.0" 2 | _opencascade-hs-bound: &opencascade-hs-bound "opencascade-hs ^>=0.6.0.0" 3 | _waterfall-cad-bound: &waterfall-cad-bound "waterfall-cad ^>=0.6.0.0" 4 | _waterfall-cad-svg-bound: &waterfall-cad-svg-bound "waterfall-cad-svg ^>=0.6.0.0" 5 | _ghc_options: &ghc-options 6 | - -Wall 7 | - -Werror=compat 8 | - -Werror=identities 9 | - -Werror=incomplete-record-updates 10 | - -Werror=incomplete-uni-patterns 11 | - -Werror=missing-home-modules 12 | - -Werror=missing-export-lists 13 | - -Werror=partial-fields 14 | - -Werror=redundant-constraints 15 | - -optc -Werror-implicit-function-declaration 16 | -------------------------------------------------------------------------------- /scripts/releasing: -------------------------------------------------------------------------------- 1 | ## update package-defaults.yaml and */CHANGELOG.md 2 | ## remember to rebuild and add the cabal files 3 | rm -rf dist/* docs/* waterfall-cad-examples-*-docs 4 | stack build 5 | stack sdist --tar-dir dist 6 | stack upload dist/*.tar.gz --candidate 7 | stack haddock --haddock-for-hackage 8 | tar xvf ./waterfall-cad-examples/.stack-work/dist/*/ghc-*/waterfall-cad-examples-*-docs.tar.gz 9 | ./scripts/enrich-examples.hs 10 | tar --format=ustar -czf ./waterfall-cad-examples/.stack-work/dist/*/ghc-*/waterfall-cad-examples-*-docs.tar.gz waterfall-cad-examples-*-docs 11 | stack upload -d opencascade-hs waterfall-cad waterfall-cad-svg waterfall-cad-examples --candidate 12 | 13 | # Check package candidate uploads here 14 | 15 | stack upload dist/*.tar.gz 16 | stack upload -d opencascade-hs waterfall-cad waterfall-cad-svg waterfall-cad-examples 17 | 18 | # delete candidates here -------------------------------------------------------------------------------- /stack.yaml.lock: -------------------------------------------------------------------------------- 1 | # This file was autogenerated by Stack. 2 | # You should not edit this file by hand. 3 | # For more information, please see the documentation at: 4 | # https://docs.haskellstack.org/en/stable/lock_files 5 | 6 | packages: [] 7 | snapshots: 8 | - completed: 9 | sha256: 925e1bf884fd7a1ed2bfca9a041bed96fba51be6148cfa9fc4a590e218c2e483 10 | size: 683820 11 | url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/16.yaml 12 | original: 13 | url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/16.yaml 14 | -------------------------------------------------------------------------------- /waterfall-cad-examples/README.md: -------------------------------------------------------------------------------- 1 | # Examples for Waterfall CAD 2 | 3 | ![Waterfall CAD](https://raw.githubusercontent.com/joe-warren/opencascade-hs/main/images/logo/waterfall-cad-logo-name.svg) -------------------------------------------------------------------------------- /waterfall-cad-examples/src/BoundingBoxExample.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | <> 3 | -} 4 | module BoundingBoxExample 5 | ( boundingBoxExample 6 | ) where 7 | 8 | import Data.Function ((&)) 9 | import qualified Waterfall.Solids as Solids 10 | import qualified Waterfall.BoundingBox.Oriented as OBB 11 | import qualified Waterfall.BoundingBox.AxisAligned as AABB 12 | import qualified Waterfall.Transforms as Transforms 13 | import Linear (V3 (..), unit, _y, _z, (^*)) 14 | 15 | boundingBoxExample :: Solids.Solid 16 | boundingBoxExample = 17 | let shape = Solids.unitSphere & 18 | Transforms.scale (V3 0.5 3 5) & 19 | Transforms.rotate (unit _z) 1 & 20 | Transforms.rotate (unit _y) 0.5 21 | obb = OBB.orientedBoundingBox shape & 22 | maybe Solids.emptySolid OBB.obbToSolid 23 | aabb = AABB.axisAlignedBoundingBox shape & 24 | maybe Solids.emptySolid AABB.aabbToSolid 25 | in mconcat 26 | [ Transforms.translate (unit _y ^* (-5)) shape 27 | , obb 28 | , Transforms.translate (unit _y ^* 5) aabb 29 | ] -------------------------------------------------------------------------------- /waterfall-cad-examples/src/CsgExample.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | <> 3 | -} 4 | module CsgExample 5 | ( csgExample 6 | ) where 7 | 8 | import qualified Waterfall.Solids as Solids 9 | import qualified Waterfall.Transforms as Transforms 10 | import Waterfall.Booleans ( union, intersection, difference ) 11 | import Linear (V3 (..), (^*), unit, _x, _y ) 12 | import Data.Function ((&)) 13 | 14 | csgExample :: Solids.Solid 15 | csgExample = let 16 | sphere = Solids.unitSphere 17 | cube = Transforms.uScale 1.5 Solids.centeredCube 18 | cylinder = Solids.centeredCylinder 19 | & Transforms.scale (V3 0.55 0.55 4) 20 | cylinderA = Transforms.rotate (unit _x) (pi/2) cylinder 21 | cylinderB = Transforms.rotate (unit _y) (pi/2) cylinder 22 | in (cube `intersection` sphere) `difference` (cylinder `union` cylinderA `union` cylinderB) -------------------------------------------------------------------------------- /waterfall-cad-examples/src/OffsetExample.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | <> 3 | -} 4 | module OffsetExample 5 | ( offsetExample 6 | ) where 7 | 8 | import qualified Waterfall.Solids as Solids 9 | import Waterfall.Transforms (translate, rotate, scale) 10 | import Waterfall.Offset (offset) 11 | import Linear ( V3(V3), unit, _x, _y, _z, (^*)) 12 | 13 | offsetExample :: Solids.Solid 14 | offsetExample = 15 | let beam axis = rotate axis (pi/2) (scale (V3 2 2 4) Solids.centeredCube) 16 | cross = foldMap beam [unit _x, unit _y, unit _z] 17 | offsetCross amount = offset amount cross 18 | offsetCrosses = offsetCross <$> [- 0.5, - 0.25, 0, 0.25, 0.5] 19 | position = (unit _x ^* 5 ^*) <$> [0..] 20 | in mconcat $ zipWith translate position offsetCrosses -------------------------------------------------------------------------------- /waterfall-cad-examples/src/PrismExample.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | <> 3 | -} 4 | module PrismExample 5 | ( prismExample 6 | ) where 7 | 8 | import qualified Waterfall.Solids as Solids 9 | import qualified Waterfall.TwoD.Shape as Shape 10 | import qualified Waterfall.TwoD.Path2D as Path2D 11 | import Linear (V2 (..)) 12 | 13 | prismExample :: Solids.Solid 14 | prismExample = Solids.prism 1 . Shape.makeShape $ 15 | Path2D.pathFrom (V2 (-1) (-1)) 16 | [ Path2D.arcViaTo (V2 (-1.5) 0) (V2 (-1) 1) 17 | , Path2D.lineTo (V2 1 1) 18 | , Path2D.bezierTo (V2 1.5 1) (V2 1.5 (-1)) (V2 1 (-1)) 19 | , Path2D.lineTo (V2 (-1) (-1)) 20 | ] -------------------------------------------------------------------------------- /waterfall-cad-examples/src/RevolutionExample.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | <> 3 | -} 4 | module RevolutionExample 5 | ( revolutionExample 6 | ) where 7 | 8 | import Waterfall.Solids (Solid) 9 | import qualified Waterfall.TwoD.Path2D as Path2D 10 | import Waterfall.Revolution (revolution) 11 | import Linear (V2 (..)) 12 | 13 | revolutionExample :: Solid 14 | revolutionExample = 15 | revolution $ 16 | Path2D.pathFrom (V2 0 0) 17 | [ Path2D.lineTo (V2 1 0) 18 | , Path2D.lineRelative (V2 0.1 0.16) 19 | , Path2D.lineTo (V2 1 0.2) 20 | , Path2D.arcRelative Path2D.Clockwise 0.1 (V2 0 0.2) 21 | , Path2D.bezierRelative (V2 (-0.6) 0.0) (V2 (-0.8) 2.2) (V2 (-0.8) 2.6) 22 | , Path2D.lineTo (V2 0.5 3.0) 23 | , Path2D.lineRelative (V2 0.1 0.16) 24 | , Path2D.lineRelative (V2 (-0.2) 0.04) 25 | , Path2D.lineTo (V2 0.1 3.2) 26 | , Path2D.arcViaRelative (V2 0.5 0.6) (V2 (-0.1) 1.2) 27 | ] 28 | 29 | -------------------------------------------------------------------------------- /waterfall-cad-examples/src/SVG/PathExample.hs: -------------------------------------------------------------------------------- 1 | module SVG.PathExample 2 | ( pathExample 3 | ) where 4 | 5 | import qualified Waterfall.SVG 6 | import qualified Waterfall.Solids as Solids 7 | import qualified Waterfall.TwoD.Shape as Shape 8 | import Data.Bifunctor (Bifunctor(bimap)) 9 | 10 | pathExample :: String -> Either String Solids.Solid 11 | pathExample pathStr = 12 | let solidify = mconcat . fmap (Solids.prism 1 . Shape.makeShape) 13 | in bimap show solidify $ Waterfall.SVG.parsePath pathStr -------------------------------------------------------------------------------- /waterfall-cad-examples/src/SVG/ReadFileExample.hs: -------------------------------------------------------------------------------- 1 | module SVG.ReadFileExample 2 | ( readFileExample 3 | ) where 4 | 5 | import qualified Waterfall.SVG 6 | import qualified Waterfall.Solids as Solids 7 | import qualified Waterfall.TwoD.Shape as Shape 8 | import qualified Waterfall.Transforms as Transforms 9 | import qualified Waterfall.Booleans as Booleans 10 | import Linear (V3 (..)) 11 | 12 | readFileExample :: FilePath -> IO Solids.Solid 13 | readFileExample filepath = 14 | let expandVertically = Transforms.translate (V3 0 0 (-0.5)) . Transforms.scale (V3 1 1 2) 15 | xor a b = (a `Booleans.difference` expandVertically b) <> (b `Booleans.difference` expandVertically a) 16 | solidify = foldr xor Solids.emptySolid . fmap (Solids.prism 1 . Shape.makeShape) 17 | in either (error . show) solidify <$> Waterfall.SVG.readSVG filepath -------------------------------------------------------------------------------- /waterfall-cad-examples/src/SweepExample.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | <> 3 | -} 4 | module SweepExample 5 | ( sweepExample 6 | ) where 7 | 8 | import Waterfall.Sweep (sweep) 9 | import Waterfall.Solids (Solid) 10 | import qualified Waterfall.Path as Path 11 | import qualified Waterfall.TwoD.Path2D as Path2D 12 | import qualified Waterfall.TwoD.Shape as Shape 13 | import Linear ( V3 (..), (*^), angle, unit, _x, zero) 14 | 15 | sweepExample :: Solid 16 | sweepExample = 17 | 18 | let sweepPath = Path.pathFrom zero 19 | [ Path.bezierRelative (V3 0 0 0.5) (V3 0.5 0.5 0.5) (V3 0.5 0.5 1) 20 | , Path.bezierRelative (V3 0 0 0.5) (V3 (-0.5) (-0.5) 0.5) (V3 (-0.5) (-0.5) 1) 21 | , Path.arcViaRelative (V3 0 1 1) (V3 0 2 0) 22 | , Path.lineTo (V3 0 2 0) 23 | ] 24 | sweepProfile = Shape.makeShape $ 25 | Path2D.repeatLooping $ 26 | Path2D.bezier (0.25 *^ unit _x) (0.5 *^ unit _x) (0.5 *^ angle (pi/6)) (0.25 *^ angle (pi/6)) 27 | in sweep sweepPath sweepProfile -------------------------------------------------------------------------------- /waterfall-cad-examples/src/TextExample.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | <> 3 | -} 4 | module TextExample ( 5 | textExample 6 | ) where 7 | 8 | import qualified Waterfall 9 | import Linear (unit, _x) 10 | textExample :: FilePath -> Double -> String -> Double -> IO Waterfall.Solid 11 | textExample fontpath fontSize content depth = do 12 | font <- Waterfall.fontFromPath fontpath fontSize 13 | return . Waterfall.rotate (unit _x) (pi/2) . Waterfall.prism depth $ Waterfall.text font content -------------------------------------------------------------------------------- /waterfall-cad-examples/src/TwoDBooleansExample.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | <> 3 | -} 4 | module TwoDBooleansExample 5 | ( twoDBooleansExample 6 | ) where 7 | 8 | import qualified Waterfall.TwoD.Shape as Shape 9 | import qualified Waterfall.Booleans as Booleans 10 | import Waterfall.TwoD.Transforms (translate2D) 11 | import Waterfall.Solids (prism, Solid) 12 | import Linear (V2 (..)) 13 | 14 | twoDBooleansExample :: Solid 15 | twoDBooleansExample = 16 | let offsetSquare = translate2D (V2 0.5 0.5) Shape.centeredSquare 17 | complexShape = Booleans.difference 18 | (Booleans.union Shape.unitCircle offsetSquare) 19 | (Booleans.intersection Shape.unitCircle offsetSquare) 20 | in prism 0.2 complexShape 21 | -------------------------------------------------------------------------------- /waterfall-cad-svg/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog for `waterfall-cad-svg` 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to the 7 | [Haskell Package Versioning Policy](https://pvp.haskell.org/). 8 | 9 | ## Unreleased 10 | 11 | ## 0.6.0.0 12 | 13 | ## 0.5.1.1 14 | 15 | ## 0.5.1.0 16 | 17 | ## 0.5.0.1 18 | 19 | ### Changed 20 | 21 | - Svg Path segments that originate from the same edge should no longer contain breaks 22 | 23 | ## 0.5.0.0 24 | 25 | - Initial Release 26 | -------------------------------------------------------------------------------- /waterfall-cad-svg/README.md: -------------------------------------------------------------------------------- 1 | # Waterfall CAD SVG 2 | 3 | ![Waterfall CAD](https://raw.githubusercontent.com/joe-warren/opencascade-hs/main/images/logo/waterfall-cad-logo-name.svg) 4 | 5 | This package provides SVG support for Waterfall-CAD. 6 | 7 | Waterfall CAD is a declarative CAD/Solid Modeling library. 8 | 9 | This uses [opencascade-hs](https://hackage.haskell.org/package/opencascade-hs) as the kernel, but provides a "more functional" API over it. 10 | 11 | ## Dependencies 12 | 13 | You'll need the main OpenCASCADE libraries/header files installed to use this. 14 | 15 | Please see the [main readme](https://github.com/joe-warren/opencascade-hs/#installing-dependencies) on Github for more information. 16 | 17 | ## Examples 18 | 19 | There are examples of how to use the library in [waterfall-cad-examples](https://hackage.haskell.org/package/waterfall-cad-examples). 20 | 21 | You can see images of these examples in the [main readme](https://github.com/joe-warren/opencascade-hs/#examples) on Github. -------------------------------------------------------------------------------- /waterfall-cad-svg/Setup.hs: -------------------------------------------------------------------------------- 1 | import Distribution.Simple 2 | main = defaultMain 3 | -------------------------------------------------------------------------------- /waterfall-cad-svg/package.yaml: -------------------------------------------------------------------------------- 1 | name: waterfall-cad-svg 2 | _version: !include "../package-defaults.yaml" 3 | version: *version 4 | github: "joe-warren/opencascade-hs" 5 | license: LGPL-2.1 6 | license-file: LICENSE 7 | author: "Joe Warren" 8 | maintainer: "josephmarkwarren@gmail.com" 9 | copyright: "2025 Joe Warren" 10 | 11 | synopsis: Declarative CAD/Solid Modeling Library, SVG Support 12 | category: Graphics 13 | description: Please see the README on GitHub at 14 | 15 | extra-source-files: 16 | - LICENSE 17 | - README.md 18 | - CHANGELOG.md 19 | 20 | dependencies: 21 | - base >= 4.7 && < 5 22 | - *waterfall-cad-bound 23 | - *opencascade-hs-bound 24 | - svg-tree >= 0.6 && < 1.0 25 | - attoparsec >= 0.14 && < 1.0 26 | - text >= 1.2 && < 3.0 27 | - linear >= 1.0 && < 2.0 28 | - lens > 5 && < 6 29 | - resourcet >= 1.2 && < 1.4 30 | - JuicyPixels >= 3 && < 4 31 | 32 | ghc-options: *ghc-options 33 | 34 | library: 35 | source-dirs: src 36 | -------------------------------------------------------------------------------- /waterfall-cad-svg/src/Waterfall/SVG.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | Module: Waterfall.SVG 3 | 4 | This module simply re-exports everything from the various modules 5 | that make up the waterfall-cad-svg package. 6 | -} 7 | module Waterfall.SVG 8 | ( 9 | -- | Load SVG Data into "Waterfall" data types 10 | module Waterfall.SVG.FromSVG 11 | -- | Convert "Waterfall" data types to SVG 12 | , module Waterfall.SVG.ToSVG 13 | ) where 14 | 15 | import Waterfall.SVG.FromSVG 16 | import Waterfall.SVG.ToSVG 17 | 18 | -------------------------------------------------------------------------------- /waterfall-cad/src/Waterfall/Booleans/Operators.hs: -------------------------------------------------------------------------------- 1 | module Waterfall.Booleans.Operators 2 | ((~/\~), (~\/~), (~-~) 3 | )where 4 | 5 | import Waterfall.Booleans (Boolean(..)) 6 | 7 | -- | Infix version of `intersection` (works for both 2D and 3D objects) 8 | (~/\~) :: Boolean a => a -> a -> a 9 | (~/\~) = intersection 10 | 11 | -- | Infix version of `union` (works for both 2D and 3D objects) 12 | (~\/~) :: Boolean a => a -> a -> a 13 | (~\/~) = union 14 | 15 | -- | Infix version of `difference` (works for both 2D and 3D objects) 16 | (~-~) :: Boolean a => a -> a -> a 17 | (~-~) = difference 18 | -------------------------------------------------------------------------------- /waterfall-cad/src/Waterfall/Internal/Diagram.hs: -------------------------------------------------------------------------------- 1 | {-# OPTIONS_HADDOCK not-home #-} 2 | module Waterfall.Internal.Diagram 3 | ( RawDiagram (..) 4 | ) where 5 | 6 | import qualified OpenCascade.TopoDS as TopoDS 7 | import Data.Acquire (Acquire) 8 | import Foreign.Ptr (Ptr) 9 | import qualified OpenCascade.HLRBRep.TypeOfResultingEdge as HLRBRep 10 | 11 | newtype RawDiagram = RawDiagram { runDiagram :: HLRBRep.TypeOfResultingEdge -> Bool -> Bool -> Acquire [Ptr TopoDS.Edge] } 12 | 13 | instance Semigroup RawDiagram where 14 | a <> b = RawDiagram $ \lt v is3D -> (<>) <$> runDiagram a lt v is3D <*> runDiagram b lt v is3D 15 | 16 | instance Monoid RawDiagram where 17 | mempty = RawDiagram $ \_ _ _ -> pure [] -------------------------------------------------------------------------------- /waterfall-cad/src/Waterfall/Internal/FromOpenCascade.hs: -------------------------------------------------------------------------------- 1 | module Waterfall.Internal.FromOpenCascade 2 | ( gpPntToV3 3 | , gpVecToV3 4 | , gpXYZToV3 5 | ) where 6 | 7 | import qualified OpenCascade.GP.Pnt as GP.Pnt 8 | import qualified OpenCascade.GP.Vec as GP.Vec 9 | import qualified OpenCascade.GP.XYZ as GP.XYZ 10 | import qualified OpenCascade.GP as GP 11 | import Linear (V3 (..)) 12 | import Foreign.Ptr 13 | 14 | gpPntToV3 :: Ptr GP.Pnt -> IO (V3 Double) 15 | gpPntToV3 pnt = V3 <$> GP.Pnt.getX pnt <*> GP.Pnt.getY pnt <*> GP.Pnt.getZ pnt 16 | 17 | gpVecToV3 :: Ptr GP.Vec -> IO (V3 Double) 18 | gpVecToV3 vec = V3 <$> GP.Vec.getX vec <*> GP.Vec.getY vec <*> GP.Vec.getZ vec 19 | 20 | gpXYZToV3 :: Ptr GP.XYZ -> IO (V3 Double) 21 | gpXYZToV3 xyz = V3 <$> GP.XYZ.x xyz <*> GP.XYZ.y xyz <*> GP.XYZ.z xyz -------------------------------------------------------------------------------- /waterfall-cad/src/Waterfall/Internal/ToOpenCascade.hs: -------------------------------------------------------------------------------- 1 | module Waterfall.Internal.ToOpenCascade 2 | ( v3ToVertex 3 | , v3ToPnt 4 | , v3ToDir 5 | ) where 6 | 7 | import Linear (V3 (..)) 8 | import Data.Acquire (Acquire) 9 | import Foreign.Ptr (Ptr) 10 | import qualified OpenCascade.TopoDS as TopoDS 11 | import qualified OpenCascade.GP as GP 12 | import qualified OpenCascade.GP.Pnt as GP.Pnt 13 | import qualified OpenCascade.GP.Dir as GP.Dir 14 | import qualified OpenCascade.BRepBuilderAPI.MakeVertex as MakeVertex 15 | 16 | 17 | v3ToPnt :: V3 Double -> Acquire (Ptr GP.Pnt) 18 | v3ToPnt (V3 x y z) = GP.Pnt.new x y z 19 | 20 | v3ToDir :: V3 Double -> Acquire (Ptr GP.Dir) 21 | v3ToDir (V3 x y z) = GP.Dir.new x y z 22 | 23 | v3ToVertex :: V3 Double -> Acquire (Ptr TopoDS.Vertex) 24 | v3ToVertex v = do 25 | pnt <- v3ToPnt v 26 | builder <- MakeVertex.fromPnt pnt 27 | MakeVertex.vertex builder 28 | 29 | -------------------------------------------------------------------------------- /waterfall-cad/src/Waterfall/TwoD/Booleans.hs: -------------------------------------------------------------------------------- 1 | {-| 2 | [Boolean Operations](https://en.wikipedia.org/wiki/Boolean_operations_on_polygons) operations on `Shape`. 3 | -} 4 | module Waterfall.TwoD.Booleans 5 | ( union2D 6 | , difference2D 7 | , intersection2D 8 | , unions2D 9 | , intersections2D 10 | , emptyShape 11 | ) where 12 | 13 | import Waterfall.TwoD.Internal.Shape (union2D, unions2D, difference2D, intersection2D, intersections2D, emptyShape) 14 | -------------------------------------------------------------------------------- /waterfall-cad/src/Waterfall/TwoD/Internal/Path2D.hs: -------------------------------------------------------------------------------- 1 | {-# LANGUAGE DerivingVia #-} 2 | {-# OPTIONS_HADDOCK not-home #-} 3 | module Waterfall.TwoD.Internal.Path2D 4 | ( Path2D (..) 5 | ) where 6 | 7 | import Waterfall.Internal.Path.Common (RawPath (..)) 8 | 9 | -- | A Path in 2D Space 10 | -- 11 | -- Under the hood, this is represented by an OpenCascade `TopoDS.Wire`, constrained to the plane \(z=0\). 12 | -- 13 | -- Please feel free to report a bug if you're able to construct a `Path2D` 14 | -- which does not lie on this plane (without using Internal functions). 15 | -- 16 | -- The monoid instance Joins `Path2D`s, @ a <> b @ connects the end point of @ a @ to the start of @ b @, if these points are not coincident, a line is created between them. 17 | newtype Path2D = Path2D { rawPath :: RawPath } deriving (Semigroup, Monoid) via RawPath --------------------------------------------------------------------------------