Macro to transform en masse. SLDPRT of sheet metal in unfolded in . DWG or . DXF

Hello everyone,

After a long search on the net, I can't find the macro I need. If you could do that to me, that would be great.

I'm looking for a macro to transform all the . SLDPRT of sheet metal as well as all the configuration that could be in each file, located in a folder, flat (unfolded state) in . DWG or and . DXF.

I found a macro that flattens me, but only the file opened in SW.

I would like it to open a window when I launch the macro where I can choose the source folder and the record folder.

I found a macro to save my SW plans in .PDF (which I use a lot and works very well and where I have options for recording.

I'm joining you it's 2 macros, if they can help you better understand what I want.

I'm on SW2018 R0.3

I don't know anything about coding:(

Thank you

Michael.

 

 


macro.rar
1 Like

Hello

Is it specific on order now?

"I don't know if it's coming from me but I can't extract the files from your archive file.": Note that is no longer valid, it comes from the PC I was on, it works better on another PC...

Kind regards

Hello

From what I understand you want:

- Select the source folder of the parts files when the macro is launched.

- Select the destination folder of the DWG and DXF  when the macro is launched.

- Analyze the source folder to identify all the 3D parts files.

- Automatically open each item in the source folder in Solidworks.

- automatically create the unfolded version of each part for each configuration of the room.

- Create a DWG and DXF of these unfolded.

- Store these DWGs and DXFs in the destination folder.

- Close the 3D part.

so, in order, you can use the FolderBrowserDialog, GetFile, OpenDoc, GetConfigurationNames, ExportFlatPatternView, SaveAs3 , and CloseDoc functions.

This gives a functioning that can resemble the attached program, which is done in C# on the fly without any security check. I have voluntarily limited its operation in time because it is not secure and very little tested (on SW2017 on 3 files), the deadline is 31/08/2018, which should give you time to do some tests, on copies of files of course even if I don't modify the original files and I don't save them.

To unzip in a folder on the desktop and then launch the executable, Solidworks must be started first.

If the way it works suits you, I could later guide you in the complete writing of your macro but this can only be done from the end of September, and yes, it will be my turn to go on vacation:)

Kind regards


export_dwg-dxf.zip
3 Likes

Hello d.roger,

1- Thank you for your feedback.

2- Yes, that's what I would like to have:

     - Select the source folder of the parts files when the macro is launched.

    - Select the destination folder of the DWG and DXF  when the macro is launched.

    - Analyze the source folder to identify all the 3D parts files.

   - Automatically open each item in the source folder in Solidworks.

   - automatically create the unfolded version of each part for each configuration of the room.

   - Create a DWG and DXF of these unfolded.

   - Store these DWGs and DXFs in the destination folder.

   - Close the 3D part.

 

I DL the Zip file saved on the desktop and unzip.

I unstart my SW and there when I launch the .exe file I receive the following error message: See . jpg attached.

Do you have a solution?

Michael

 

 

 

 


error_v.jpg

Hello

On the exe file, you right-click / properties and then at the bottom of the window, you click on "Unblock".

If your anti-virus blocks you from launching the program, you have to authorize it in your anti-virus (of course if you trust otherwise, well that's too bad).

Kind regards

1 Like

Hello

I turned off the anti virus

I didn't unblock in the properties, I went to Properties/ Compatibility, and I clicked: Start the compatibility problem resolution. There he asked me to go to Admin, I entered the codes to go under Admin and he started, I chose the source and the destination, but in admin I don't have access to all the servers or folders, so I made a copy of my files in a folder to put on the Admin desktop. and started the processing it transforms a file into DXF but doesn't put the exact name, then new error window, see attached file of the message below.

Bav.

Michael

 


erreur.txt

Hello

Sadden

I modified to no longer start under Admin and it works well as a user. :)

I did a test again and there more error messages, all of them went well little even more than I wanted;) See jpg attached.

I still have to try with files with several configurations.

Already a big THANK YOU.

I'll be back as soon as possible for new feedback.

