A Culture of Improvement: Small Changes for a Big Difference

In the world of CAD and 3D modelling, efficiency is key. For engineers and designers using SolidWorks, one of the most powerful tools at their disposal to increase productivity is using macros. Macros are scripts or programs that automate repetitive tasks, saving time and reducing the potential for human error. A prime example of their utility can be seen in the process of adding corner holes to lasered parts for clearance.

The Need for Precision and Efficiency

When creating parts for manufacturing, especially those cut by laser, it’s crucial to include clearance holes at corners. These holes prevent the laser from overheating the material at sharp turns, ensuring the quality and durability of the cut part. However, manually adding these holes to every corner of every part can be incredibly time-consuming, especially for complex designs with numerous parts.

Enter SolidWorks Macros

This is where SolidWorks macros come into play. By automating the process of identifying corners and placing holes, a macro can reduce what might have taken hours to a matter of seconds. For instance, a well-designed macro can automatically:

  1. Identify Corners: Analyse the geometry of a part to find corners where clearance holes are needed.
  2. Determine Hole Specifications: Based on predefined criteria or user input, determine the size and other specifications of the clearance holes.
  3. Place Holes: Automatically add hole features at each identified corner, adhering to the specified requirements.

A Practical Application: Automating Corner Holes for Lasered Parts

Consider the task of adding corner holes to lasered parts for clearance. A macro can be programmed to:

  • Select a face or edge of a part within an assembly or part file.
  • Identify all corners of the selected geometry.
  • Place a sketch point at each corner.
  • Use these points as references to create hole features, ensuring they are properly sized and positioned for optimal clearance.

This automation not only speeds up the design process but also introduces a level of standardisation and accuracy that manual processes might lack. By ensuring that each hole is placed consistently and correctly, the macro minimises the risk of errors that could affect the manufacturing process.

Writing the Macro

Writing a macro for this purpose involves understanding the SolidWorks API (Application Programming Interface) and basic programming principles. The macro would typically:

  1. Start by identifying the user’s selection in SolidWorks, ensuring it’s the desired face or edge of a part.
  2. Analyse the geometry to identify corners.
  3. For each corner, create a sketch point and then a hole feature based on predefined specifications.

While writing such a macro requires some initial effort, the return on investment is substantial in terms of time saved and increased accuracy. Here’s a version of the macro tailored for selecting a face in an assembly and placing points at the corners of the selected face. This macro assumes that the face is planar and rectangular, which is typical for a cube’s face:

Dim swApp As Object
Dim swAssembly As Object
Dim swSelMgr As Object
Dim swFace As Object
Dim swEdges As Variant
Dim swEdge As Object
Dim swCurve As Object
Dim swSketchSegment As Object
Dim startPoint(2) As Double
Dim endPoint(2) As Double
Dim i As Integer

Sub main()

    Set swApp = Application.SldWorks
    Set swAssembly = swApp.ActiveDoc
    Set swSelMgr = swAssembly.SelectionManager
    
    ' Ensure a single face is selected
    If swSelMgr.GetSelectedObjectCount2(-1) <> 1 Then
        MsgBox "Please select a single face."
        Exit Sub
    End If
    
    ' Ensure the selection is a face
    If Not swSelMgr.GetSelectedObjectType3(1, -1) = swSelectType_e.swSelFACES Then
        MsgBox "Selection is not a face. Please select a face of a cube."
        Exit Sub
    End If

    Set swFace = swSelMgr.GetSelectedObject6(1, -1)
    swEdges = swFace.GetEdges
    
    ' Loop through each edge of the selected face
    For i = 0 To UBound(swEdges)
        Set swEdge = swEdges(i)
        Set swCurve = swEdge.GetCurve
        
        ' Get start and end points of the edge
        swCurve.GetEndParams startPoint(0), endPoint(0), startPoint(1), endPoint(1)
        
        ' Place a point at each end of the edge
        swAssembly.SketchManager.CreatePoint startPoint(0), startPoint(1), startPoint(2)
        swAssembly.SketchManager.CreatePoint endPoint(0), endPoint(1), endPoint(2)
    Next i

End Sub

This macro does the following:

  • Checks if exactly one face is selected when the macro is run.
  • Verifies that the selected entity is indeed a face.
  • Retrieves the edges of the selected face.
  • For each edge, it gets the start and endpoints.
  • Places a sketch point at each unique start and end point of these edges.

Please note, that this macro places points in the assembly’s 3D space, not within a 2D sketch. If you’re working within the context of an assembly, this behaviour might be what you’re looking for. However, if you intend to work within a part or sketch context, additional modifications would be necessary.

This script also doesn’t filter out duplicate points (where edges meet), so you might end up with overlapping points at each corner. Depending on your application, you may need to implement additional logic to avoid duplicating points.

SolidWorks macros are a game-changer for CAD professionals, offering a way to significantly speed up the design process and improve workflow efficiency. By automating repetitive tasks like adding clearance holes to lasered parts, macros not only save valuable time but also enhance the precision and consistency of the designs. As the complexity of designs and the demand for faster turnaround times continue to grow, the ability to automate with macros becomes an invaluable skill in the CAD user’s toolkit.

How Saving Seconds Can Translate into Weeks of Time Saved Annually

The theory of saving seconds per operation over many operations per year is a principle rooted in the broader concept of marginal gains and efficiency improvement. The idea is straightforward but powerful: if you can save a small amount of time on a task that you perform frequently, the cumulative effect over many repetitions can lead to significant time savings, increased productivity, and often, a reduction in operational costs. Let’s break down this theory and explore its implications.

The Principle of Small Savings

Saving 30 seconds might not seem much when viewed in isolation. However, when this saving is applied to an operation that’s performed repeatedly, the impact can be substantial. For instance, consider an operation in a manufacturing process, a routine task in software development, or a frequent activity in any workplace.

Cumulative Impact

Assuming an operation is performed 100 times a day, saving 30 seconds per operation results in a saving of 50 minutes per day. Over a typical working year of 250 days, this translates into a saving of 12,500 minutes or approximately 208 hours. This is over five standard work weeks of time saved simply by making a small efficiency improvement.

Productivity and Cost Implications

The time saved can be redirected to other productive activities, thereby increasing the overall output of an individual or organisation. Moreover, in environments where time directly correlates with costs (e.g., hourly wages, machine operation times, or service delivery speeds), these savings translate into tangible financial benefits.

Quality of Work-Life

Reducing the time spent on repetitive tasks can also improve job satisfaction and reduce worker fatigue. This, in turn, can lead to better work quality, lower turnover rates, and higher employee engagement.

Exponential Benefits with Scalability

The benefits are magnified in larger organisations or systems where many individuals perform the same operation. For example, if a company with 100 employees implements a change that saves 30 seconds per operation, the total time saved becomes exponentially greater.

Continuous Improvement Culture

Adopting this approach fosters a culture of continuous improvement, where employees are encouraged to identify and implement small efficiency gains. Over time, this can lead to a significant competitive advantage, as the organisation becomes more agile, efficient, and responsive to changes.

Considerations and Limitations

While the theory highlights the potential for efficiency gains, it’s important to consider the context and potential trade-offs. For instance, efforts to speed up operations should not compromise safety, quality, or customer satisfaction. Additionally, there may be diminishing returns on time-saving measures beyond a certain point, and not all operations may offer opportunities for such savings.

In summary, the theory of saving 30 seconds per operation underscores the importance of efficiency and continuous improvement in any workflow. By focusing on incremental gains, organisations and individuals can achieve significant cumulative benefits, driving productivity, reducing costs, and enhancing work-life quality.

Index