29 #define _unused(x) ((void)(x)) 31 #include "SUAPI-CppWrapper/model/Axes.hpp" 40 SUAxesRef Axes::create_axes() {
41 SUAxesRef axes = SU_INVALID;
42 SUResult res = SUAxesCreate(&axes);
43 assert(res == SU_ERROR_NONE);
48 SUAxesRef Axes::create_custom_axes(
const SUPoint3D&
origin,
const SUVector3D& xaxis,
const SUVector3D& yaxis,
const SUVector3D& zaxis) {
49 SUAxesRef axes = SU_INVALID;
50 SUResult res = SUAxesCreateCustom(&axes, &origin, &xaxis, &yaxis, &zaxis);
51 if(res != SU_ERROR_NONE) {
53 if (SUIsValid(axes)) {
61 SUAxesRef Axes::copy_reference(
const Axes& other) {
62 if (other.m_attached) {
63 return SUAxesFromEntity(other.m_entity);
66 SUAxesRef new_axes = create_custom_axes(other.origin(), other.x_axis(), other.y_axis(), other.z_axis());
85 DrawingElement(SUAxesToDrawingElement(create_custom_axes(origin, x_axis, y_axis, z_axis)), false)
90 DrawingElement(other, SUAxesToDrawingElement(copy_reference(other)))
96 SUAxesRef axes = this->
ref();
97 SUResult res = SUAxesRelease(&axes);
98 assert(res == SU_ERROR_NONE);
111 SUAxesRef axes = this->
ref();
112 SUResult res = SUAxesRelease(&axes);
113 assert(res == SU_ERROR_NONE);
116 m_entity = SUAxesToEntity(copy_reference(other));
138 throw std::logic_error(
"CW::Axes::x_axis(): Axes is null");
141 SUResult res = SUAxesGetXAxis(this->
ref(), &axis);
142 assert(res == SU_ERROR_NONE); _unused(res);
148 throw std::logic_error(
"CW::Axes::x_axis(): Axes is null");
151 SUResult res = SUAxesGetYAxis(this->
ref(), &axis);
152 assert(res == SU_ERROR_NONE); _unused(res);
158 throw std::logic_error(
"CW::Axes::x_axis(): Axes is null");
161 SUResult res = SUAxesGetZAxis(this->
ref(), &axis);
162 assert(res == SU_ERROR_NONE); _unused(res);
169 throw std::logic_error(
"CW::Axes::x_axis(): Axes is null");
172 SUResult res = SUAxesGetOrigin(this->
ref(), &origin);
173 assert(res == SU_ERROR_NONE); _unused(res);
180 throw std::logic_error(
"CW::Axes::x_axis(): Axes is null");
182 SUTransformation transform;
183 SUResult res = SUAxesGetTransform(this->
ref(), &transform);
184 assert(res == SU_ERROR_NONE); _unused(res);
bool m_attached
Indicates whether the Entity has been attached to a model.
Axes & operator=(const Axes &other)
bool attached() const
Returns true if the entity is attached to another object.
Transformation transformation() const
DrawingElement & operator=(const DrawingElement &other)
SUEntityRef m_entity
The C SUEntityRef that this class wraps.