Message 1 of 4
Extrude using API fails on some faces in this model
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
Got a model where extrude is failing on some faces.
The face being extruded is flat, plane face, yet the error message says: EXTRUDE_CREATION_FAIL_ERROR - Cannot complete extrusion. / ASM_PATH_TANGENT - The path is tangent to the profile. Try adjusting the path or rotating the profile. Which does not make much sense.
Demo code which reproduces the issue:
#include <Core/CoreAll.h>
#include <Fusion/FusionAll.h>
#include <Cam/CamAll.h>
using namespace adsk::core;
using namespace adsk::fusion;
using namespace adsk::cam;
Ptr<Application> app;
extern "C" XI_EXPORT bool run(const char* context)
{
app = Application::get();
Ptr<Component> root = app->activeEditObject();
auto occurrences = root->allOccurrences();
auto occ = occurrences->itemByName("Cappello_del_corpo_mobile[Q02C-005M]:1");
auto faces = occ->bRepBodies()->item(0)->faces();
Ptr<BRepFace> targetFace;
auto targetFaceArea = 113.759999999;
for (auto i = 0; i < faces->count(); i++)
{
auto face = faces->item(i);
auto area = face->area();
if (fabs(area - targetFaceArea) < 0.0000001)
{
targetFace = face;
break;
}
}
//Extrude
const auto component = occ->component();
const auto features = component->features();
const auto extrudeFeatures = features->extrudeFeatures();
const auto extrudeInput = extrudeFeatures->createInput(targetFace, NewComponentFeatureOperation);
const auto valueInput = ValueInput::createByReal(1);
const auto distanceExtent = DistanceExtentDefinition::create(valueInput);
extrudeInput->setOneSideExtent(distanceExtent, PositiveExtentDirection);
const auto extrudeFeature = extrudeFeatures->add(extrudeInput);
std::string lastError;
app->getLastError(&lastError);
app->userInterface()->messageBox(lastError);
return true;
}
extern "C" XI_EXPORT bool stop(const char* context)
{
return true;
}
Link to the model: https://a360.co/4dysf22