Solidworks Automation Using Excel Add In

1 view
Skip to first unread message

Christopher

unread,
Aug 3, 2024, 5:15:37 PM8/3/24
to iranunhuu

The SOLIDWORKS Simulation Application Programming Interface (API) functionality can be used to automate the creation of studies, applying loads and fixtures, material selection, meshing, running analyses and processing results. The API provides a powerful platform for automation as well as productivity gains for any user who needs to build custom inputs or outputs to drive Simulation studies or has to work past user interface limitations.

The API contains functions that can be called from Visual Basic for Applications (VBA), VB.NET, C++ 6.0, C++.NET, and C#.NET. While knowledge of any above programming languages will help; my goal in this article is to provide you with a self-training excel automation file and a sample SOLIDWORKS part file. Before I walk you through the steps for using the attached files, here are some practical applications of the API.

In the example below of a nonlinear analysis to simulate the push and snap operation of a latch mechanism, manually transferring the data of displacement and reaction force for each time step takes roughly about 20 minutes.

The same API macro works on 2D simplification problems as well. In the below video of a 2D snap fit assembly analysis, the relationship of force required to snap through versus the vertical push distance that is needed to understand the stiffness variation in the system. The API macro takes less than 10 seconds to extract all the required data and create an excel file with XY plots.

Another example shown in the below mast structure requires a custom output as per a standard specification used for structural members or beams. The design specification requires an output of effective beam lengths and beam K factors, and also needs the list of end connection conditions for each structural member. The image below shows how the end connections drive the effective beam lengths.

There are basic API codes / calls as shown above that help establish access to a simulation study. This is the fundamental building block for everything you can control within simulation such as creating a study, controlling material choices, applying loads / fixtures / connectors on desired geometry, mesh settings, processing results etc.

There is another discussion in AD Inventor Users Group about automated design and product configurators ETO/iLogic. We used iLogic & and Excel spreadsheet and developed a fairly complex configurator. See more here..

But we realised that due to the complexity of our models and our business objectives we have to look further and evaluate other set of tools (CAD & automated configurator options) that might do better than iLogic & excel.

So we started evaluating Creo and Solidworks with DriveWorks as alternatives in close collaboration with software vendors. (we will deploy the system globally in different locations around the world).

DriveWorks Pro for example controls each component individually, there is no parametric link (top down design kind) between the components. It is very user friendly and Excl based, not much programming is needed. In theory it does everything you need: generates new iterations of your template assy, allocates part numbers, create drawings and cost too.

You might ask why all this trouble, go for ETO as we have Inventor. Well we use SolidWorks too at other factories so that we have to fairly evaluate all options and come to a common parametric platform globally.

SEE OPTIONS AND CHOICES IN WINDCHILL PDM LINK, THEY ARE USED TO CONFIGURE THE PRODUCTS BY THE CHOICE OF THE OPTION. FOR EXAMPLE, CAR MAY USE 1.6 LITER OR 1.8 LITER ENGINE, BY CHOOSING 1.6 YOU HAVE A CAR WITH 1.6 LITER ENGINE INSTALLED, WHICH IS REFLECTED IN WINDCHILL PART AND CREO PART AS WELL.

We at Tacton solves complex configuration problems, and design automation for all three CAD software you mentions. Long time ago since you posted this, but let me know which path you decided and how the result was.

SOLIDWORKS Electrical Design Automation caters to various types of user experience. For those who are starting out it can be as simple as drag objects, drop and connect wires. As the system design increases in complexity, users can then leverage automation features available within the software.

Traditionally PLC drawings are done such that the installer can follow schematic instructions and wire the system accurately. This process can follow a manual process of drag objects and make connections. In SOLIDWORKS Electrical, the PLC manager allows users to setup information with part and I/O. Users can setup relevant macros in their database and tie it in to the setup process within the PLC Manager. Once a user picks up a part, adds descriptions and select the I/O, simply selecting Generate outputs creates Automated PLC drawings for the package.

