SOLIDWORKS - Introduction to Macros: Coding [Pt. 2]

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • 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...

Комментарии • 5

  • @Theperkerify
    @Theperkerify 8 лет назад +4

    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 :)

  • @shyamsundar7272
    @shyamsundar7272 5 месяцев назад

    Thanks 👏👏

  • @nayakankit
    @nayakankit Год назад

    thank you for this videos

  • @raymondzhao9557
    @raymondzhao9557 3 года назад +1

    cool

  • @lucasvasqueslopesdeoliveir1538
    @lucasvasqueslopesdeoliveir1538 2 года назад

    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