Files
Associated model(s) Modify filleted entities using adjacent edges
Code
'Precondition: part is open with Fillet1 feature created from a single edge
'Results: Fillet1 is modified to include edges adjacent to original edge
'Written by Keith Rice
'CADSharp LLC
'www.cadsharp.com
'Note: results of this technique are unreliable. Consider using another method _
for modifying the entity selections of a feature.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swPart As SldWorks.PartDoc
Dim swFeat As SldWorks.Feature
Dim swFilletData As SldWorks.SimpleFilletFeatureData2
Dim swEdge As SldWorks.Edge
Dim swAllEdges() As SldWorks.Edge
Dim vEdges As Variant
Dim vStartVertexEdges As Variant
Dim vEndVertexEdges As Variant
Dim swStartVertex As SldWorks.Vertex
Dim swEndVertex As SldWorks.Vertex
Dim i As Integer
Dim j As Integer
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swPart = swModel
'access the fillet data
Set swFeat = swPart.FeatureByName("Fillet1")
Set swFilletData = swFeat.GetDefinition
swFilletData.AccessSelections swModel, Nothing
'get the fillet edge data
vEdges = swFilletData.Edges
Set swEdge = vEdges(0)
Set swStartVertex = swEdge.GetStartVertex
Set swEndVertex = swEdge.GetEndVertex
'get all adjacent edges
vStartVertexEdges = swStartVertex.GetEdges
vEndVertexEdges = swEndVertex.GetEdges
'merge arrays
j = 0
ReDim swAllEdges(UBound(vStartVertexEdges) + UBound(vEndVertexEdges) + 1) As SldWorks.Edge
For i = 0 To UBound(swAllEdges)
If i > UBound(vStartVertexEdges) Then
Set swAllEdges(i) = vEndVertexEdges(j)
j = j + 1
Else
Set swAllEdges(i) = vStartVertexEdges(i)
End If
Next i
vEdges = swAllEdges
swFilletData.Edges = vEdges
'modify the definition
swFeat.ModifyDefinition swFilletData, swModel, Nothing
End Sub
'Notes: You cannot use co-edges to accomplish this. Co-edges do not refer to adjacent edges. _
Rather, co-edges are a topological concept. When an edge is shared by two faces, this edge _
must appear in 2 loops, one for each face. Its "representative" in each loop is the coedge.