Time required for change documentation. Time required for the myriad mundane tasks that we all must fit into the schedule. So what about time for the real design work? You know… the stuff we learned in school.

Author:Kisida Tygosar
Language:English (Spanish)
Published (Last):10 April 2004
PDF File Size:10.25 Mb
ePub File Size:19.33 Mb
Price:Free* [*Free Regsitration Required]

This exercise is designed to go through the process of changing settings for materials. It will also review several standard Visual Basic. NET programming methods. It will also examine a method for parsing through an assembly tree to change some or all of the parts in the assembly.

As an additional preface to this chapter, remember that SolidWorks sometimes does things better than your macros might. For example, since SolidWorks , you can select multiple parts at the assembly level and set their materials in one shot.

You used to have to edit materials one part at a time. This chapter was originally written before you could set materials so easily. As a result, you should use this chapter as a means to better understanding some of the tools available through Visual Basic. No matter how clever you get with your macros, at some point someone else might come up with the same idea.

In the perfect world, you could obsolete your macros as SolidWorks adds the functionality to the core software! Part 1: Basic Material Properties The initial goal will be to make a tool that allows the user to select a material from a pull-down list or combo box. When he clicks an OK button, the macro should apply the appropriate material to the active part.

The user should be able to cancel the operation without applying a material. We could take the approach of recording the initial macro, but the code for changing materials is simple enough that we will build it from scratch in this example.

User Forms Through the first chapters, two different methods for gathering user input have been introduced. One method was the input box. The other method was Microsoft Excel.

This improved things by adding command buttons and multiple input values. Many times it is better to be able to organize user input in a custom dialog box or form. This is a standard with practically any Windows software.

These allow users to input text, click buttons to activate procedures, and select options. After this example you will have created a form that looks like the one shown using a drop down list or ComboBox and two buttons.

Add a form to your macro by selecting Project, Add Windows Form. Choose the Dialog template and click Add. A new form will be added to your project named Dialog1. In order to add additional controls to the form you will need to access the controls Toolbox from the left side of the VSTA interface. It is a collapsed tab found immediately to the left of the newly created dialog form. Click on the Toolbox and optionally select the pushpin to keep it visible as you build your form.

Drag and drop the ComboBox control from the Toolbox onto your form. After adding the ComboBox and resizing, your form should look something like the following. An effective form is one that is compact enough to not be intrusive while still being easy to read and use. Each of these controls has properties that you can change to affect its visual display as well as its behavior.

Select the OK button. The Properties window will show all of the controls properties. This is the same general idea as the SolidWorks Property Manager. Review the following properties that were defined by the use of the Dialog template. This is the text that is visible to the user.

This name is what your code must reference to respond to the button or to change its properties while your macro is running. Select the Cancel button and review its Text and Name properties as well. Select the dialog itself from the designer, not the Project Explorer, and change its Text property to Materials. Review the following properties of the dialog form that were set by using the Dialog template.


SOLIDWORKS Macro Automation: It’s About Time

The API enables users to create custom programs macros that can assist them in automating many of the tasks of the graphical user interface GUI. This can be as simple as creating PDFs of several drawings to more complex tasks such as generating complete parts and assemblies from code. This article will walk through some of the API basics by creating a simple extrusion. Figure 1. The Command Manager menu. Right-clicking the menu bar area will bring up the menu shown in Figure 1. Figure 2.


Solidworks VBA book?


Related Articles