Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Jo_Perturbable
605 Views, 4 Replies

How to do a SplitFeature on a SketchLine3D and a SurfaceBody in C#?

Hi,

I want to split a BoundaryPatch with a SketchLine in C# in Inventor Professional 2021.1.2 Build 245.

I've tried with SplitFeatures.SplitBody:

  • SketchLine3D with a SurfaceBody
  • Create a Path from the SketchLine3D and then with a SurfaceBody

I've also tried with SplitFeatures.SplitFaces to no avail.

This works manually in the UI. But I don't get it to work in code. How do I create a Path object correctly?
See attached code and part.

Code in short also here:

 

var componentDefinition = sketch3D.Parent as ComponentDefinition;
var partComponentDefinition = sketch3D.Parent as PartComponentDefinition;
var splitFeatures = partComponentDefinition.Features.SplitFeatures;
SketchLine3D line = sketch3D.SketchLines3D[5];
SurfaceBody surfBody = partComponentDefinition.WorkSurfaces[1].SurfaceBodies[1];

// Try directly with SketchLine3D
try
{
    splitFeatures.SplitBody(line, surfBody);
}
catch (Exception) { }

// Try creating a Path
try
{
    var path = partComponentDefinition.Features.CreatePath(line);
    splitFeatures.SplitBody(path, surfBody);
}
catch (Exception) { }

 

 
Many thanks in advance!

Tags (1)
Labels (1)