Skip to content

Commit

Permalink
add make solid and shell constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
DSchroer committed Dec 5, 2023
1 parent 07285ab commit 73c2745
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions crates/opencascade-sys/include/wrapper.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepBuilderAPI_MakeShapeOnMesh.hxx>
#include <BRepBuilderAPI_MakeSolid.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <BRepBuilderAPI_Transform.hxx>
Expand Down Expand Up @@ -256,6 +257,8 @@ inline std::unique_ptr<TopoDS_Shape> TopoDS_Compound_as_shape(std::unique_ptr<To
return compound;
}

inline std::unique_ptr<TopoDS_Shape> TopoDS_Shell_as_shape(std::unique_ptr<TopoDS_Shell> shell) { return shell; }

inline const TopoDS_Builder &BRep_Builder_upcast_to_topods_builder(const BRep_Builder &builder) { return builder; }

// Transforms
Expand Down
24 changes: 22 additions & 2 deletions crates/opencascade-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,23 @@ pub mod ffi {
compound: UniquePtr<TopoDS_Compound>,
) -> UniquePtr<TopoDS_Shape>;

pub fn TopoDS_Shell_as_shape(shell: UniquePtr<TopoDS_Shell>) -> UniquePtr<TopoDS_Shape>;

type BRep_Builder;
type TopoDS_Builder;

#[cxx_name = "construct_unique"]
pub fn TopoDS_Compound_ctor() -> UniquePtr<TopoDS_Compound>;

#[cxx_name = "construct_unique"]
pub fn TopoDS_Shell_ctor() -> UniquePtr<TopoDS_Shell>;

#[cxx_name = "construct_unique"]
pub fn BRep_Builder_ctor() -> UniquePtr<BRep_Builder>;

pub fn BRep_Builder_upcast_to_topods_builder(builder: &BRep_Builder) -> &TopoDS_Builder;
pub fn MakeCompound(self: &TopoDS_Builder, compound: Pin<&mut TopoDS_Compound>);
pub fn MakeShell(self: &TopoDS_Builder, compound: Pin<&mut TopoDS_Shell>);
pub fn Add(self: &TopoDS_Builder, shape: Pin<&mut TopoDS_Shape>, compound: &TopoDS_Shape);

// BRepBuilder
Expand Down Expand Up @@ -907,6 +913,17 @@ pub mod ffi {
#[cxx_name = "SetTranslationPart"]
pub fn set_translation_vec(self: Pin<&mut gp_Trsf>, translation: &gp_Vec);

type BRepBuilderAPI_MakeSolid;

#[cxx_name = "construct_unique"]
pub fn BRepBuilderAPI_MakeSolid_ctor(
shell: &TopoDS_Shell,
) -> UniquePtr<BRepBuilderAPI_MakeSolid>;

pub fn Shape(self: Pin<&mut BRepBuilderAPI_MakeSolid>) -> &TopoDS_Shape;
pub fn Build(self: Pin<&mut BRepBuilderAPI_MakeSolid>, progress: &Message_ProgressRange);
pub fn IsDone(self: &BRepBuilderAPI_MakeSolid) -> bool;

type BRepBuilderAPI_MakeShapeOnMesh;

#[cxx_name = "construct_unique"]
Expand Down Expand Up @@ -1079,9 +1096,12 @@ pub mod ffi {
pub fn TopLoc_Location_Transformation(location: &TopLoc_Location) -> UniquePtr<gp_Trsf>;

type Handle_Poly_Triangulation;

/// # Safety
/// This method is safe assuming that `triangulation` points to a valid constructed object or is a null pointer.
#[cxx_name = "construct_unique"]
pub fn Handle_Poly_Triangulation_ctor(
triangulation: &Handle_Poly_Triangulation,
pub unsafe fn Handle_Poly_Triangulation_ctor(
triangulation: *const Poly_Triangulation,
) -> UniquePtr<Handle_Poly_Triangulation>;

pub fn IsNull(self: &Handle_Poly_Triangulation) -> bool;
Expand Down

0 comments on commit 73c2745

Please sign in to comment.