Application Programming Interface In Programming Languages Computer Science Essay

Published: November 9, 2015 Words: 1539

PART 2

An application programming interface (API) is an interface implementation by a software program. The program can interact with the other software. API is similar to the user interface on interaction between human and computers. The implementation is via applications, libraries and operating system to decide their vocabularies and calling back conventions and used to access their service. API have include specifications such as routines, data structure, object class and protocols and used them to communicate with the user and the implementer.

2.0.1 API in programming languages

Programming languages is a language design to express computation and then to perform by a software. Syntax (form) and semantics (meaning) are the form of written specification on programming. There are many examples programming languages such as Visual Basic, C families, FORTRAN and others. In SolidWorks, the programming languages that can use are only Visual Basic and C++.

There are differences between Visual Basic and C++ but they are the first-class programming languages and equally powerful. Visual Basic is a true object-oriented programming language. Visual Basic includes with a new and improved features such as interface while C++ use common language runtime. The both languages are almost no performance issues. C++ only has a few more features such as handling unmanaged code while visual basic may be easy to use.

Visual Basic language will be use on this project because there are no facilities to use legally SolidWorks 2010 software. C++ language only can use with SolidWorks 2010 but the facilities only provide legally SolidWorks 2008 software. Therefore, Visual Basic is the choice to use on SolidWorks API.

The research has presented an application of Visual Basic Application Programming Interface (API) to develop numerical and procedural algorithm into CAD software. The focus is on Reverse Engineering embedded into SolidWorks. There are many applications is need to remodel the tessellated surface into an editable solid feature, to analyze it and to manipulate. SolidWorks is widely used commercial software about engineering modelling and computer aided design. SolidWorks is base on parametric definition of component and feature and it can be use in very intuitive way. Other engineering modelers (such as Catia) have dedicated module for reverse engineering. Specific reverse engineering software (such Rapidform) does not allow the building of parametric feature-based models. In many cases their also need to implement specific algorithm to perform dedicated an accurate computation which cannot be found in any commercial software. These are the main reason to API within commercial software. Recent SolidWorks have improved the method supported by native object and they have been interlace with very powerful Mathematical Utility. Using API into SolidWorks we can manipulate three kind of object from:

SolidWorks (model native entities)

math utility database (math entities)

User defined entities

The native geometrical objects concern the sketch entities (point, line, circle, spline, etc) and their constrain, the features (extrusion, revolution, loft, etc) the assembly management (mating, inserting, moving, etc). The math native objects concern point, vectors and transformations for manipulate entities (projecting from model space to sketch space and vice versa, performing basic operation on vector, etc). The software without API the user can only access to single model entity and the direct access to internal database is not permitted. Using API database of entity can be directly access saving time to execute command and model entities can interlaced with math and user defined ones. [2]

The concept that researcher have use is similar with this project, but the main researcher focus is on remodel process design. The process is similar to the integrating process design. However, this project is focus on module design by using SolidWorks and Visual Basic.

2.1 Solid Modelling

Solid Modelling is a digital representation on the geometry of an existing object. Solid modelling is rapid evolved into large body of knowledge. [Requicha88]. The solid modelling is implemented on solid modelling software have increased design productivity, improved product quality and reduce the manufacturing and overhead cost.

2.1.1 Representation

Representation is the most common schemes for representing 3D object such as data structure and boundary representation. Boundary representations define its boundary by using a physical object that modelled with mathematically.

2.1.2 Parametric models

The position and size parameters used to instantiate the primitives needed. The object representation provide a natural parameterization for the object. There are no promise that change the value of parameter will produce an object that is valid to the designer’s intent.

Elasis and FIAT Auto started to test parametric and associative (P/A) techniques since 6 years ago. Fiat is one of the first automotive companies that have test P/A features in development of a new car. Car body design is very critical and time-consuming activity for design modifications during car development of a new car body and the same parametric model is reuse for future platforms are the reasons to develop a new P/A design methodology. The methodology is base on P/A but should have the concept of archetype. An archetype is a set of logical and parametric features of an object. The system can be use to build the relative CAD model. The advantage of the archetype design can generate different components with simply changing its parameter values.