Since the application has a SQL backend, it runs on tables/columns and such. SOLIDWORKS created an excel import process which takes in parameters such X-Y positions, part numbers, descriptions for various configuration parameters that will reference Macro database and create drawings based on those selections. Essentially this Excel sheet can be used to drive option and variant packages which will reference the Macro database and create automated drawings as defined in the excel sheet.

Most designers find themselves manually creating reports or BOM for their designs. SOLIDWORKS Electrical by default keeps the reports live and available throughout the life cycle of the design process. BOM and other Reports can be exported via the Reports manager in formats such as Text, XML, Excel and/or in drawings. These can be formatted to fit drawing sheets, columns can be added/removed by simple selections. Advanced customization can be performed by changing formulas, simply activating the expert mode and creating custom SQL queries.

One of the biggest challenges of standalone 3D CAD modeling platforms is that they are time-consuming. Designers end up spending a significant amount of time in repetitive drafting work when designs are customized and drawing accuracy is compromised.

DriveWorks uses logical rules to automate repetitive modeling work and customize designs at accelerated speed as well as accuracy. Design automation with DriveWorks implementation has enabled designers to reduce engineering lead time from several days to a few minutes, and achieve approximately 70% faster design cycles and 99% drawing quality.

Despite the said benefits, design automation still remains a new concept for many in the industry. So without much ado, we answer the top questions related to DriveWorks automation, adoption and implementation.

Master models and company-specific standard BoM templates are generated in SolidWorks and Word/PDF/Excel templates outside of the DriveWorks. Once you have the template ready and captured in DriveWorks, all the details and custom properties are then linked with DriveWorks for customization.

These rules drive the changes in models/drawings and BoMs. When the user inputs the values, the variable interacts with the template for BoM and drawings to deliver resultant files as per the layout captured and specified earlier.

To create custom quotes, customers (or the sales team) specify product specifications through a series of user-forms. These forms implement logical rules to modify the master model and generate user-specific customized product.

Once the order is confirmed, customized models are saved to a specified location and relevant documents are generated. The aggregated data of product specification and customer details is then exported to a table in MS Excel (or MS Word/PDF document as specified by the client) and is updated when the table is modified.

To control and modify the drawings, open the master model assembly in DriveWorks. It will display a dialogue box to specify which properties are to be automated along with the options such as dimensions, color, custom properties, etc. In the case of a sheet metal assembly, the dialogue box offers advanced features like sheet metal patterns etc.

Drawings primarily consist of a range of dimensions and annotations for special notes, views in a standard template with BoM tables etc. For example, for a door assembly, you can define how the length, breadth, and height are oriented and placed in 3D space with respect to the reference planes.

DriveWorks allows you to select the drawings and models you want to modify by setting up the rules. Once you have the models and componentry that you want to modify, you can set upper and lower limits for dimensions using the rules task in the command bar in project designer. You can also capture views and other dimensions from the drawing files and create rules for them.

Thus, the function of Autopilot mode in DriveWorks is to trigger the queue while that of SolidWorks is to generate the custom parametric models as per the inputs. In some, one-off, 3D scenarios where every design feature is already configured in DriveWorks, there is no need of Autopilot or SolidWorks.

Yes, macros can be developed to automate many small and complex tasks while modeling in CAD software like SolidWorks. Macros are scripts that store a series of commands in a sequential way and execute the same when they are run.

Design automation using macros, allows users to avoid doing by hand many repetitive tasks required to create a 3D model. This is extremely useful where modeling of a single part of a multi-part final component is involved.

SolidWorks lets a user create a macro within and outside of its environment. While creating a new macro, one can program the macro directly using Microsoft Visual Basic via macro editing applications. Visual Basic for Applications (VBA) is the engine that records, runs, or edits macros in SolidWorks. It allows third-party integration to automate the modeling process through APIs and design automation platforms like DriveWorks.

Design engineers are required to calculate part dimensions to address functional or load criterion. Usually, they use excel spreadsheets or other engineering applications to perform these design calculations. They fetch dimensions directly from data sheets to auto-create a 3D model via parametric rules. The parametric rules are built by integrating macros and APIs with CAD.

c80f0f1006
Reply all
Reply to author
Forward
0 new messages