Wednesday, December 16, 2009

Macro Recording - SolidWorks


Macro Recording

You can record operations performed with the SolidWorks UI and replay them using SolidWorks macros. A micro contains calls to the API that are similar to operations performed in the user interface. A micro can record mouse clicks, menu, and keystrokes.

Recording a micro can eliminate your work by 80 to 90%. Lets start with basics…

Macro Toolbar

The Macro toolbar contains shortcuts to the macro recording commands. You can also access these commands from tools ……. Macro menu

By default, the Macro toolbar is ‘turned off’ To create and use your macros, it is better to make macro toolbar visible on the top. From View menu, select Toolbars, Macro.

· Run/Play: Launches the Run macro dialog box, where user selects the macro to execute

· Stop: Launches the Save As macro option, User can save macro giving it valid name and extension

· Record/Pause: Allows user to begin or pause macro recording

· New:Launches new macro dialog box, user can name macro, and VBA editor opens the macro file for user to begin programming

· Edit: Selecting macro to view and modify

· Custom: Allows user to customize button on macro toolbar

Let’s cover recording and cleaning up of extra code added during macro recording in next article.

Bye,

Sachin Nalawade

Editor-dailycadcam.com

Friday, December 11, 2009

VBA for CAD Customization


VBA for CAD Customization
Visual Basic for Applications (VBA) is AutoCAD, SolidWorks, ZWCAD, MicroStation inbuilt programming language. Today we will consider AutoCAD Customization environment. Visual Basic for Applications comes from a long line of BASIC language development environments and latest VB6. VBA first appeared in Microsoft Excel and Microsoft Project. It was introduced to AutoCAD in Release 14.0 as a “preview edition.” In Release 14.01, VBA became a permanent addition to the core AutoCAD application.
CAD programmers than any other language for automation mostly use VBA. It gives AutoCAD/SolidWorks well-developed and robust interface for customization and automation. Visual Basic for Applications utilizes the same Visual Basic language syntax, VB. Support complete integration into AutoCAD; VBA is both complete and powerful. Internal to AutoCAD, it acts as an in-process controller, providing outstanding performance. Before VBA was, introduce LISP use to rule programmers working for automation.
Going For VBA
Users can create useful applications by learning just a few of the keywords, and powerful features of language allow professionals achieve higher design automation that is done using any of the high-level programming languages. VBA is easy to use and simple language, lot of help is provided by parent companies with supportive forums.
Like,
When working on few projects on AutoCAD customization, I got lot of help from above Autodesk forum.
Because VBA’s powerful visual interface takes care of most of the background programming tasks, creating highly functional and useful programs is virtually nothing more than dragging pre-built objects into place on screen and tying them together with a logic. In addition, being an AutoCAD user means that you already have most of the skills necessary to create an effective user interface. The benefits of VBA include the following.
· Run-time Speed – Faster than AutoLISP applications
· Ease of Use – Built-in and easy to use
· Debugging – Finding and correcting errors has never been easier
· Easy to build form, many routines can be reused
· Built into Windows, VBA allows communication and control of other applications
When writing Visual Basic for Applications (VBA) routines, is easy task, as language uses everyday common language (as most engineers are know C or VB), pre-built visual objects, and have fully developed programming environment.
AutoCAD's VBAIDE
The VBAIDE (Integrated Development Environment) is made up of different windows, grouped according to their purpose or use. The "Design Group" includes the Code, the UserForm, and the Properties windows. The "Debugging Group" includes the Immediate, Locals, and Watch windows. Other windows include the toolbox, object browser, and project explorer. The parts and pieces that make up this IDE include the following windows grouped according to their usage


