MCPcopy Create free account
hub / github.com/BIMCoderLiang/LNLib / cstrObject

Function cstrObject

python/src/Construct/LNObject.cpp:19–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17
18namespace py = pybind11;
19void cstrObject(py::module_&m)
20{
21 py::class_<LNLib::LN_BezierCurve<LNLib::XYZ>>(m, "LN_BezierCurve_XYZ")
22 .def(py::init<>())
23 .def_readwrite("Degree", &LNLib::LN_BezierCurve<LNLib::XYZ>::Degree)
24 .def_readwrite("ControlPoints", &LNLib::LN_BezierCurve<LNLib::XYZ>::ControlPoints);
25
26 py::class_<LNLib::LN_BezierCurve<LNLib::XYZW>>(m, "LN_BezierCurve_XYZW")
27 .def(py::init<>())
28 .def_readwrite("Degree", &LNLib::LN_BezierCurve<LNLib::XYZW>::Degree)
29 .def_readwrite("ControlPoints", &LNLib::LN_BezierCurve<LNLib::XYZW>::ControlPoints);
30
31 py::class_<LNLib::LN_BsplineCurve<LNLib::XYZ>>(m, "LN_BsplineCurve_XYZ")
32 .def(py::init<>())
33 .def_readwrite("Degree", &LNLib::LN_BsplineCurve<LNLib::XYZ>::Degree)
34 .def_readwrite("KnotVector", &LNLib::LN_BsplineCurve<LNLib::XYZ>::KnotVector)
35 .def_readwrite("ControlPoints", &LNLib::LN_BsplineCurve<LNLib::XYZ>::ControlPoints);
36
37 py::class_<LNLib::LN_BsplineCurve<LNLib::XYZW>>(m, "LN_NurbsCurve", py::module_local())
38 .def(py::init<>())
39 .def_readwrite("Degree", &LNLib::LN_BsplineCurve<LNLib::XYZW>::Degree)
40 .def_readwrite("KnotVector", &LNLib::LN_BsplineCurve<LNLib::XYZW>::KnotVector)
41 .def_readwrite("ControlPoints", &LNLib::LN_BsplineCurve<LNLib::XYZW>::ControlPoints);
42
43 py::class_<LNLib::LN_Mesh>(m, "LN_Mesh")
44 .def(py::init<>())
45 .def_readwrite("Vertices", &LNLib::LN_Mesh::Vertices)
46 .def_readwrite("Faces", &LNLib::LN_Mesh::Faces)
47 .def_readwrite("UVs", &LNLib::LN_Mesh::UVs)
48 .def_readwrite("UVIndices", &LNLib::LN_Mesh::UVIndices)
49 .def_readwrite("Normals", &LNLib::LN_Mesh::Normals)
50 .def_readwrite("NormalIndices", &LNLib::LN_Mesh::NormalIndices);
51
52 py::class_<LNLib::LN_ArcInfo>(m, "LN_ArcInfo")
53 .def(py::init<>())
54 .def_readwrite("Radius", &LNLib::LN_ArcInfo::Radius)
55 .def_readwrite("Center", &LNLib::LN_ArcInfo::Center);
56
57 py::class_<LNLib::LN_BoundingBox3d>(m, "LN_BoundingBox3d")
58 .def(py::init<>())
59 .def_readwrite("MinPoint", &LNLib::LN_BoundingBox3d::MinPoint)
60 .def_readwrite("MaxPoint", &LNLib::LN_BoundingBox3d::MaxPoint)
61 .def("Intersects", &LNLib::LN_BoundingBox3d::Intersects);
62
63 py::class_<LNLib::LN_OrientedBoundingBox3d>(m, "LN_OrientedBoundingBox3d")
64 .def(py::init<>())
65 .def_readwrite("Center", &LNLib::LN_OrientedBoundingBox3d::Center)
66 .def_property("Axes",
67 [](const LNLib::LN_OrientedBoundingBox3d& self) {
68 return std::vector<LNLib::XYZ>{self.Axes[0], self.Axes[1], self.Axes[2]};
69 },
70 [](LNLib::LN_OrientedBoundingBox3d& self, const std::vector<LNLib::XYZ>& val) {
71 if (val.size() != 3) throw std::runtime_error("Axes size must be 3");
72 self.Axes[0] = val[0];
73 self.Axes[1] = val[1];
74 self.Axes[2] = val[2];
75 })
76 .def_property("HalfExtents",

Callers 1

constructFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected