Hallo.
Ich habe ein Makro, das Auswahlsätze erstellt, aber ich möchte sie automatisch umbenennen, um den Inhalt des Teils zu standardisieren.
Hier ist ein Makroauszug, der die Namen der Auswahlsätze angibt, aber ich kann den Code nicht schreiben, um sie umzubenennen ...
"Sub TraverseFeatureFeatures(swFeat As SldWorks.Feature, swModel As SldWorks.ModelDoc2)
Dim swSelectionSetFolder als SldWorks.SelectionSetFolder
Dim selectionSetArray als Variante
Dim selectionSetItemArray als Variante
Dim selectionSetItemArrayTypes als Variante
Dim swSelectionSet As SldWorks.SelectionSet
Dim swSelectionSetItem As SldWorks.SelectionSetItem
Dimmen Sie swFace als SldWorks.Face2
Dim swEdge als SldWorks.Edge
Dim swBody As SldWorks.Body2
Sonne i So lang
Sonne j So lang
Dim ret Als Boolescher Wert
While Not swFeat Is Nothing
If swFeat.Name = "Selection Sets" Then
Debug.Print " " & swFeat.Name & " [" & swFeat.GetTypeName & "]"
'Get Selection Sets folder
Set swSelectionSetFolder = swFeat.GetSpecificFeature2
'Get selection sets in Selection Sets folder
selectionSetArray = swSelectionSetFolder.GetSelectionSets
For i = 0 To UBound(selectionSetArray)
Set swSelectionSet = selectionSetArray(i)
Debug.Print " Selection set[" & i & "] name: " & swSelectionSet.GetName
'Get the items and their types in this selection set
selectionSetItemArray = swSelectionSet.GetSelectionSetItems
selectionSetItemArrayTypes = swSelectionSet.GetSelectionSetItemTypes
For j = 0 To UBound(selectionSetItemArray)
Set swSelectionSetItem = selectionSetItemArray(j)
Select Case selectionSetItemArrayTypes(j)
Case swSelectType_e.swSelFACES
'Get the Dispatch object for the selection set item
Set swFace = swSelectionSetItem.GetCorrespondingItem
'Get the name of the body for the face
Set swBody = swFace.GetBody
Debug.Print " Name of face[" & j & "]'s body: " & swBody.Name
Case swSelectType_e.swSelEDGES
'Get the Dispatch object for the selection set item
Set swEdge = swSelectionSetItem.GetCorrespondingItem
'Get the name of the body for the edge
Set swBody = swEdge.GetBody
Debug.Print " Name of edge[" & j & "]'s body: " & swBody.Name
End Select
Next
Next
End If
Set swFeat = swFeat.GetNextFeature
Wend
Ende Sub"
Vielen Dank im Voraus