Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add make solid and shell constructors #157

Merged
merged 2 commits into from
Jan 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 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 All @@ -276,6 +279,11 @@ inline std::unique_ptr<gp_Trsf> TopLoc_Location_Transformation(const TopLoc_Loca
return std::unique_ptr<gp_Trsf>(new gp_Trsf(location.Transformation()));
}

inline std::unique_ptr<Handle_Poly_Triangulation>
Handle_Poly_Triangulation_ctor(const Poly_Triangulation &triangulation) {
return std::unique_ptr<Handle_Poly_Triangulation>(new Handle_Poly_Triangulation(&triangulation));
}

inline std::unique_ptr<Handle_Poly_Triangulation> BRep_Tool_Triangulation(const TopoDS_Face &face,
TopLoc_Location &location) {
return std::unique_ptr<Handle_Poly_Triangulation>(
Expand Down
21 changes: 19 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,9 @@ pub mod ffi {
pub fn TopLoc_Location_Transformation(location: &TopLoc_Location) -> UniquePtr<gp_Trsf>;

type Handle_Poly_Triangulation;
#[cxx_name = "construct_unique"]

pub fn Handle_Poly_Triangulation_ctor(
triangulation: &Handle_Poly_Triangulation,
triangulation: &Poly_Triangulation,
) -> UniquePtr<Handle_Poly_Triangulation>;

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