Thank you, thank you, thank you

Yours truly.

Michael

 

 


tranformation_part-dwg_dxf.jpg

Hello

This also works for files with multiple configurations:)

On the other hand the scale is not good it takes out the Flat Out at 5:1 :(  So for 100mm I have 500mm

Is it possible to remedy this?

Beats.

Michael

Hello

Try with the processing type 2 button of the attached program.

Kind regards


export-tole-dwg-dxf.zip

Hello

It's ok with the "type2 processing" button Flat 1:1 :)

For me that's very good. Even more :)

suggestion:

Do you think it would be possible to have a menu to choose if you want? DWG and or . DXF

As well as an address window to paste the location of the source folder and one to paste the location of the record folder, rather than having to browse through the folders.

If you think of modifying the Macro for the 2 suggestions and or to remove the type 1 treatment (when you have time of course, even after your vacation which I wish you very good) keep me informed to see if I put your last answer as a better answer now or if I wait for you to modify it.

In advance a big THANK YOU again

Yours truly.

Michael

Hello

The final version will come shortly if no more changes...

Kind regards

Hello

Here is the final version of the program with suggestions for modifications, it is still possible to choose the folders by clicking on the texts "source folder" and "destination folder" but it is also possible to copy/paste directly the folder paths in the appropriate text boxes, the choice of the output format(s) is done by checking or unchecking the appropriate boxes.

To be unzipped in any folder but the 2 files contained in the zip must be in the same folder. It is best to launch Solidworks before this program is launched.

The expiration date of 31/08/2018 has been removed. Please note that it is necessary to have at least the 2017 version of Solidworks.

Use at the user's own risk...

No warranty and post-donation service...

It's written in C# but it's possible to have information on the code used on simple request but only from the end of September...

Kind regards


export-tole-dwg-dxf.zip
1 Like

Hello

Once again, thank you very much for your help. Everything works very well.

It will save me a lot of time

Yours sincerely

Michael

Hello

I would like to thank d.roger for this little program. I've been looking for a small utility to lighten my weekly chore of preparing for laser cutting for a long time. 

Is it possible to automatically export the DXF with a red "DIMENSION" layer on which the sidewall capable of sheet metal appears?

For information, my DXF before sending to the subcontractor, looks like this:

 

Thank you in advance!

I have transformed more than 2000 files into . DXF and all of a sudden error what happens.

Hello;
It would have been preferable to develop the "Detail" of the error report but it basically says that it did not succeed in opening the document to be processed:
Either it is in error (Solidworks).
Either it has been moved or renamed.

Does this error still appear on a specific file?
Is it permanent?
Random?
Does the file to be processed have any particularities (non-unfoldable folds, overlaps?)
and finally, which version of Solidworks are you using?

Kind regards.

Note, digging up a Resolved discussion from 4 years ago is not necessarily the right method to get answers.
On the other hand, it allows us to have a glimpse of the admirable work "as often" of @d. roger

1 Like

Hello, I'm sorry to have dug up an old discussion, but it's the only small program we have found to transform SolidWorks files en masse.

the version of SolidWorks is 2022.

The problem is that you can't modify the program since only @d.roger has the source code.
And as @d.roger doesn't come here often lately, not sure you'll get an answer.

On the other hand, Visiativ MyCadtools software can also meet the demand.
BatchConverter and Integration can meet this demand.
To finish probably one or more parts that are causing problems, try to identify it (by elimination or other method) and then try to understand why (not a sheet metal work...)

Hello.
I just tested on 22 and the program launches but doesn't do the job, changed the dll, and presto, same mistake as yours,
To sum up, it doesn't support the
Solution, recompile with the new dlls, but you have to have the source code.:grin:

1 Like

Hello
I am now on SW22 and I can use this program without having made any changes to it. However, I can reproduce the error if I don't launch SW before using this program, so I would tend to say that we should replace the sentence "It is better to launch Solidworks before launching this program." with "It is imperative to launch Solidworks before launching this program."
Kind regards

3 Likes