implement ArcOfConic2d and ArcOfCircle2d
This commit is contained in:
@@ -149,79 +149,6 @@ void ArcOfEllipse2dPy::setMinorRadius(Py::Float arg)
|
||||
getGeomArcOfEllipsePtr()->setMinorRadius((double)arg);
|
||||
}
|
||||
|
||||
Py::Float ArcOfEllipse2dPy::getAngleXU(void) const
|
||||
{
|
||||
return Py::Float(getGeomArcOfEllipsePtr()->getAngleXU());
|
||||
}
|
||||
|
||||
void ArcOfEllipse2dPy::setAngleXU(Py::Float arg)
|
||||
{
|
||||
getGeomArcOfEllipsePtr()->setAngleXU((double)arg);
|
||||
}
|
||||
|
||||
Py::Object ArcOfEllipse2dPy::getCenter(void) const
|
||||
{
|
||||
return Py::Vector(getGeomArcOfEllipsePtr()->getCenter());
|
||||
}
|
||||
|
||||
void ArcOfEllipse2dPy::setCenter(Py::Object arg)
|
||||
{
|
||||
PyObject* p = arg.ptr();
|
||||
if (PyObject_TypeCheck(p, &(Base::VectorPy::Type))) {
|
||||
Base::Vector3d loc = static_cast<Base::VectorPy*>(p)->value();
|
||||
getGeomArcOfEllipsePtr()->setCenter(loc);
|
||||
}
|
||||
else if (PyObject_TypeCheck(p, &PyTuple_Type)) {
|
||||
Base::Vector3d loc = Base::getVectorFromTuple<double>(p);
|
||||
getGeomArcOfEllipsePtr()->setCenter(loc);
|
||||
}
|
||||
else {
|
||||
std::string error = std::string("type must be 'Vector', not ");
|
||||
error += p->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
}
|
||||
}
|
||||
|
||||
Py::Object ArcOfEllipse2dPy::getAxis(void) const
|
||||
{
|
||||
Handle_Geom_TrimmedCurve trim = Handle_Geom_TrimmedCurve::DownCast
|
||||
(getGeomArcOfEllipsePtr()->handle());
|
||||
Handle_Geom_Ellipse ellipse = Handle_Geom_Ellipse::DownCast(trim->BasisCurve());
|
||||
gp_Ax1 axis = ellipse->Axis();
|
||||
gp_Dir dir = axis.Direction();
|
||||
return Py::Vector(Base::Vector3d(dir.X(), dir.Y(), dir.Z()));
|
||||
}
|
||||
|
||||
void ArcOfEllipse2dPy::setAxis(Py::Object arg)
|
||||
{
|
||||
PyObject* p = arg.ptr();
|
||||
Base::Vector3d val;
|
||||
if (PyObject_TypeCheck(p, &(Base::VectorPy::Type))) {
|
||||
val = static_cast<Base::VectorPy*>(p)->value();
|
||||
}
|
||||
else if (PyTuple_Check(p)) {
|
||||
val = Base::getVectorFromTuple<double>(p);
|
||||
}
|
||||
else {
|
||||
std::string error = std::string("type must be 'Vector', not ");
|
||||
error += p->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
}
|
||||
|
||||
Handle_Geom_TrimmedCurve trim = Handle_Geom_TrimmedCurve::DownCast
|
||||
(getGeomArcOfEllipsePtr()->handle());
|
||||
Handle_Geom_Ellipse ellipse = Handle_Geom_Ellipse::DownCast(trim->BasisCurve());
|
||||
try {
|
||||
gp_Ax1 axis;
|
||||
axis.SetLocation(ellipse->Location());
|
||||
axis.SetDirection(gp_Dir(val.x, val.y, val.z));
|
||||
ellipse->SetAxis(axis);
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
throw Py::Exception("cannot set axis");
|
||||
}
|
||||
}
|
||||
|
||||
Py::Object ArcOfEllipse2dPy::getEllipse(void) const
|
||||
{
|
||||
Handle_Geom_TrimmedCurve trim = Handle_Geom_TrimmedCurve::DownCast
|
||||
|
||||
Reference in New Issue
Block a user