×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

(OP)
Good day all,
Upon review of the archived subjects I ran across this thread regarding bulk renaming of SolidWorks parts, assy's & drawings.
By chance does anyone know if there has been more progress in this area? This is an area of GREAT interest for not only myself but my empoyer as well.
I would be very greatful if someone could enlighten me on this matter.
BTW, yes we use SWX Explorer & yes we us PDMWx.
We desperatly need the files renamed prior to being deposited into PDMWx. Hence my request for illumination in this area.
We have on the extreme, machine layouts of 5000+ parts, but average around 1500.

Thanks ahead of time for pondering this,
Regards,
rdeand

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

You don’t happen to have the revision number/letter with-in the file name do you?

This is what we have. Never, since I've worked, have I seen a company do this….but we do. We've talked to companies about PDM/PLM's and they are always puzzled as to why we do this. If we do go to a document management software, I'm afraid we'll also have to rename our 45,000 files. I'd like come across a utility that will remove anything after the initial p/n (example - 123456<remove>R02<remove>.sldprt)

And sorry I didn't have a solution for you readnd. But I posted to show additional interest in this issue

Adam
Solidworks 2005 SP01.1
Windows 2000

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

I do not know of any way to bulk rename. If you want them renamed BEFORE they go into PDMW, you need to do it within SW Expl, one at a time. It will update any references the file is used in. I had to do this several years ago. We assigned one person full time to do it and one part time to help out. We had about the same qty as you and it took them a few weeks.
Now, I would create a folder in PDMW to check in all the files. Name the folder so you know they are old files. Rename as you go and change folders as they are renamed.

Chris
Systems Analyst, I.S.
SolidWorks Pro 06/PDMWorks 06
AutoCAD 06
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

(OP)
I believe I can clarify more. The only change/rename we wish to do is the following.
As an example we would receive a machine layout with all parts, assy's & drw's assigned unique 7-digit part numbers.
Our hope would be to add as a prefix our own in-house 4-digit project i.e.: 5678_(original p/n here).
Honestly using PDMWorks has greatly helped with regards to revision and design history tracking. Would be happy to pass along what we had to overcome with pitfalls and success' at length if you like.
Let me know if you are interested and we can converse directly and then post our tale here.

rdeand

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

Try this on for size...please note, the follow is air code pulled from a function I use to save project step files. Undoubtedly there is some work/testing required!

Sub TraverseComponent(swComp As SldWorks.Component2, strFPath as String, strPfx as String)
Dim vChildComp As Variant
Dim swChildComp As SldWorks.Component2
Dim swCompConfig As SldWorks.Configuration
Dim i As Long
vChildComp = swComp.GetChildren
If UBound(vChildComp) >= 0 Then   
   For i = 0 To UBound(vChildComp)
      Set swChildComp = vChildComp(i)
      If swChildComp.IsSuppressed() = False Then

         Set ModDoc = swChildComp.GetModelDoc()
     PrtName = ModDoc.GetPathName
         ShortName = Left(PrtName, Len(PrtName) - 7)
         
     If ModDoc.GetType = swDocPART Then
        ModDoc.SaveAs2 strFpath & strPfx & Shortname & ".SLDPRT", 0, True, False
        swApp.CloseDoc (strFpath & strPfx & Shortname & ".SLDPRT")
     End If

     If ModDoc.GetType = swDocAEESMBLY Then
        ModDoc.SaveAs2 strFpath & strPfx & Shortname & ".SLDASM", 0, True, False
        swApp.CloseDoc (strFpath & strPfx & Shortname & ".SLDASM")
     End If

     TraverseComponent(swChildComp, strFPath, strPfx)
      End If
   Next i
End If
End Sub

Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swAssy As SldWorks.AssemblyDoc
Dim swConf As SldWorks.Configuration
Dim swRootComp As SldWorks.Component2
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
If swModel Is Nothing Then
   MsgBox "No model loaded."
Else
   If swModel.GetType = swDocASSEMBLY Then
      Set swConf = swModel.GetActiveConfiguration
      Set swRootComp = swConf.GetRootComponent
      PrtName = swModel.GetPathName
      ShortName = Left(PrtName, Len(PrtName) - 7)
      MessageIn = "Enter full path i.e. C:\Temp\ <- DON'T FORGET LAST BACKSLASH"
      TitleIn = "Path to save Solidworks Files"
      DefaultIn = "C:\Temp\"
      strFpath = InputBox(MessageIn, TitleIn, DefaultIn)
      MessagePfx = "Enter Prefix to add"
      TitlePfx = "Prefix to add to Files"
      DefaultPfx = "XXXX-"
      strPfx = InputBox(MessagePfx, TitlePfx, DefaultPfx)
      nRet = TraverseComponent(swRootComp, strFPath, strPfx)
      swModel.SaveAs2 strFpath & strPfx & Shortname & ".SLDASM", 0, True, False
      swApp.CloseDoc (strFpath & strPfx & Shortname & ".SLDASM")
  Else
     MsgBox "Active file is not an assembly."
  End If
End If
End Sub

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

Have you tried using SW Explorer to make a copy of the top level assy? You will be given the choice of copying all the "child" components and of adding a prefix or suffix to all the existing file names.

cheers
Helpful SW websites  FAQ559-520
How to get answers to your SW questions  FAQ559-1091

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

(OP)
Yes we have, and do use SWx Explorer extensively for just this purpose. The huge shortcoming with SWx Explorer is that it is oblivious to the slddrw's that that are and should be copied with the top assy and all its related sub's and part files.
Good suggestion though,
TY CorB

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

Whenever we use SW Explorer, we open the drawing, not the assembly.  By doing this, in addition to using "Find References", any renaming is tied to the drawing also.  But we use 1 drawing for the top-level assembly, sub-assemblies, and parts.  If you use 1 drawing for each part, it "might" miss some drawings.

Flores
SW06 SP4.1

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

Open part in SW Exp, right-click on file name, run where used. It will find all dwgs and assy's used on.

Chris
Systems Analyst, I.S.
SolidWorks Pro 06/PDMWorks 06
AutoCAD 06
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

I do similar to smcadman ... One drawing set (multi-sheet) for assemblies, another drawing set for parts.

cheers
Helpful SW websites  FAQ559-520
How to get answers to your SW questions  FAQ559-1091

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

Quote:

Open part in SW Exp, right-click on file name, run where used. It will find all dwgs and assy's used on.
I have to throw in another variable; this also depends on your SW Explorer rename document "Search Rules":  
  • Search Subfolders
  • Look for assemblies and drawings
  • Look for derived/mirrored parts
  • Look for models defined in this assembly
Flores
SW06 SP4.1




RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

CBL

Could you not use CopyProject to copy and rename the files?  There is a option in CopyProject to rename files when you copy a project.  It will change a file name to something different.  Just a thought.

Cheers,

Ralph Wright, CSWP
SolidWorks 2005, SP5.0
P4, 2.53Ghz
1.5 Gb RAM
ATI Fire GL8800 Card
Windows 2000 Pro

RE: thread559-133945 - Macro to rename ass, sub-ass, parts, drawings... of

cadman1997 ...

I don't know ... unfortunately, I don't have PDMWorks & have never had the chance to use it. sad

cheers
Helpful SW websites  FAQ559-520
How to get answers to your SW questions  FAQ559-1091

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources