Unlock the power of automation in SOLIDWORKS by learning how to create macros! 🔧📊 In this tutorial, we'll walk you through the process of building a macro from scratch using a real-world example from www.cati.com. Follow along as we produce multiple points in a 3D sketch with simple VBA code.
Script Highlights:
Introduction to macros in SOLIDWORKS
Steps to plan and record your macro
Editing and refining the macro code
Running and troubleshooting the macro
Creating a 3D sketch with coordinates from a text file
The code we used:
Dim swApp As Object
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
swApp.ActiveDoc.ActiveView.FrameState = 1
Dim skPoints As Object
Open "LOCATiON and FILE NAME HERE" For Input As #1
Part.SketchManager.Insert3DSketch True
Do While Not EOF(1)
Input #1, X, Y, Z
Set skPoints = Part.SketchManager.CreatePoint(X, Y, Z)
Loop
Close #1
Part.ViewZoomtofit2
End Sub
Thank you for watching! Don’t forget to like, comment, and subscribe for more SOLIDWORKS tutorials.
Connect with us:
AMP Official site: www.ampcadcam....
Linkedin: www.linkedin.com/company/ampcadcam/
Instagram: instagram.com/amp_cad_cam
Негізгі бет Creating a Macro in SOLIDWORKS: Step-by-Step Guide
Пікірлер