ds-blue-logo
Preview  |  SOLIDWORKS USER FORUM
Use your SOLIDWORKS ID or 3DEXPERIENCE ID to log in.
RBRavi Belkhindi22/04/2009
Hi,
I am trying to delete the lines [sketch] from the drawing sheet and the drawing view.
Am using the following code to get the sketch elements from drawing sheet as well as from views.
this is C# code
_view = (SolidWorks.Interop.sldworks.View)dwgDoc.GetFirstView();
do{

Sketch sk = (Sketch)_view.GetSketch(); // Get sketch in the view
object skSeg = sk.GetSketchSegments(); // Get sketch elements
foreach (object sg in ((object[])(skSeg))) // cycle through the elements
{
SketchSegment sgs = (SketchSegment)sg;
{
sgs.Select4(true, selData);

}
}

_view = (SolidWorks.Interop.sldworks.View )_view.GetNextView();
}while(_view!=null);
modDoc.Extension.DeleteSelection2((int)swDeleteSelectionOptions_e.swDelete_Children); // Delete all the selected elements

i could able to select all the sketch elements from sheet as well as from views placed in the sheet.
the problem is
1. this could not be able to delete all the selected sketch elements, i could see that it will delete only sketch elements in the sheet view but not from the views placed in the sheet.
2. i have few points in the sketch, view.GetSketchSegments() does not include the points.

thanks