diff --git a/CHANGELOG.md b/CHANGELOG.md index 95cbe800..f8d10218 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,23 +13,24 @@ diff: - (js, py) DimensionStyle.Id - (js, py) Several delete methods for File3dm Tables: File3dmMaterialTable::Delete, BND_File3dmLayerTable::Delete, BND_File3dmDimStyleTable::Delete - (js, py) Added tests for various ::Delete methods. +- (js, py) Extrusion::CreateWithPlane #636 - (py) Added python 3.13 target #654 +- (py) BND_MeshingParameters::Decode now supports more properties - (js) Layer.Index #655 -- (dotnet) Linux release builds in an Amazon Linux 2023 container - (js) BND_PointCloud::CreateFromThreeJSON #642 -- (py) BND_MeshingParameters::Decode now supports more properties - +- (js) Added several methods and properties for Planes #568 +- (dotnet) Linux release builds in an Amazon Linux 2023 container ### Changed - (py) switching from pybind11 to nanobind. WIP. This affects a lot of the src/binding files, which now include many `#if defined()`. When the switch is complete these will be cleaned up. -- (js) File3dm.objects().deleteItem(id) -> File3dm.objects().delete(id) - (py) File3dmObjectTable now accepts negative indexing #651 @StudioWEngineers +- (js) File3dm.objects().deleteItem(id) -> File3dm.objects().delete(id) ### Fixed -- (js, py) Changes to ViewInfo.Viewport would not set. - (py) uuid conversion in c++ was broken +- (js, py) Changes to ViewInfo.Viewport would not set. - (js) BND_Mesh::CreateFromThreeJSON did not pay attention to vertex colors #641 - (js) BND_PointCloud::CreateFromThreeJSON did not pay attention to RGBA (4 channel) colors #641 diff --git a/src/bindings/bnd_beam.cpp b/src/bindings/bnd_beam.cpp index 5cde50ca..e12d5c20 100644 --- a/src/bindings/bnd_beam.cpp +++ b/src/bindings/bnd_beam.cpp @@ -14,6 +14,16 @@ BND_Extrusion* BND_Extrusion::Create(const BND_Curve& planarCurve, double height return new BND_Extrusion(ext, nullptr); } +BND_Extrusion* BND_Extrusion::CreateWithPlane(const BND_Curve& planarCurve, const class BND_Plane& plane, double height, bool cap) +{ + const ON_Plane& on_plane_ref = plane.ToOnPlane(); + const ON_Plane* on_plane = &on_plane_ref; + ON_Extrusion* ext = ON_Extrusion::CreateFrom3dCurve(*planarCurve.m_curve, on_plane, height, cap); + if (nullptr == ext) + return nullptr; + return new BND_Extrusion(ext, nullptr); +} + BND_Extrusion* BND_Extrusion::CreateBoxExtrusion(const BND_Box& box, bool cap) { if (!box.m_box.IsValid()) return nullptr; @@ -197,6 +207,7 @@ void initExtrusionBindings(rh3dmpymodule& m) { py::class_(m, "Extrusion") .def_static("Create", &BND_Extrusion::Create, py::arg("planarCurve"), py::arg("height"), py::arg("cap")) + .def_static("CreateWithPlane", &BND_Extrusion::CreateWithPlane, py::arg("planarCurve"), py::arg("plane"), py::arg("height"), py::arg("cap")) .def_static("CreateBoxExtrusion", &BND_Extrusion::CreateBoxExtrusion, py::arg("box"), py::arg("cap")) .def_static("CreateCylinderExtrusion", &BND_Extrusion::CreateCylinderExtrusion, py::arg("cylinder"), py::arg("capBottom"), py::arg("capTop")) .def_static("CreatePipeExtrusion", &BND_Extrusion::CreatePipeExtrusion, py::arg("cylinder"), py::arg("otherRadius"), py::arg("capBottom"), py::arg("capTop")) @@ -240,6 +251,7 @@ void initExtrusionBindings(void*) class_>("Extrusion") .constructor<>() .class_function("create", &BND_Extrusion::Create, allow_raw_pointers()) + .class_function("createWithPlane", &BND_Extrusion::CreateWithPlane, allow_raw_pointers()) .class_function("createBoxExtrusion", &BND_Extrusion::CreateBoxExtrusion, allow_raw_pointers()) .class_function("createCylinderExtrusion", &BND_Extrusion::CreateCylinderExtrusion, allow_raw_pointers()) .class_function("createPipeExtrusion", &BND_Extrusion::CreatePipeExtrusion, allow_raw_pointers()) diff --git a/src/bindings/bnd_beam.h b/src/bindings/bnd_beam.h index 452fe735..d3abdd42 100644 --- a/src/bindings/bnd_beam.h +++ b/src/bindings/bnd_beam.h @@ -16,6 +16,7 @@ class BND_Extrusion : public BND_Surface public: static BND_Extrusion* Create(const class BND_Curve& planarCurve, double height, bool cap); + static BND_Extrusion* CreateWithPlane(const class BND_Curve& planarCurve, const class BND_Plane& plane, double height, bool cap); static BND_Extrusion* CreateBoxExtrusion(const class BND_Box& box, bool cap); static BND_Extrusion* CreateCylinderExtrusion(const class BND_Cylinder& cylinder, bool capBottom, bool capTop); static BND_Extrusion* CreatePipeExtrusion(const class BND_Cylinder& cylinder, double otherRadius, bool capTop, bool capBottom); diff --git a/src/bindings/bnd_plane.cpp b/src/bindings/bnd_plane.cpp index 1440bf46..db1c1d27 100644 --- a/src/bindings/bnd_plane.cpp +++ b/src/bindings/bnd_plane.cpp @@ -240,7 +240,22 @@ void initPlaneBindings(void*) .field("zAxis", &BND_Plane::m_zaxis); class_("Plane") - .class_function("worldXY", &BND_PlaneHelper::WorldXY); + + .class_function("worldXY", &BND_Plane::WorldXY) + .class_function("worldYZ", &BND_Plane::WorldYZ) + .class_function("worldZX", &BND_Plane::WorldZX) + .class_function("unset", &BND_Plane::Unset) + .property("origin", &BND_Plane::m_origin) + .property("xAxis", &BND_Plane::m_xaxis) + .property("yAxis", &BND_Plane::m_yaxis) + .property("zAxis", &BND_Plane::m_zaxis) + .function("pointAtUV", &BND_Plane::PointAtUV) + .function("pointAtUVW", &BND_Plane::PointAtUVW) + .function("rotate", &BND_Plane::Rotate) + .function("toJSON", &BND_Plane::toJSON) + .function("encode", &BND_Plane::Encode) + .class_function("decode", &BND_Plane::Decode) + ; } #endif diff --git a/src/bindings/bnd_plane.h b/src/bindings/bnd_plane.h index 7e05415b..dd69d6d7 100644 --- a/src/bindings/bnd_plane.h +++ b/src/bindings/bnd_plane.h @@ -29,7 +29,7 @@ class BND_Plane ON_3dPoint PointAtUV(double u, double v) const; ON_3dPoint PointAtUVW(double u, double v, double w) const; -#if defined(__EMSCRIPTEN__) +#if defined(ON_WASM_COMPILE) emscripten::val toJSON(emscripten::val key); emscripten::val Encode() const; static BND_Plane* Decode(emscripten::val jsonObject); @@ -50,5 +50,8 @@ class BND_PlaneHelper { public: static BND_Plane WorldXY(); + static BND_Plane WorldYZ(); + static BND_Plane WorldZX(); + static BND_Plane Unset(); };