Engineering applications using CAD based application programming interface

Automating the design process of a product or a system can provide engineers and designers with many benefits. As such, repeatable tasks that are time consuming can be handled automatically and with minimal human attention. This is achieved by using the API (Application Programmable Interface) of CAD systems in order to create macros or even develop software applications. The present paper deals with an application that has been developed with the API of a general purposes CAD system. This application automates the design process of a standard pneumatic double acting cylinder based on the appropriate inserted parameters (ISO 15552).The design process begins with the creation of a series of components developed as solids, and extends to the extraction of basic attributes and properties from the complete mechanical assembly. Finally, the assembled models and the extracted data can be used to further study the design of the pneumatic double acting cylinder. It is expected in the future to expand the features of the presented application in order to automate the design process of other related mechanical systems.


Introduction
Almost every feature that is available in a CAD system can be automated.Thus, the use of the API is required when developing engineering applications.Applications like these can aid the productiveness of many workshops that produce a limited range of products or that are specialized in a specific range of mechanical systems (i.e.machinery).
The most common advantages from the use of the API in the design process are easily noticed.First of all the development time of a product decreases drastically.Moreover, the applications that can be created with the use of the API can combine various functionalities of a general purposes CAD system, in a sole and easy to use interface.In addition, the interconnection between different software is applicable, which supplements the functionality of an all-around software tool.

Literature survey
Many researchers have used the API of various CAD systems in order to develop applications and tools, and always the conclusions dictate that the benefits and the advantages of the API are vast.According to Kyratsis et al., up to date CAD software environments are filled with powerful modelling capabilities and by using the API of a modern CAD system, the DRILL3D software routine was developed.The application creates parametrically controlled tool geometries and by using different cutting conditions, achieves the generation of solid models for all the relevant data involved during the drilling manufacturing process (drilling tool, cut workpiece, undeformed chip etc.) [1].
Neto et al. developed a CAD based system in order to program a robot from a 3D CAD model, allowing users with basic CAD skills to generate robot programs off-line [2].Another use of the API can be found in the study of Haba and Oancea on the manufacturing technologies that are designed for the assembly of a single cylinder, four strokes, air cooled engine block [3].Similarly, Badan and Oancea developed a software tool that allows user to generate different types of holes, on parallelepipedic solids, starting from different references as edges, vertexes, known points on the solids, or different types of entities which are placed on the solids [4].
The present paper acknowledges that with the use of the automatic programming interface of a general purposes CAD system, it is possible to develop a collection of CAD based applications that can be easily accessed with the help of a simple user interface.The presented applications were developed with the VBA (Visual Basic for Applications) programming language that is embedded in the selected CAD system.One such application can be used to build the solid models of the pneumatic cylinder's components complying with the ISO 15552:2004 [5].Then, the built models are combined to form the assembly of the pneumatic cylinder.Subsequently, with the complete assembly model, more functions become available.Such as the automatic mechanical drawings creation for each component and the extraction of the assembly's properties that can be stored to a Microsoft Excel TM file for further study.With this collection of applications, the pneumatic cylinder application can become a workstation for routine CAD based processes.

Pneumatic cylinder application presentation
All tools that are available in this application are related to an important mechanical element, a pneumatic double acting cylinder which complies with the ISO 15552 standardization.This standardization refers to pneumatic cylinders with a maximum rated pressure of 10 bars.Pneumatic cylinder scan be found in many industrial processes as parts of various machines, whereas the double acting type is the most used cylinder.This is due to the fact that this type is very reliable, can be repaired and have increased durability.

Pneumatic cylinder tool flow
In figure 1, the flowchart of the pneumatic cylinder application is presented.From left to right, the flow is straightforward.First of all, the necessary data are imported; the required force of the piston, the number of duty cycles that the piston must perform and finally the pressure of the compressed air.With these parameters defined, the application can calculate the theoretical diameter of the piston.Next, the materials are set depending on the cylinder use.At this point, the modeling process begins.At first, the cylinder's components are built, in order to form the assembly of the pneumatic cylinder at any time.Figure 2 presents the functions that become available once the assembly model is completed.It also presents the interconnection between SolidWorks TM and other software like Microsoft Office TM , which is necessary for the application to perform certain functions.These functions are the creation of the mechanical drawings for every component, the creation of the required process plan for the cylinder's support (sheet metal part), as well as the creation of the bill of materials (BOM) of the assembly.In addition, the application can produce rendered models of the 3D solid models.These functions do not interfere with each other, which mean that they can be performed at any order.

