Move face with MoveFeature not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have been trying to move a face using API and it does not seem to be working. I always get invalidEntity error.
#include <Core/CoreAll.h>
#include <Fusion/FusionAll.h>
using namespace adsk::core;
using namespace adsk::fusion;
extern "C" XI_EXPORT bool run(const char* context)
{
auto app = Application::get();
const auto select = app->userInterface()->activeSelections()->item(0);
Ptr<BRepFace> face = select->entity();
const auto moveFeatures = face->body()->parentComponent()->features()->moveFeatures();
const auto objectCollection = ObjectCollection::create();
objectCollection->add(face);
Ptr<Vector3D> normal;
face->evaluator()->getNormalAtParameter(Point2D::create(0.5, 0.5), normal);
normal->scaleBy(10);
auto matrix = Matrix3D::create();
matrix->translation(normal);
const auto input = moveFeatures->createInput(objectCollection, matrix);
const auto feature = moveFeatures->add(input);
if (!feature)
{
std::string error;
app->getLastError(&error);
app->userInterface()->messageBox(error);
}
return true;
}
As you can see in sample code it is as simple as it gets, yet I get errors.
Is this a bug or am I doing something wrong?