Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

API

Status
Not open for further replies.

SWscience

Mechanical
Jun 1, 2004
77
0
0
IR
hello all
tell me how can start using API ..
what's it ...
What can it do for me ..
Best regard
 
Replies continue below

Recommended for you

Look at the SolidWorks API and Add-Ins Help manual. What API will do for your company depends a lot on where your company is at, in their SolidWorks development. How many seats do they have and how long have they been using SolidWorks. Do you use professional? We have saved several thousands of dollars using API and macros.

Bradley
 
To use API effectively, you will need someone who knows his/her way around C, Visual Basic or both. It's powerful, but you have to know what you're doing.
 
Start with learning Visual Basic (.NET or 6) or C+. API will not make much sense unless you have an understanding of one of these programming languages.
 

SolidWorks actually has a three day course in using the API. I have taken the class and it was excellent / well worth the time if you plan on doing anything beyond simply 'experimenting with / playing with' the API.

If you want to 'play with / experiment with' the API here's what you do :
Start SolidWorks
Right click on the toolbar and add the 'Macro' toolbar to your user interface.
Click the macro button for Record/Pause Macro (black lines with a red dot.)
Do some regular SolidWorks stuff : open a file, rotate it around, start a new sketch, draw a circle, extrude it, shell it, etc.
Click the macro button to Stop Macro. It will ask you where to save it. Save it somewhere.
Click the Edit Macro button. Find the macro you just saved.
You are now looking at all the API calls necessary to redo via the API whatever you just did in SolidWorks.
If you click run right now in the Macro editor (actually a sort of Visual Basic for Applications sort of engine) it will programmatically recreate all the things you did in SolidWorks while you were recording the macro.
If you cut and paste that into a normal Visual Basic project and make it run that code when you hit a button on your form, it will do exactly what you just did manually.
Clean up the code, generally the system generated code has a lot of duplicates and selecting of faces / rotating parts that you wouldn't need to do in the program.

Voila! you are half way through the first day of API training.
 
Bradley,

Would you give an example how API can save a lot of time and money? I don't feel it is very useful. I really want to know where I can use to justify the time I spend on programming.

Lenew
 
Lenew said:
Would you give an example how API can save a lot of time and money? I don't feel it is very useful. I really want to know where I can use to justify the time I spend on programming.

We do alot of sheet metal parts for outside customers. They send us a drawing, we model it, create our own drawing, then DXF the drawing to another server for manufacturing. We have 8 different servers with thousands of directories. I use a macro to send the dxf to the correct location (I edit the macro for each project for the correct directory). So after saving my file as a SLDDRW I simply click a button and it is saved as a DXF in another location. It saves me a ton of time from browsing around the network from one server to another and then back for the next file. That is just a simple example, I am novice API person. I also use macros to create mates, change simple text on drawings such as my initials in the Drawn By, or Rev By. It all depends on what use you have, if there is a task that you find yourself doing over and over, day after day, it may be worth looking into a macro for it.
 
Lenew said:
Would you give an example how API can save a lot of time and money?

I'm almost illiterate with the SWX API (though fairly competent with VBA) but my example regards configurations.

I sometimes create files with many (>30) configurations whose names and custom properties are distinct but follow a pattern. It was tiresome and time-consuming to set them up by hand so I wrote a little API routine to automate configuration creation and it saves a bunch of time and even more frustration.

I'm also writing a routine to track and assign part numbers to parts within a given project.

As much as the time savings, the API routines eliminate the errors that I tend to make in typing.
 
LENEW said:
Would you give an example how API can save a lot of time and money?

With SW API, we created a search feature that lets us search several network drives for Parts, Drawings and Assemblies, and even DWG, with preview Bitmaps of the file. A user simply plugs in the part number and selects if they want to find a prototype, history or released file. It's very fast.

We also use an API-driven Custom Properties input window, for when we are in Part/Assembly or Drawing environments. Part/Assembly info (Designer/Engineer, material, finish, etc) is input and carried over to the Drawings. Drafting info (Drafter, Rev dates, ECO numbers, etc) are input in the drawings.

Ray Reynolds
"Computers in the future may weigh no more than 1.5 tons."
Popular Mechanics, forecasting the relentless march of science, 1949
Have you read faq731-376 to make the best use of Eng-Tips Forums?
 
I created a macro that allows me to connect shortcut's to files to buttons. This way I have 5 small buttons at the bottom right of the screen wich really saves me a lot of time browsing from project dir to project dir

Grtz, Bouke
 
Status
Not open for further replies.
Back
Top