Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

SW API HELP(Tolerance)

Status
Not open for further replies.

dsheets05

Mechanical
Feb 1, 2009
22
Hello All,

I have been working on a SW design program for quite some time now. I have almost goten the entire program complete... however I have two questions I am hoping that some of you with a little bit more coding experince might be able to help me with.

My first problem is I cannot figure out the VB code to run a Solidworks macro. I am trying to run the following macro at the end of my code right after it saves the drawing. "Macro78 - JRC.swp" which is located at "C:\Documents and Settings\dsheets\Desktop"

My second problem is pushing a bilateral tolerance to the model. I cannot seem to find the nomenclautre to set a bilateral tolerance for a specific parameter. Such as D1@sketch1.

 
Replies continue below

Recommended for you

In the past I've made a vbscript in notepad that pushes a specific macro to SolidWorks. You could make one that opens and/or activates SW, runs your first macro, then when it finishes, runs the next macro.

On Error Resume Next
Set swApp = GetObject(, "SldWorks.Application")
swApp.RunMacro "C:\Documents and Settings\dsheets\Desktop\Macro78 - JRC.swp", "Macro1", "main"

Open notepad and copy that into it. Save it and change the extension to .vbs and run it. "Macro1" is the name of the module, and "main" is the name of the sub, so make sure those match what you have. This also requires SolidWorks to be open. You can add code that checks if it's open, and opens it if it is not already.

Would this even be a path you'd consider?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor