This is one of the macro written by Deepak Gupta to save the part file as DXF/DWG
Give it a try!
I think that was one of the ones I have already tried to make work. I will try again
What I need is to export directly from the current view of a part file to a single DXF or DWG with the same name, in the same location.
I tried myself on a part file and it's working
I modified the code to save in the same folder with configuration name and view
You will get the view as it is on the screen.
Try this modified one
Which version of SW you use. (you may want to change the reference)
Thanks John for finding this macro.
Ben here is modified and simplified macro to work on current active part configuration.
P.S. Please use the fixed macro from this post: https://forum.solidworks.com/message/436713#436713
Deepak, That works great. I realy don't know what I was doing wrong
Thanks for the help Guys
I admit I am fairly new to all this, but this thread is exactly what I need to help produce a batch of files from my part file(s), to then send to a graphic designer to use as the basis for artwork.
I have downloaded these macros to try and batch process the task but have had a strange result. I would like to run the macro to save the DWG of the part model, viewed from a sort of 'reverse isometric' (think of it as being viewed slightly from the left, rather than the right hand side).
For some reason all the exported files of the models come out 'tilited' as if the model has been rotated by about 30 degress to lean over to the right rather then with any vertical lines.
Please could you offer an explanation.
I am running Windows 7 with SW2014 SP3.0 64 bit.
Welcome to SOLIDWORKS forums Tom.
The macro will save the current view in which the model was saved last. Can you post an example of how you want the view orientation to be??
Please use "advanced editor" in case you want to attach any files. Click on reply and then click on "Use advanced editor". Scroll down to see the option to attach file. ".
You might also find this post helpful for your future reference.
If you save/set the views as isometric, then what is you resultant view in DWG file.
Also which one of the macro you're using??
Here is the fixed macro. The co-ordinates were rotating by 90° which has been fixed.
Sorry, but I am trying to export a DWG of each configuration, this only seems to save the current view & configuration only.
The macro I have been trying is 'Export Part Configurations as DWG' and 'Export Part Configurations as DWG-Mod'
Apologies for any confusion
Great! Thanks for your help!
I tried changing the macro to save the part model as DXF.
But the error occur in this code.
swPart.ExportToDXF sPathName & "dxf", swModel.GetPathName, 3, False, varAlignment, False, False, 0, varViews
And I want to remove the work "current view" when saving the file to DXF.
Thanks helps a lot.
When the part is export to DXF the file contains the work "Current"
How can I remove the word "Current" in the filename.
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
sModelName = swModel.GetPathName
sPathName = swModel.GetPathName
vConfNameArr = swModel.GetConfigurationNames
For i = 0 To UBound(vConfNameArr)
sConfigName = vConfNameArr(i)
bRebuild = swModel.ForceRebuild3(False)
sPathName = Left(swModel.GetPathName, Len(swModel.GetPathName) - 7)
sPathName = sPathName & ".dxf"
Debug.Print "" & sPathName
Set swPart = swModel
dataAlignment(0) = 0#
dataAlignment(1) = 0#
dataAlignment(2) = 0#
dataAlignment(3) = 0#
dataAlignment(4) = 0#
dataAlignment(5) = 0#
dataAlignment(6) = 0#
dataAlignment(7) = 0#
dataAlignment(8) = 0#
dataAlignment(9) = 0#
dataAlignment(10) = 0#
dataAlignment(11) = 0#
varAlignment = dataAlignment
dataViews(0) = "*Current"
varViews = dataViews
swPart.ExportToDWG sPathName, sModelName, 3, False, varAlignment, False, False, 0, varViews
I managed to remove the word "current" in the file name.
Thanks a lot
Sorry for the delay, had been really busy. Glad you found the answer.
For anyone else looking for the answer, set data view to nothing ("") like shown below:
dataViews(0) = ""