Here's a simple script that does what I suggested. I found a limitation with the API when intersecting a body with a sketch. It only supports intersecting a body. In the UI you can choose a body or individual entities, like a face. Using a body means you get more results when doing the intersection, but you can still delete them.
extern "C" XI_EXPORT bool run(const char* context)
{
app = Application::get();
if (!app)
return false;
ui = app->userInterface();
if (!ui)
return false;
Ptr<Design> des = app->activeProduct();
// Get the body from the root component. This is assuming
// the first, and possibly only, body is the cylinder.
Ptr<Component> root = des->rootComponent();
Ptr<BRepBody> body = root->bRepBodies()->item(0);
// Create a sketch on the X-Z plane.
Ptr<Sketch> sketch = root->sketches()->add(root->xZConstructionPlane());
// Intersect the body with the sketch plane.
Ptr<ObjectCollection> results = sketch->projectCutEdges(body);
// Find and delete all lines that are in the negative space.
for (Ptr<SketchEntity> skEnt : results)
{
// Check if it's a sketch line.
if (skEnt->objectType() == adsk::fusion::SketchLine::classType())
{
Ptr<SketchLine> skLine = skEnt;
if (skLine->startSketchPoint()->geometry()->x() < 0.0 ||
skLine->endSketchPoint()->geometry()->x() < 0.0)
{
skLine->deleteMe();
}
}
}
return true;
}
---------------------------------------------------------------
Brian EkinsInventor and Fusion 360 API Expert
Website/Blog:
https://EkinsSolutions.com