Showing results for 
Search instead for 
Did you mean: 

Add Hole feature to part

Valued Contributor
Valued Contributor



I try to add the hole to exist part. But something is wrong.  Please let me know where is mistake....>


Imports SolidEdgeConstants

Imports System.Runtime.InteropServices


Module Module1

Sub Main()

Dim objApplication As SolidEdgeFramework.Application = Nothing

Dim objDocuments As SolidEdgeFramework.Documents = Nothing

Dim objPart As SolidEdgePart.PartDocument = Nothing

Dim objRefplanes As SolidEdgePart.RefPlanes = Nothing

Dim objRP As SolidEdgePart.RefPlane

Dim objRegHoleData As SolidEdgePart.HoleData

Dim objRegHoleProfile As SolidEdgePart.Profile

Dim objRegHole As SolidEdgePart.Hole

Dim objModels As SolidEdgePart.Models = Nothing

Dim objModel As SolidEdgePart.Model = Nothing



objApplication = Marshal.GetActiveObject("SolidEdge.Application")

objDocuments = objApplication.Documents

objPart = objDocuments.Open("d:\temp\part1.par")

objModels = objPart.Models

objRP = objPart.RefPlanes(0)


objRegHoleData = objPart.HoleDataCollection.Add(SolidEdgePart.FeaturePropertyConstants.igRegularHole, _ HoleDiameter:=0.05)


objRegHoleProfile = objPart.ProfileSets.Add.Profiles.Add(pRefPlaneDisp:=objRP)

objRegHoleProfile.Holes2d.Add(XCenter:=0.01, YCenter:=0.01)


objRegHole = objModel.Holes.AddThroughAll(objRegHoleProfile, SolidEdgePart.FeaturePropertyConstants.igRight, objRegHoleData)


objRegHoleProfile.Visible = False


Catch ex As Exception


End Try

End Sub

End Module


Posted by: Tibor
Post date: 2/21/2011 1:50:11 AM


RE: Add Hole feature to part

Valued Contributor
Valued Contributor

At a very first look, I would say that the objRegHoleProfile.End(igProfileClosed) call is missing after you have added the ThroughHole. This is always required when you create a sketch or a profile based feature. It's comparable with the Close&Return from Profile environment.


Posted by: Martin Bernhard
Post date: 2/21/2011 10:20:44 AM

RE: Add Hole feature to part

Valued Contributor
Valued Contributor

when I added>

 objModel = objModels.Item(1)
works OK.


Posted by: Tibor
Post date: 2/21/2011 11:08:54 PM