· Code Window – This is where we will put the logic and decision-making program of our projects
· Object Box – Located on the left side; displays the main divisions of your code. These divisions change based on what this code refers to such as: UserForms, Modules, or ThisDrawing
· Procedures Box – Located on the right side; displays the individual functions, procedures, or pre-defined methods available to the object displayed in the Object Box
· UserForm Window – This is our "Visual" layout of your project, where we arrange the buttons, boxes, text, etc. that are displayed when we run our programs.
· Toolbox – Can take various parameter required
· Properties Window – Like the properties window inside of AutoCAD, when we select something like a button or form we can adjust all the properties of our selection such as color and font
· Debugging window - This is where we can test and explore commands and "code" or logic, user can debug your code in real time
· Project Explorer Window – This window allows users to manage, add, and delete all the parts and pieces of the project created
VBAIDE, provided "free" inside of AutoCAD, is a feature rich, easy-to-learn development environment that can help you debug your code in real time. So start with AutoCAD Customization, be experts…

By,
Sachin Nalawade
Editor-dailycadcam.com

Thursday, December 10, 2009

Overview On Recording Macro Using SolidWorks


Overview On Recording Macro

I thought of writing on SolidWorks customization since July on few of my friends demand, but never made it due to tight working schedules. December like wise it my favorite month with lot of rest!

So coming to you. First lets go with fundamentals of API programming.

Application Programming Interface (API) is used to automate redundant and lengthy design tasks using SolidWorks. One can create complete engineering application that runs inside or outside of SolidWorks application. So starting with basics of customization will help professionals as well as students developing fundamental skills.

Many times, it happens that Mechanical engineers are not aware about programming languages. Just having CAD designing knowledge is not enough, hence before we proceed I suggest Mechanical engineers to learn LISP, C, VB and if possible .NET. LISP is very easy language and lot of online help is available for one to learn. It helps to build good foundation of your programming skills.

Getting started

There are few things a programmer should note before recording a macro in SolidWorks or writing an application in VB that connects to SolidWorks.

File Type: SW VBA Macros (*.swp)

Option Explicit: It is recommended that you use "Option Explicit" statement in VB development. By doing so, the Visual Basic compiler forces you to declare of all variables before use.

Variable deceleration: Variables are used to store temporary values and are made up of two parts 'Name' and 'Data Type' Variable is declare with the Dim statement.

e.g. Dim variablename [As data type]

Option “As data type” allows you to define the data type or object type of the variable.

Data Types: Visual basic supports these standard types of data

· String - Holds characters

· Integer – Holds numeric values

· Long Integer – Holds numeric values with higher values

· Single precision – Holds numeric value with decimal points

· Double precision - Holds numeric value with decimal points, accurate to sixteen digits

· Decimal – For large numbers

· Date – Holds date, time values

· Byte – holds integer value

· Boolean – Holds values either True or False

· Variant – Holds all data types

· Object

NOTE: All APIs use meters and radians for length and angle units

You need to include SolidWorks Constant type library to each project, for whatever version you are using. But if record a macro using the VBA environment in SolidWorks the type library will be automatically included.

Starting Point

Recording a macro is best way to know basic functionality. Consider following tips while recording a macro.

· Use macro recording for small applications. Record few steps at a time

· Plan steps before recording a macro

· Limit the number of view changes you make while recording

· Remove unnecessary calls (that we will discuss later)

· Look for help topics, tutorials included with SolidWorks

Next session I will cover “Using Macro Recorder”

Bye,

Happy daily cadding

Sachin Nalawade

Wednesday, December 9, 2009

Design Dream


Being an Automotive designer

India's role in automotive design is expanding and various design centers coming up in various part of country prove it. Almost 90% of Mechanical/Automobile engineering graduates want themselves to be "Design Engineer" rather then working on shop floor. But still India has just 1% of total automotive engineers in world.

While working with international CAD Media Company, We use to receive lot of enquiries related to career options in automotive design from various sections of users. It is difficult question to answer when queries come from Indian students, as I personally feel India still lacks to fulfill learning needs of students compared to developed countries.

How to become an automotive engineer?

I spoke to few of my friends working as automotive designers in Bajaj Auto, Tata Technologies, Volvo, GM, Hero Honda, Onward Technologies trying to find true way to become designer. Got one common answer that “they were lucky to get opportunities”. Listening to this answer is not surprising as non of them were from reputed Universities neither did expensive CAD courses. So what let them to reach their destination?

