Adding quantity and thickness to the name while saving the file

Library for macros
User avatar
Ömür Tokman
Posts: 336
Joined: Sat Mar 13, 2021 3:49 am
Answers: 1
Location: İstanbul-Türkiye
x 953
x 324

Adding quantity and thickness to the name while saving the file

Unread post by Ömür Tokman »

Hello there,
The macro below is @artem's
This macro saves the sheet metal products in the assembly flat in a folder.
I want to add sheet thickness and quantity to the file name you saved, I've been trying for about 4 days, but I still couldn't get a result.
the quantity and thickness I want to add is in summary information/Custom.

Is there anyone who can help me with this?

For example
The result you want = Part1-1mmDKP-1 Piece
--Const OUT_NAME_TEMPLATE As String = "DXFs\<_FileName_>_<_Thickness_>_<_AutoQty_>.dxf"---
2021-07-05_13-18-07.png
https://www.codestack.net/solidworks-ap ... -patterns/
2021-07-05_12-40-59.png
2021-07-05_12-40-59.png (13.77 KiB) Viewed 3619 times
Sac-icin-montajdan-dısari-dxf-ver - AT - 003.swp
(115.5 KiB) Downloaded 126 times
by Jaylin Hochstetler » Mon Jul 05, 2021 7:49 am
You have to put "$PRP:" before a the custom property you want in the file name.
You also have to enter the address of the folder such as "C:\New folder\DXFs". You had entered "D:" but you have to enter "D:\DXFs". "DXFs" is the folder the macro creates.

Code: Select all

Const OUT_NAME_TEMPLATE As String = "C:\New folder<_FileName_>_<$PRP:AutoQty>_<$PRP:Thickness.dxf"
Attached is the macro you posted revised with the custom properties. I also attached my version of it which includes options to give the folder a different name, export with or without sketches (which would be for etching), export with or without bend lines, and enter a different location for the folder either via browsing or entering the address.
Go to full post
You ˹alone˺ we worship and You ˹alone˺ we ask for help.
User avatar
Jaylin Hochstetler
Posts: 383
Joined: Sat Mar 13, 2021 8:47 pm
Answers: 4
Location: Michigan
x 375
x 353
Contact:

Re: Adding quantity and thickness to the name while saving the file

Unread post by Jaylin Hochstetler »

You have to put "$PRP:" before a the custom property you want in the file name.
You also have to enter the address of the folder such as "C:\New folder\DXFs". You had entered "D:" but you have to enter "D:\DXFs". "DXFs" is the folder the macro creates.

Code: Select all

Const OUT_NAME_TEMPLATE As String = "C:\New folder<_FileName_>_<$PRP:AutoQty>_<$PRP:Thickness.dxf"
Attached is the macro you posted revised with the custom properties. I also attached my version of it which includes options to give the folder a different name, export with or without sketches (which would be for etching), export with or without bend lines, and enter a different location for the folder either via browsing or entering the address.
Attachments
Sac-icin-montajdan-dısari-dxf-ver - AT - 003.swp
(132 KiB) Downloaded 179 times
Omur DXF Export.swp
(165 KiB) Downloaded 200 times
A goal is only a wish until backed by a plan.
User avatar
Ömür Tokman
Posts: 336
Joined: Sat Mar 13, 2021 3:49 am
Answers: 1
Location: İstanbul-Türkiye
x 953
x 324

Re: Adding quantity and thickness to the name while saving the file

Unread post by Ömür Tokman »

Jaylin Hochstetler wrote: Mon Jul 05, 2021 7:49 am You have to put "$PRP:" before a the custom property you want in the file name.
You also have to enter the address of the folder such as "C:\New folder\DXFs". You had entered "D:" but you have to enter "D:\DXFs". "DXFs" is the folder the macro creates.

Code: Select all

Const OUT_NAME_TEMPLATE As String = "C:\New folder<_FileName_>_<$PRP:AutoQty>_<$PRP:Thickness.dxf"
Attached is the macro you posted revised with the custom properties. I also attached my version of it which includes options to give the folder a different name, export with or without sketches (which would be for etching), export with or without bend lines, and enter a different location for the folder either via browsing or entering the address.
Hi Jaylin,
Thank you so so much, both work perfectly! ><
And thank you for teaching me how.
You ˹alone˺ we worship and You ˹alone˺ we ask for help.
DLZ_SWX_User
Posts: 26
Joined: Mon Dec 20, 2021 1:40 pm
Answers: 0
Location: Michigan, USA
x 112
x 11

Re: Adding quantity and thickness to the name while saving the file

Unread post by DLZ_SWX_User »

We have been using this Macro from @artem 's also. It works very well.

We have modified it to give us the quantity of parts needed of a particular DXF, if a multi bodied part has a linear pattern or a mirror image, by using the following:

Const OUT_NAME_TEMPLATE As String = "<$CLPRP:Sheet Metal Thickness> <_FileName_> <$CLPRP:QUANTITY> <_FeatureName_> .dxf"

My question is can we somehow do the same from an assembly? Currently if I have a table with 4 legs, either 4 of the same inserted into the assembly or using linear pattern it will only tell me "1" in the file name not 4. If I create this same table as a multi body part it will tell me "4" in the file name not "1" which is what I would like for it to do in assemblies.

I have tried to use what was stated above could not get it to do what I wanted.
artem
Posts: 26
Joined: Thu Mar 18, 2021 1:31 pm
Answers: 3
x 9
x 73

Re: Adding quantity and thickness to the name while saving the file

Unread post by artem »

@DLZ_SWX_User, I have just published this new macro yesterday which addresses this issue:
Thanks,
Artem
xarial.com - making your CAD better
codestack.net - SOLIDWORKS API macros and tutorials
User avatar
Jaylin Hochstetler
Posts: 383
Joined: Sat Mar 13, 2021 8:47 pm
Answers: 4
Location: Michigan
x 375
x 353
Contact:

Re: Adding quantity and thickness to the name while saving the file

Unread post by Jaylin Hochstetler »

artem wrote: Tue Dec 21, 2021 12:44 am @DLZ_SWX_User, I have just published this new macro yesterday which addresses this issue:
Thanks, Artem!
A goal is only a wish until backed by a plan.
Post Reply