Basic calculations
In order for the application to perform the calculation of the piston, the below stated equations are used.These equations derive from Pascal's law and depend on the volume of the air that occupies the inside of the cylinder.
Equation 1 represents the force that the piston can exercise when extracting, and equation 2 represents the force that the piston can exercise when retracting.Where P is the pressure of the air in bars, d is the outside diameter in mm of the piston and Ș is a theoretical coefficient that determines the loss of force due to friction.
Based on these equations, the application determines the recommended diameter of the piston with the use of the inserted data.Figure 3 presents the main dialogue window of the pneumatic cylinder tool, which is used to perform the calculations and build the parts.

Part design process
The design process of the cylinder begins with the design of its components.As seen in figure 3, with only two parameters inserted, all of the components can be built.Because most mechanical elements comply with specific standardization, their secondary dimensions can be derived from the basic dimensions.So in the case of the ISO 15552 pneumatic cylinder, the and the stroke of the piston act as reference to all other dimensions.
Before using the application to design the cylinder's components, it is necessary to select a template, a saving path and a set of materials.These parameters are set by default, but can be changed as required with the use of the tab 'Properties' (figure 4).The template path is where the application loads the appropriate template, depending on whether a part, an assembly or a drawing is about to be created.The save path is where all the documents created are stored.And the selected materials label indicates the set of materials that is going to be used for the components creation.As far as it concerns the structure of the design process code, it is divided in six steps.These steps are always executed in order to build the 3D solid model of every component.Figure 5 depicts the steps used in the case of the cylinder piston.The application uses the inserted data in order to initialize the necessary variables.The values of the primary dimensions (piston diameter and stroke) are given by the user, while the secondary dimensions derive from the primary dimensions and the mathematical equations ( 1) and (2).For example the width of the piston is known to be a specific percentage of its diameter.

Assembly creation process
The final stage of the design process is the creation of the cylinder's assembly.The required parts that comprise the assembly are loaded from the save folder, so it is obvious that prerequisite for the assembly creation is the set of the component models.Each part is assigned with specific mechanical properties, which are predetermined as described in the ISO 15552 standardization.The values of the mechanical properties are taken from a library that contains a collection of information about various materials available with the CAD software.The materials of the components and their properties, change accordingly based on the application that the cylinder is scheduled to be used.This means that the material selection is depended on the compressed air pressure.
The used design method for the assembly is the bottom-up method, where parts are modeled first and then inserted into an assembly for positioning.The structure of the assembly and the dimensions are almost identical to a physical pneumatic cylinder model; some design deviations may exist as different manufacturers make use of different design approaches.The design process of the parts and the design process of the assembly both share a similar flow.It is divided in six steps and begins with the connection of the application with SolidWorks TM and the declaration of a group of variables.The creation process flow of the assembly is presented in figure 6.

Other applications
Besides the part and the assembly design process, the application provides an extra set of four tools that require a completed assembly model in order to function properly.These tools can be used at any order.
The first one regards the creation of mechanical drawings with basic dimensioning, for each part and assembly.The dimensions and the annotations that are used in the mechanical drawings are those that were used during the design process of the parts and the assemblies.The second tool is responsible for the rendering process of any solid model that is on the screen.The rendering is carried out at a fixed resolution.The third tool can be used to export the basic attributes of any solid model that is on the screen.The extracted attributes can then be stored at an Excel TM file as columns of a bill of materials or printed on screen in a dialog box.The last tool creates a Word TM document that acts as a process plan; it contains all the necessary information for the manufacturing of the sheet metal parts included.These sheet metal parts are used as supports for the final assembly.All required information and data are derived from the solid model of the parts, which then is exported to Microsoft Excel TM and Microsoft Word TM accordingly.Figure 7

Conclusions
With the use of the API of a general purposes CAD system it is possible to develop applications in short time that can be used to analyze various engineering situations.The main advantage of such applications is that there is no need of any physical model in order to simulate and analyze any engineering processes, or even to extract data.It is also clear that the programming of the API can speed up many standard CAD processes and save time that can be better allocated.The development of human to machine interfaces can also be achieved with the use of the API and can drastically increase the manufacturing productivity in today's modern industries.
The publication was financed by the 'Teaching and research activities sponsored by HAAS Automation Ltd' project, Special Account of Education and Research, Western Macedonia University of Applied Sciences, Greece.

Fig. 1 .
Fig. 1.The flow chart of the presented application.

Fig. 4 .
Fig. 4. The Properties tab of the application.

Fig. 6 .
Fig. 6.Flow of the assembly design process.

Fig. 7 .
Fig. 7.The final assembly of the pneumatic double acting cylinder.