Not just, luck! Guiding career on right track is important aspect while starting a career. One must be hard working, must have passion for cars and bikes, creative, dedicated, and more. Speaking to Dev Kasar, Volvo design center, Bangalore. I came to know amazing hard work done by him for being an automotive designer. He started his career with working on AutoCAD, which he learned during college stage, got very low salary working with automotive vendor. He worked hard for 2 years and meanwhile upgraded his skills by learning Inventor, CATIA, and UG on-job. Therefore, it is on-job learning which helped him to reach high, but it cannot be the case with all of us.

Few years back Indian Automotive makers fully depend on design studios from Italy, Australia, US. Now its boom in India and many cars running on road are designed here itself. So craze to be an automotive designer is increasing, but are our learning centers enough? There are many CAD institutes conducting CAD courses for automotive designers, but not all the students doing such courses land as automotive designers. Because CAD institutes lack following.

· Experienced faculty members to teach

· Using pirated/out dated crack versions to teach students

· Lack of proper hardware available

· No guide lines set for Automotive design courseware

· No Live project facility

So, I see many Institutes blooming up but close down before the first batch passes it course. But its truth...

No need to get panic a good news it that few Government recognized institutes are coming up for generating world class design engineers like IDC at IIT Mumbai, (www.idc.iitb.ac.in), National Institute of Design Ahmedabad (www.nid.edu) MIT Pune, Few private certified institutes by PTC, Siemens, Dassault System. Although change is, slow but positive sign for future.

According to Mr. R M Rathore, India Marketing head of US based Product Development Company, its era of internet. His company has invested lot of time in developing free e-learning material for users. It helps them to create market for there software in high competition and users are benefited by learning advance 2D and 3D CAD software for free. Hundreds of tutorials from basic to advance on Automotive are available thru net.

Speaking to my friend Vikram Rao, who after doing CAD courses from CITD Hyderabad (http://www.citdindia.org) it is better to do internship with automotive vendors or design firms working for automotive companies if you directly don’t get placement in automotive company. He feels small companies are best place to learn and master CAD software. It is true car designing is not easy task; one has to go rigorous learning, problem solving and practicing phase. He also suggests that one has to be good in analytical and visualization skills and need to develop them while studying in college.

First step towards...being design engineer.

Start today, depending on your age start preparing from today itself. At school/college stage, start working on basic drawing and sketching cars and bikes. Explore your knowledge by reading auto magazines and internet. Work on developing your graphic skills using computer. Get membership of ARAI, VRDE library, register to SAE newsletters, and try your hand on 2D and 3D by using trial version of Free CAD software (www.freecad.com) available. Most employers prefer younger designers with high talent and skills.

Few websites to go for

http://www.siamindia.com/ - Society of Indian Automobile Manufacturers

http://automobile.sae.org/ - SAE

http://www.carbodydesign.com/ - Car body design

http://www.designerspace.com/ - Designers Space

http://www.design-cars.com/ - Design Cars

https://www.bike-design.com/home.php - Bike Design

Foreign education for design engineers

Students now have wider options to select automotive design school offering graduate as well as MS degree like

· Art design college of design (www.artcenter.edu) USA

· Coventry school of art and design (http://wwwm.coventry.ac.uk)

· Pforzhiem school of design (http://www.hs-pforzheim.de/en-us/School-of-Design/Seiten/Bereich.aspx)

· Umea Institute of design (www.dh.umu.se)

· Scuola Politecnica di design Italy (www.scuoladesign.com)

· IED (www.ied.edu)

· University of Bradford (http://www.eng.brad.ac.uk/index.php?p=ugra_d000)

Recession has affected design jobs. However, right skills are still in demand. Automotive designer has to be master of designing all systems (i.e Body, Chassis, suspension system, lamps, interior, seating etc) Only thing that packages offered have gone down in India as companies going for cost cutting. India and China are growing markets with increasing automobile sales every month. So grab your place and enjoy bright career as automotive designer.

By.

Sachin Nalawade

www.dailycadcam.com