Why aren't you using holeface.GetSurface?
I gave that a try and I had no better luck. I will try that again and if it does not work I will post that code for your review.
What are the variable types of holeface, holesurf and sel_entity?
Select2 is for selecting features, don't you need Select4?
Dim boolstat As Boolean
Dim holeface As Face2 = Nothing
Dim holesurf As ISurface = Nothing
Dim sel_entity As Entity
I have run through Select through Select4 with no luck. I was not aware that the different selects were for different types.
With these two posts I will change to Select4 and GetSurface.
Thanks to all!
Here is the new code with igetserface used and Select4. Once again the first messagebox says true and all debugging shows I have the surface, but the Select4 still does not work.
holeface = the_hole.GetFaces(0)
holesurf = holeface.GetSurface
sel_entity = holesurf
boolstat = sel_entity.Select4(False, Nothing)
I know I am missing something simple. Your time and help is greatly appreciated.
I have made much progress and I think I see my error but I am still not quite there yet. I have realized that I need my selection manager to be against my component that owns the face to select, not the assembly.
sel_entity = holeface
Dim sel_entity2 As IEntity = sel_entity.GetSafeEntity
Dim swcomp1 As Component2 = swcomp_holes
Dim swmodel2 As ModelDoc2 = swcomp1.IGetModelDoc
Dim swSelMgr2 As SelectionMgr = swmodel2.ISelectionManager
Dim swSelData As SelectData = swSelMgr2.CreateSelectData
boolstat = sel_entity2.Select4(False, swSelData)
I am getting a serious memory error when I hit that last step. It actually did select the face one time just before hitting this error.
Any ideas to get me past this error is greatly appreciated.
Memory access violation errors are caused by a bad configuration of SolidWorks. Do you have existing any other SolidWorks versions?