The phases of design methodology were the following:

Define the vehicle reference model( developed with explicit CAD systems and procedure)

Build the design development history (list of modification)

P/A modeling of new vehicle model.

Optimization phase

Model update during vehicle development

The traditional process of modelling and the new method based on P/A approach have been compare in qualitative. The development time of model is longer for P/A method, because it is necessary to build P/A library archetypes. P/A library enables to reduce time design because it is reduced the modifying phase. The explicit design takes always the same time for every style change. [1]

The P/A approach seems to be strong enough to manage several style modifications, saving time and costs. The approach is not suitable to use on this project because the phase of design methodology are use on the higher design development. This project is only use the basic method to perform a solid model using a parametric design.

2.2 SolidWorks

SolidWorks is the CAD software with three-dimensional (3D) design. The software can run on Microsoft Windows. Dassault Systèmes, S. A. (Velizy, France) is a developer of SolidWorks software. SolidWorks is currently one of a most popular 3D mechanical CAD (MCAD) product on the market.

2.2.1 Macro in SolidWorks

SolidWorks macro is a shortcut task to perform repeatedly in SolidWorks 3D CAD software. Macro in SolidWorks is a series of command system and actions that and can be stored by safe the macro file. Macro can run within SolidWorks whenever users need to perform the task. SolidWorks allow user to record or build a macro and then play the macro with automatic repeat the series of commands or actions.

Furthermore, Cadet Officer Shahrul from National Defence University has created a macro using AutoCAD for conveyer Belt Drawing. The macro is only for vertical conveyer belt. The disadvantages of this macro is using AutoCAD so, the output of the drawing is in 2D drawing. Compare with SolidWorks, the macro output is in 3D solid drawing and the properties of the solid can be change according to the user needs.

Cadet Officer Norizam from the same university also has done the research on the macro in SolidWorks. He has developed a shaft module design but the scope is only on strength of shaft. This project will continue his project but with the advance feature such as size of shaft, vibration characteristic, key and splines required at the shaft.

2.2.2 Macro methods

SolidWorks macros have method to generate a coding in Visual Basic. Creating line by line is the best method because it will using revolve. The benefit of using this method is the output will perform the various diameter in same shaft. The second method is by using record and customize the macro. The disadvantage of this method is the diameter is only perform two different diameter in the same shaft. This project will use both methods in SolidWorks macro.

This is the example of the basic coding to perform the output of macro in SolidWorks.

Private Sub CommandButton1_Click()

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

Set SelMgr = Part.SelectionManager

swApp.ActiveDoc.ActiveView.FrameState = 1

Part.ClearSelection2 True

Dim SkCircle As Object

Set SkCircle = Part.SketchManager.CreateCircle(0, 0, 0, txt1.Text, 0.01204577213997, 0)

Set swApp = Application.SldWorks

Set Part = swApp.ActiveDoc

Set SelMgr = Part.SelectionManager

swApp.ActiveDoc.ActiveView.FrameState = 1

Part.ClearSelection2 True

boolstatus = Part.Extension.SelectByID2("Arc1", "SKETCHSEGMENT", -0.8064555910983, 5.647595742447, -2.202903393242, False, 0, Nothing, 0)

Part.FeatureManager.FeatureExtrusion2 True, False, False, 0, 0, txt2.Text, txt2.Text, False, False, False, False, 0.01745329251994, 0.01745329251994, False, False, False, False, 1, 1, 1, 0, 0, False

Part.SelectionManager.EnableContourSelection = 0

Part.ClearSelection2 True

End Sub

2.3 Conclusion

The computer software is no substitute for the human thought process. The user is control the system and the computer is the driven to assist the user on the platform. Numbers generated by a computer can be far from the truth if the user entered incorrect input, if the user misinterpreted the application or the output of the program. The user task is to ensure the validity of the result. The user must check the application.