I'm trying to develop a Sheet Format for my company's SLDDRWs. I want to include the name of the folder that the assemblies, parts, and drawings are in. The problem is that the only way I know to link this property is with the SolidWorks "Folder Name" link and that gives me the whole path name. Is there any way to just get the Folder Name without all the other junk in the path file?

 

example: "T1915" instead of "G:\Zarchive\PARKER\52-204250\T1915"

 

Thanks in advance


Categories: Drawings and Detailing

Comments
Last comment By: Deepak Gupta   Tue, 17 Apr 2018 16:42:06 GMT
Re: How to disconnect path file from "Folder Name" link

Hej,

 

I do not think that is possible with the functions there is in SolidWorks.

It could easily be done with a macro and push that information to a custom property in the file. That would require that the macro is executed at some stage...

 

// Daniel

By: Daniel Andersson  Fri, 10 Oct 2014 18:49:39 GMT
Re: How to disconnect path file from "Folder Name" link

As Daniel stated, this is not possible directly. You can either do it manually by creating a property name Folder (or any name) and assigning it the value of the folder name in which part/assembly has been saved and link that to a note on the drawing. The other way would be to use a macro. The macro can be made to run automatically in the background such that when you save a drawing, the macro would update the folder name if required/changed OR you may run the macro as and when required via a keyboard shortcut/macro button etc.

 

Further if you feel that this is something SOLIDWORKS should have, then please raise an enhancement request via your customer portal account.

By: Deepak Gupta  Sat, 11 Oct 2014 13:46:55 GMT
Re: How to disconnect path file from "Folder Name" link

I don't have much experience with macros so I wouldn't know where to start. And I don't even know how to have a macro automatically run. Do you know how to do these?

By: Alexander Sandstrom  Fri, 17 Oct 2014 20:43:35 GMT
Re: How to disconnect path file from "Folder Name" link

You have to start up Solidworks with a new shortcut in order to have it automatic. Do you have the possibility and are willing to do so?

Link to information about how to set up the new shortcut: (Previous forum post, so just look at the instructions)

https://forum.solidworks.com/message/448731#448731

 

If not, then you need to press a button to make the data to update. Link to information about how to add icon:

http://help.solidworks.com/2013/English/api/sldworksapiprogguide/GettingStarted/Assign_SolidWorks_Macro_to_Button.htm

 

Either way, I can help you with the macro by beginning of next week. Just let me know in what way you want to execute the macro.

 

Deepak, feel free to post before my response if you have something before I do.

 

(See the mentioned links as reference in order to have a little more information about what is needed in order to implement the macro in different  ways. I  would also recommend that you think about how you may distrubute it to other users.)

By: Daniel Andersson  Fri, 17 Oct 2014 21:34:19 GMT
Re: How to disconnect path file from "Folder Name" link

Alex, try this macro which would add/update the custom property named "Folder Name" in the referenced model.

 

You can set the macro to run from a macro button, keyboard shortcut or Tools > Macro > Run. If you need to keep it running in the background then I can update it further.

By: Deepak Gupta  Sat, 18 Oct 2014 08:45:40 GMT
Re: How to disconnect path file from "Folder Name" link

I tried it out and it didn't seem to do anything. I tried a couple different ways or running it and I couldn't get it to work.

By: Alexander Sandstrom  Mon, 20 Oct 2014 13:19:40 GMT
Re: How to disconnect path file from "Folder Name" link

Alex make sure you've a custom property named "Folder Name" in the part/assembly file. Then on the drawing you have a note that is linked to "Folder Name" property.

 

Now when you run the macro, it would update the "Folder Name" property with the folder name.

By: Deepak Gupta  Mon, 20 Oct 2014 14:01:12 GMT
Re: How to disconnect path file from "Folder Name" link

I created a custom property under "File Properties" in the part file named "Folder Name" and then tried to run the macro in the drawing and it didn't update it. It still leaves it as the whole path name. I also tried to input a value for "Folder Name" in the "File Properties" and that didn't work either.

By: Alexander Sandstrom  Mon, 20 Oct 2014 14:16:27 GMT
Re: How to disconnect path file from "Folder Name" link

Make sure that note in the drawing is linked to Folder Name property and not SW-Folder Name(Folder Name)

By: Deepak Gupta  Mon, 20 Oct 2014 14:24:47 GMT
Re: How to disconnect path file from "Folder Name" link

Hi,

 

i would also use this kind of macro to add just the last folder name in my drawing. I am able to create the shortcut of solidworks with the macro path but what is the macro to execute? Thank you

By: Francois Boisguerin  Mon, 11 Dec 2017 08:27:10 GMT
Re: How to disconnect path file from "Folder Name" link

Is there any way you can dummy proof how to do this instruction?

 

I have created a File Folder property in my part file. (below)

 

I ran the macro but an error on line 13 came up (swDrawing =  swModel)

By: Alexander Brown  Mon, 16 Apr 2018 18:14:45 GMT
Re: How to disconnect path file from "Folder Name" link

Is there any way you can dummy proof how to do this instruction?

 

I have created a File Folder property in my part file. (below)

 

I ran the macro but an error on line 13 came up (swDrawing =  swModel)

By: Alexander Brown  Mon, 16 Apr 2018 18:53:51 GMT
Re: How to disconnect path file from "Folder Name" link

Alexander Brown wrote:

 

I ran the macro but an error on line 13 came up (swDrawing = swModel)

That error is because the macro works from drawing only. Try the attached one.

By: Deepak Gupta  Mon, 16 Apr 2018 18:55:13 GMT
Re: How to disconnect path file from "Folder Name" link

Thank you. It worked.

 

Is there a way to run automatically without a button?

By: Alexander Brown  Tue, 17 Apr 2018 13:58:04 GMT
Re: How to disconnect path file from "Folder Name" link

Yes it can be made to to work in the background and update the property. And further it can be made to start on its own when SW starts.

By: Deepak Gupta  Tue, 17 Apr 2018 16:42:06 GMT
You are not authorized to view this page No results found! Suggestions: Check spelling, try a different search, or browse topics below.