ISketchSegment::SplitEntity() method fails when performing an in-context part editing.
I create a new 2D sketch, draw one horizontal line from (-100, 0) to (100, 0), in millimeters, and then execute the code below:
IModelDoc2 document = _iSwApp.ActiveDoc; // _iSwApp is ISldWorks object. ISelectionMgr sm = document.SelectionManager; ISketchSegment segment = sm.GetSelectedObject6(1, -1); //segment.ConstructionGeometry = true; // Converting to construction line works just fine, but I'm not interested in it. segment.SplitEntity(0.010, 0, 0, 0, 0, 0);
- Part editing, sketch belongs to the part: works fine, the line is split at 10 mm right of the origin.
- Assembly editing, sketch belongs to the assembly: works fine, the line is split at 10 mm right of the origin.
- Part in-context editing, sketch belongs to the part within an assembly: throws an exception below.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. at modelDocSketch_c.moSketchInProgr(modelDocSketch_c* ) at SketchCoupling.SketchToolsCoupler_c.getUoSketch() at SketchCoupling.SketchToolsCoupler_c.ConvertSketchToScreen(CorePoint_s sketch) at APICoupler.apiSplitEntityCoupler_c.populateDataPacket() at APICoupler.apiCoupler_c<apiSplitEntityData_c\,SketchOperation::SplitLineOperation_c\,SolidCore::ProfileRequest_c\,SolidCore::ProfileRequest_c::SplitEntityPacket_c>.run() at SolidWorks.Interop.sldworks.ISketchSegment.SplitEntity(Double X, Double Y, Double Z, Double ClosedX, Double ClosedY, Double ClosedZ) at WeldingPlanner.SwAddin.ShowPageAddPass() in C:\D\Local\CoRoWeld\Welding Planner\src\Welding Planner\SwAddin.cs:line 170
I am suspecting yet another bug with in-context editing.
Can anybody confirm or deny the behavior?
Using SolidWorks 2015 SP5.0