SolidWorks API (and API thoughts in general)

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
Grovkillen
Automation Wizard
Posts: 1132
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

SolidWorks API (and API thoughts in general)

Post by Grovkillen » Sun Jun 30, 2013 7:18 pm

Hello you all, just a check... have many of you messed around with the API for SolidWorks (or any other CAD software)? I'm starting to learn and I'm planning on building myself a MS library (kind of). I'm using VBscript to communicate with the software = more reliable coding.

Anyways, my thought was that wouldn't it be nice if we could somehow get together with API libraries that we could put into MS? I'm not sure if I make sense but as an example:

Code: Select all

GoSub>LOAD_FUNCTIONS
Let>VALUE=0.01
Let>DIMENSION=D1
Let>SKETCH=SKETCH1

VBEval>SW_CHANGEVALUE(%VALUE%,"%DIMENSION%","%SKETCH%"),RESULT_CHANGEVALUE

SRT>LOAD_FUNCTIONS
  VBSTART
    Function SW_CHANGEVALUE(VALUE,DIMENSION,SKETCH)
    CreateObject("SldWorks.Application").ActiveDoc.Parameter(DIMENSION + "@" + SKETCH).SystemValue = VALUE
    End Function
  VBEND
END>LOAD_FUNCTIONS
The code above is just a simple example that shows the strength of using the API. Only a single line of code will update the dimension value. If we could help each other we could build much more examples like this.

Hope to hear from more CAD junkies.. and other API interested ppl. :)
Let>ME=%Script%

Running: 15.0.27
version history

User avatar
Grovkillen
Automation Wizard
Posts: 1132
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Post by Grovkillen » Mon Oct 28, 2013 8:26 am

Not much happened here but on my side of the screen a ton has happened. If you're interested I have made a playlist on YouTube where you can see my Console App this far.

YouTube playlist>>

PS. you need to watch full screen with HD resolution!
PS2. the pdf file with 3D graphics was not run through MS but Excel instead... I have not found a way of doing this with MS, yet.
Let>ME=%Script%

Running: 15.0.27
version history

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts