I've tried to come up with something that will do this, and I've looked at a couple routines already here, but they just don't fit.
I have no programming experience with API, so I can't figure out how to do this alone.
What I am needing is a macro, that can be automatically run within solidworks every time it's started, that will:
When I save a slddrw file, all I want is for it to automatically save the same file, in dxf format, to the same location.
Any slddrw file, any time. When I click save, boom, a dxf file is saved also.
It wouldn't have to ask about over writing, as the SW file will be the current file anyway, so saving a dxf over anything thats there would only update it also.
Anyone have any ideas where I might go to get some help with this.
The reason for it is, my production purchaser uses dxf files I create from every drawing to send to vendors. Most vendors in this senerio use the dxf files to program their burning centers to create parts for our equipment. Laser, flame, plasma, what ever...
If I get busy, and side tracked, there has been a couple instances where the dxf file was forgotten, and the updated slddrw file is not reflected in the dxf.
Thanks for any help in advance.
Dave
SolidworksApi macros
Yup that is pretty simple. But I wanted to make a suggestion first.
You can Right Click on a face of any part and Export a DXF of that part. If it is a sheetmetal part, it can export the Flat pattern.
HI Devid,
You can also use SolidWorks Task Schedular for this.
Regards,
Satish Kumar
Best I can tell, if I were to try to use task scheduler, I would have to set up a global, "export to dxf, original location, changed files only" routine.
It would be a lot easier for me to have the routine that just saves the slddrw as I go along.
I looked at the right click, export to dxf, but that seems to work only on the part file, not the slddrw.
It's the drawing file I need to export.
Having the drawing border, dimensions and all is required.
All I want to re-create is the function of clicking save-as, dxf.
But I want it to run always every time a slddrw is saved.
I wonder if this throws a glitch in the ease of how this sounds, I don't want to save as dxf for asm or prt files. Just slddrw files.
There is already available one tool that would do the task you are looking for:
http://www.sloworks.fi/shop/product.php?id_product=15
Dim swApp As Object
Dim swMod As SldWorks.ModelDoc2
Sub main()
Set swApp = Application.SldWorks
Set swMod = swApp.ActiveDoc
If swMod Is Nothing Then Exit Sub
swMod.Save
swMod.SaveAs (DXFPath(swMod.GetPathName()))
End Sub
Function DXFPath(path As String) As String
DXFPath = Left(path, InStr(1, path, ".", 1))
DXFPath = DXFPath & "dxf"
End Function
Where would I put it to test that it is in the background when solidworks starts?
Is there a special folder where it should reside or is there a way somehow to make solidworks automatically run it?
Then I will test it out.
Thanks
Start a new drawing. Right click you Command manager and Click Customize. Go to the Commands tab and click the Macro category.
Drag the little person icon up to the command manager. You will see this message window.
Fill it out like so.
Now you can click that buttom whenever you are in a drawing.
That actually works good. It takes a few steps out of doing it manually every time.
I still have to rely on the person updating drawings to click it every time.
I take it, to have it automatically do this when the drawing saves would be a little more in depth (or is it even possible?)
Or even "on exit" of a drw. Could a macro be set up to run on exit of a drw?
Your help so far is greatly appreciated.
Thanks
I could create an Add-in to "listen" for saves to drawings.
If it would work like it sounds, it would be the ticket.
I looked at a program that one of the other posts listed, and it seems to do it all also.
Looks like it does it something like what your proposing. They have the ability to save as different places, different formats and all.
I only NEED the dxf, the rest would be fluff.
How long does it take to do that?
I feel bad about having someone doing something for me without anything in return.
I don't use the forums very often, but they sure are handy when you run into people like you.
Greetings from Finland, world championships 2011 in ice hockey :-)
I also have free version that might have enough features:
64-bit http://sloworks.fi/shop/product.php?id_product=12
32-bit http://sloworks.fi/shop/product.php?id_product=11
br
Markku
www.sloworks.fi
I really really wished I'd have taken the time to ask about this a year or two ago.
This will solve a lot of problems.
That worked fantastic the first time.
I'll keep it up, and if anyone ever needs anything like this I know, I will send them your way.
Thanks very much for everyones help.
This forum thing is great!
I might have to take some classes at the local reseller to figure out how to do this wizardry.
Dave
Glad we could help. It's one of the "human features" I guess to not search better solutions right away, but struggling many years first and loosing valuable time :-)
br
Markku
www.sloworks.fi
I tried downloading and installing your SWupBB 2010 Lite 64-bit - software but I must be doing something incorrect as I do not see the executible to start the program.
Can you provide additional instruction?
Thank you,
Ed
I went through a couple different programs before I tried the SWupBB 2010.
If it installed correctly, you should have a directory in your program files for it.
There is no exacutable. You go into solidworks and add it as an ADDIN program to run within solidworks.
I don't remember if it just showed up in tthe list or if there was something else I had to do though.
Once added as an addin, it should show up in the upper menu bar. You should go to that and configure the options for what type of files, and where you want them to be saved.
I just found it. The above instructions are correct. Make sure you check the addin to run when solidworks starts every time.
It works fantastic!
Dave
Thank you David.
I had to shut down and re-start SW to see it on the Add-In pull down.
Thanks
Ed
Does this work for 2012 and how do you download it from the website???
oops, I forgot that part.
The nicest thing about it I found is you can set it to save the new dxf file where ever the original drw resides.
Don't forget one thing.
It will create a dxf or pdf or what ever, but only if the drawing already existed.
if you create a new drawing, and save it once, you will not get an additional output file.
just get into the habit of clicking save twice when you save new files. then your set.
Dave
I am currently running the 2010 version with 2011, and it works just fine. Your example, I have not tested, but I would be willing to bet it does.
go to
64-bit http://sloworks.fi/shop/product.php?id_product=12
32-bit http://sloworks.fi/shop/product.php?id_product=11
You actually have to "order it" but it was no cost.
they send you some kind of reply to download it.
Hi,
I have not tested SWupBB Lite yet with SW2012, so it's not "officially supported". But I will test it soon. Commercial version 2012 is pretty much ready, I have added couple new features.
basic installation (also applies to SWit):
logon with admin rights
disable User Access Control (may require reboot)
run setup
enable User Access Control
start SW, enable add-ins from Tools - Add-Ins
br
Markku
www.sloworks.fi
ps. if you have ideas to make SWupBB or SWit even better, please let me know!
Works on 2012 64bit. Thanks