Good day all
i'm trying to program this thing and i'm lost.
IFeatureManager::FeatureExtrusion2 fails if sketch has intersecting contours within itself.
Idea i've been toying with is adding all the contours from the sketch to the extrusions contours, but that requires an existing extrusion...
Any help would be immensly appretiated. Just point me in the right direction.
thank you in advance
SolidworksApi macros
Shoki,
I don't know exactly what your situation is, but here's a few things to note:
1. ISketch::GetSketchContours does not return all contours. It simply returns all closed profiles formed by non-intersecting sketch entities. Seems like it should include closed profiles formed by intersecting sketch entities, but it doesn't. For example, if you open the part in the example I link to, you'll see that the middle profile (the one containing the origin) is formed by intersecting sketch entities. Yet if you run ISketch::GetSketchContours, it will not return this contour in the array.
2. If you're trying to select a closed profile formed by non-intersecting edges then you can use ISketchContour::Select2 after you have found the contour you want. (You might have to test the X, Y, Z values of the points in the contour to make sure you have the contour you want.
3. If you are trying to select a closed profile contour created by either intersecting or non-intersecting sketch entities, you can simple set ISelectionMgr::EnableContourSelection to True and then use IModelDocExtension::SelectByID2 to select the desired contour. You'll need to know the coordinates of a point contained in the contour, of course.
I have an example that demonstrates all of this in the Macro Library at my web site. It is called "Contour selection", under the Selection section.
Keith
SolidWorks API Video Tutorials
sweet
thank you very much
edit: jut wanted to say thank you again, iterating through all the contours, selecting them and than extruding them worked (as per the example you linked).
much appretiated, mate