Results 1 to 3 of 3

Thread: Using SolidWorks Macros and the API

  1. #1
    Registered
    Join Date
    Jul 2009
    Location
    United States
    Posts
    10
    Downloads
    0
    Uploads
    0

    Using SolidWorks Macros and the API

    I am in need of a macro for exporting a BOM (either SolidWorks or Excel based, my company is currently editing multiple templates) from a Solidworks drawing into an excel file. My project is to create a master parts list by compiling BOMs into an excel file and using the Subtotal function in excel to total the individual parts. Because this would be a very specialized macro, what I am first looking for is some help on finding some basics on using and understanding the SoliWorks API. I have some programming background (MATLAB and some basics in C++) but feel I need to put more time into understanding the syntax before I try to build this macro and ultimately come here for support. So, if anyone knows of any good tutorials or anything like that, please let me know. I would use the SolidWorks customer portal, but my boss does not have a full subscription to the support, so most of the sections are locked. As of now, I have really only been able to find information out of the API help in Solidworks, which is great if you're looking for help on a specific function but a little more difficult for processes. Thanks in advance for any help.


  2. #2
    Registered
    Join Date
    Jul 2009
    Location
    United States
    Posts
    10
    Downloads
    0
    Uploads
    0
    Status Update
    So I have done some reading and began construction of my macro. As of now, I have accomplished the following

    - Open specified drawing file
    - Activate Sheet with BOM
    - Activate the BOM
    - Find the column headers "PART NO." and "QTY." and their corresponding column numbers
    - Find the last row that contains data
    - Store the data in those two columns in an array
    - Created a text file to store the values in the array

    Entire code is attached.

    I now need to put the array values into the created text file, but I am not exactly sure how. Can anyone help me with this?

    I know this is not necessarily a forum for asking coding type questions, so please let me know if there is a more appropriate forum to seek help on my visual basic needs.

    Thanks
    Attached Files Attached Files


  3. #3
    Registered
    Join Date
    Oct 2007
    Location
    United Kingdom
    Posts
    442
    Downloads
    0
    Uploads
    0
    The SolidWorks user portal has a dedicated forum for Macro & API which I have found most helpful. Also, there is a book by Mike Spens that I found useful; sorry, can't remember the title and my copy is at home.

    SolidWorks has good help pages regarding the API and a lot of example code that I found instructive.

    For what you want with writing a text file, you might find scripting useful as this controls the "FileSystemObject" in Windows and it is this that governs file creation, modification and deletion. You will find some documentation on the FSO in the Visual Basic help when you are in the VB editing environment.


Similar Threads

  1. macros
    By georgebarr in forum Mach Mill
    Replies: 1
    Last Post: 06-03-2009, 09:11 AM
  2. Need Help!- macros
    By bob@apc in forum Mazak, Mitsubishi, Mazatrol
    Replies: 2
    Last Post: 02-04-2008, 12:42 PM
  3. Help with macros
    By afterburn25 in forum Haas Mills
    Replies: 4
    Last Post: 04-09-2007, 09:19 AM
  4. Macros
    By cncfreak in forum General CAM Discussion
    Replies: 24
    Last Post: 05-06-2005, 06:04 PM
  5. macros
    By toyoda in forum General CAM Discussion
    Replies: 0
    Last Post: 05-30-2004, 05:56 AM

Posting Permissions


 


About CNCzone.com

    We are the largest and most active discussion forum from DIY CNC Machines to the Cad/Cam software to run them. The site is 100% free to join and use, so join today!

Follow us on

Facebook Dribbble RSS Feed


Search Engine Friendly URLs by vBSEO ©2011, Crawlability, Inc.