×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SW API HELP(Tolerance)

SW API HELP(Tolerance)

SW API HELP(Tolerance)

(OP)
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.

 

RE: SW API HELP(Tolerance)

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?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources