Got the answer but I would like to know if there is a way to get the location of faces inside the part to create a faceproxy and use this code.
For now i just added an ilogic entity name to the part face and find the face number then get the actual face to create a faceproxy to use the code below.
any ideas??
Dim oAsmDoc As AssemblyDocument = ThisDoc.Document
Dim oAsmDef As AssemblyComponentDefinition = oAsmDoc.ComponentDefinition
Dim iLogicAuto As Object = iLogicVb.Automation
Dim Trim_To_oOcc As ComponentOccurrence
Dim Trim_Occ As ComponentOccurrence
Dim Occurrences As ComponentOccurrences
Dim WorkPlanes As WorkPlanes
Dim workPlane As WorkPlane
Dim oOriginPnt As Point
Dim oXaxis As UnitVector
Dim oYaxis As UnitVector
Dim oPart_1 As PartDocument
Dim oPart_2 As PartDocument
Dim oPart_Def_1 As PartComponentDefinition
Dim oPart_Def_2 As PartComponentDefinition
Dim oWrkPlane1Proxy As WorkPlaneProxy
Dim nonPrmFeatures As NonParametricBaseFeatures
Dim featureDef As NonParametricBaseFeatureDefinition
Dim transObjs As TransientObjects
Dim col As ObjectCollection
Dim baseFeature As NonParametricBaseFeature
Dim oFeas As PartFeatures
Dim oSurfaces As ObjectCollection
Dim osurface As WorkSurface
Dim oSculpt As SculptFeature
Dim AttSets As AttributeSets
Dim AttSet As AttributeSet
Dim oFaces As Faces
Dim oFace As Face
Dim Found_Face As Face
Dim Extract_Item_Face As Integer
Dim Cut_To_Face_Name As String
Dim sourceFace As FaceProxy
Trim_To_oOcc = oAsmDef.Occurrences.ItemByName("Obstacle Bridge Beam - 1.ipt:1")
Trim_Occ = oAsmDef.Occurrences.ItemByName("Obstacle Bridge Hoop - 1.ipt:1")
Cut_To_Face_Name = "Face0"
oPart_1 = Trim_To_oOcc.Definition.Document
oPart_2 = Trim_Occ.Definition.Document
oPart_Def_1 = Trim_To_oOcc.Definition
oPart_Def_2 = Trim_Occ.Definition
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Method 1 - Gemetry ilogic Entity Names
For x = 1 To oPart_Def_1.SurfaceBodies(1).Faces.Count
oFace = oPart_Def_1.SurfaceBodies(1).Faces.Item(x)
AttSets = oFace.AttributeSets
If AttSets.NameIsUsed("iLogicEntityNameSet") = True Then
AttSet = AttSets.Item("iLogicEntityNameSet")
For Each Att In AttSet
If Att.Value = Cut_To_Face_Name Then
Extract_Item_Face = x
'MessageBox.Show("Edge Value: " & Att.Value & vbCr & E & vbCr & Att.Name & x)
iProperties.Value(Trim_To_oOcc.Name, "Custom", "Top Face Number") = Extract_Item_Face
' sourceFace = oFace
End If
Next
End If
Next x
sourceFace = Trim_To_oOcc.SurfaceBodies(1).Faces(Extract_Item_Face)
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Method 2 - Exisitng Workplane Name geometry match Face geometry??
'For Each oWorkplane As workPlane In oPart_Def_1.WorkPlanes
'If oWorkplane.Name = "Top Plane" Then
'Call Trim_To_oOcc.CreateGeometryProxy(oWorkplane, oWrkPlane1Proxy)
'Call oWrkPlane1Proxy.GetPosition(oOriginPnt, oXaxis, oYaxis)
'Exit For
'End If
'Next
nonPrmFeatures = oPart_Def_2.Features.NonParametricBaseFeatures
featureDef = nonPrmFeatures.CreateDefinition
transObjs = ThisApplication.TransientObjects
col = transObjs.CreateObjectCollection
col.Add(sourceFace)
featureDef.BRepEntities = col
featureDef.OutputType = kSurfaceOutputType
featureDef.TargetOccurrence = Trim_Occ
featureDef.IsAssociative = True
baseFeature = nonPrmFeatures.AddByDefinition(featureDef)
oFeas = oPart_Def_2.Features
oSurfaces = ThisApplication.TransientObjects.CreateObjectCollection
For Each osurface In oPart_Def_2.WorkSurfaces
oSurfaces.Add(oFeas.SculptFeatures.CreateSculptSurface(osurface, kNegativeExtentDirection))
Next
oSculpt = oFeas.SculptFeatures.Add(oSurfaces, kCutOperation)
'EndCode:
iLogicVb.UpdateWhenDone = True