In this video, we will write a macro from start to finish without using the recording function. For more information about SOLIDWORKS, visit www.hawkridges...
Thanks for the video! Time saver for who wants to try: Dim swApp As SldWorks.SldWorks Dim swmodel As SldWorks.ModelDoc2 Dim swfeature As SldWorks.Feature Dim filletdata As SldWorks.SimpleFilletFeatureData2 Dim radius As Double Dim counter As Integer Sub main() 'Changes fillets name counter = 1 Set swApp = Application.SldWorks Set swmodel = swApp.ActiveDoc Set swfeature = swmodel.FirstFeature Do While Not swfeature Is Nothing If swfeature.GetTypeName2 = "Fillet" Then Set filletdata = swfeature.GetDefinition() radius = filletdata.DefaultRadius * 1000 'multiplied by 1000 because default is meters swfeature.Name = "Fillet" & counter & " R" & radius & "mm" ' sets name to Fillet(x) R(y)mm counter = counter + 1 End If Set swfeature = swfeature.GetNextFeature Loop End Sub
Hey, do you know where I can find a list of other variables? Like I want to make a "rename" like you did for boss extrusions too :)
Thanks 👏👏
thank you for this videos
cool
Thanks for the video!
Time saver for who wants to try:
Dim swApp As SldWorks.SldWorks
Dim swmodel As SldWorks.ModelDoc2
Dim swfeature As SldWorks.Feature
Dim filletdata As SldWorks.SimpleFilletFeatureData2
Dim radius As Double
Dim counter As Integer
Sub main()
'Changes fillets name
counter = 1
Set swApp = Application.SldWorks
Set swmodel = swApp.ActiveDoc
Set swfeature = swmodel.FirstFeature
Do While Not swfeature Is Nothing
If swfeature.GetTypeName2 = "Fillet" Then
Set filletdata = swfeature.GetDefinition()
radius = filletdata.DefaultRadius * 1000 'multiplied by 1000 because default is meters
swfeature.Name = "Fillet" & counter & " R" & radius & "mm" ' sets name to Fillet(x) R(y)mm
counter = counter + 1
End If
Set swfeature = swfeature.GetNextFeature
Loop
End Sub