macro sample?

Hi all,

I have a macro that I wish to expand on. I need to embed the existing code in a loop that will create a selection set of part files in a specified folder, then execute the macro on each file. I was hoping to find an existing macro sample that demonstrates parsing a folder, creating a selection set and sequentially opening each part in solidworks and executing the existing code that I have.

I've searched the solidworks site sample code and my own macros but no existing macros demonstrate this ability. If you've come across this before - I'd appreciate it!

Thanks,

Zander

Reply to
Zander
Loading thread data ...

Zander,

If you don't find your answers here or the other forums, I would suggest contacting your VAR to see if they can ID that function. If they don't know, you can put in an enhancement request to add control over folders in VB.

Matt

formatting link

Reply to
fcsuper

Zander,

This macro might help you figure out how to control folders:

formatting link
It has the ability to ID them and give control on whether they are viewable or not. Seems to me that if it can control that, it can show you how to control items within a particular folder.

Matt

formatting link

Reply to
fcsuper

For operation *not* SolidWorks specific, try looking up help for Excel VBA. There's a lot more of that out there. This should do the trick for you. "folderspec" must be the full path and filename.

Ken

Sub ShowFileList(folderspec) Dim fso, f, f1, fc, s Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(folderspec) Set fc = f.Files For Each f1 In fc Debug.Print f1.Name Next End Sub

Reply to
Tin Man

Thanks for the info everyone. The idea here is to automate the creation of flat pattern dxf files from a folder of parts (there are over 200 parts for this project) that need to be laser cut. I found the dxf export portion in the customer portal so the idea is: create a selectionset of parts in folder, then open each part one at a time, create dxf, close file and repeat. I'll let you know how it works.

Zander

Reply to
Zander

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.