Configuration management
Configuration management
(OP)
Hi all!
During design, it is common to create parts/assemblies with several configurations in order to easely make "what if" scenarios and find the best solution.
The problem is that, in the end of the design, when preparing documents for production, there's the need to clean all extra data in parts/assemblies. That means get rid of all extra configurations created not belonging to the final solution.
That's not an easy task and it's time consuming. I've already thought in creating a macro to list all unused configurations of each part/assembly in a folder (the ideal solution would be a macro to test each config and delete it if not used in any doc of that folder).
How do you do with your designs? Have you other ideas?
Thanks
During design, it is common to create parts/assemblies with several configurations in order to easely make "what if" scenarios and find the best solution.
The problem is that, in the end of the design, when preparing documents for production, there's the need to clean all extra data in parts/assemblies. That means get rid of all extra configurations created not belonging to the final solution.
That's not an easy task and it's time consuming. I've already thought in creating a macro to list all unused configurations of each part/assembly in a folder (the ideal solution would be a macro to test each config and delete it if not used in any doc of that folder).
How do you do with your designs? Have you other ideas?
Thanks






RE: Configuration management
Alex
RE: Configuration management
Making the best use of this Forum. FAQ559-716
How to get answers to your SW questions. FAQ559-1091
Helpful SW websites every user should be aware of. FAQ559-520
RE: Configuration management
Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP2.0 / PDMWorks 05
ctopher's home site
RE: Configuration management
I figure it doesn't hurt to keep all the other configurations in there. But that is just me. I don't like deleting stuff. There have been more than a few times when something that I previously deleted needed to be re-done.
I figure as long as there are no mating errors in the configurations and there is a brief description as to what it was created for, it can stay. One thing that I think is really helpful when there are multiple configurations is to specify which one of them is use on the drawing ("used for dwg") in case someone else starts deleting configurations they will at least keep the one the the drawing is dependant on. Of course that is assuming that they take the time to read the configuration properties at all.
Regards,
Dan Olid
RE: Configuration management
Alex - can't be straighter than that! But I think it's not an option: too many files to create, too much trouble creating similar parts and managing what if scenarios
CBL - I'll check this macro and if it helps
Chris - sometimes it's not that simple as min, max and nom. The default config is not always the final config (the one to use)
Dan - we always save all development files for reference. So the original information is never deleted. But we have one folder for all production drawings (they are "published" here). There are 2 requirements for these files: space (they must be striped down to minimize filesize); quality assurance (all extra information must be deleted in order to avoid confusion and errors). Normaly config names are meaninful but extra information must be deleted.
Regards
RE: Configuration management
Thanks for your feedback.
Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP2.0 / PDMWorks 05
ctopher's home site
FAQ559-1100
FAQ559-716
RE: Configuration management
"Saveconfigurations" macro:
CODE
'Saves each configuration of a SolidWorks Part file to a separate file with
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim ModelDoc As SldWorks.ModelDoc2
Dim ModelDocCopy As SldWorks.ModelDoc2
Dim strNewFileName As String
Dim ConfigNames As Variant
Dim strActiveConfig As String
Dim nCount As Long
Dim nCountCopy As Long
Dim RetVal As Long
Sub Main()
Set swApp = Application.SldWorks
Set ModelDoc = swApp.ActiveDoc
If Not ModelDoc Is Nothing Then
If ModelDoc.GetType = 3 Then 'document is a drawing, exit sub
MsgBox "Active document is not a SolidWorks part or assembly!", vbInformation
Exit Sub
End If
If ModelDoc.GetPathName = "" Then 'model not saved
MsgBox "Please save the model!", vbInformation
Exit Sub
End If
'Get all the configurations names into an array
ConfigNames = ModelDoc.GetConfigurationNames
'Get the active configuration so we can switch back to it when finished
strActiveConfig = ModelDoc.GetActiveConfiguration.Name
For nCount = 0 To UBound(ConfigNames)
'Activate the configuration
ModelDoc.ShowConfiguration2 ConfigNames(nCount)
'Create a filename for the Save as copy
strNewFileName = CreateNewFileName(ModelDoc.GetPathName, ConfigNames(nCount))
'Debug.Print strNewFileName
'Save a copy of the file
RetVal = ModelDoc.SaveAsSilent(strNewFileName, True)
'Open the new file with the Correct Configuration
Set ModelDocCopy = swApp.OpenModelConfiguration(strNewFileName, ConfigNames(nCount))
For nCountCopy = 0 To UBound(ConfigNames)
If ConfigNames(nCountCopy) <> ConfigNames(nCount) Then
'Delete each configuration except the one that is the active one
ModelDocCopy.DeleteConfiguration2 (ConfigNames(nCountCopy))
End If
Next
'Save and close the modelcopy
ModelDocCopy.SaveSilent
swApp.CloseDoc ModelDocCopy.GetPathName
Set ModelDocCopy = Nothing
Next
'Show the configuration that was active when we before we started
ModelDoc.ShowConfiguration2 strActiveConfig
MsgBox "Finished!", vbInformation
End If
Set ModelDoc = Nothing
Set ModelDocCopy = Nothing
Set swApp = Nothing
End Sub
Function CreateNewFileName(strFileName As String, ByVal strCfgName As String) As String
Dim objFS As Scripting.FileSystemObject
Dim strBaseName As String
Dim strExt As String
Dim strPath As String
Dim strNewFileName
Set objFS = CreateObject("Scripting.FileSystemObject")
strBaseName = objFS.GetBaseName(strFileName)
strExt = objFS.GetExtensionName(strFileName)
strPath = objFS.GetParentFolderName(strFileName)
'Add the config name to the base name
strBaseName = strBaseName & " (" & strCfgName & ")"
'add the extension
strNewFileName = strBaseName & "." & strExt
'Clean the filename to remove any invalid chars
strNewFileName = CleanFileName(strNewFileName)
'Build the full path
strNewFileName = objFS.BuildPath(strPath, strNewFileName)
'Return the new filename including the full path
CreateNewFileName = strNewFileName
Set objFS = Nothing
End Function
Function CleanFileName(ByVal strFileName As String) As String
Dim InvalidChars As Variant
Dim x As Integer
'Create array of invalid filename chars
InvalidChars = Array("/", "\", "*", "?", "''", "<", ">", "|")
'Loop through the array and replace each instance of the invalid chars of the string
For x = 0 To UBound(InvalidChars)
strFileName = Replace(strFileName, InvalidChars(x), Space(1), , , vbTextCompare)
Next
'Return the filename cleaned and trimmed
CleanFileName = Trim(strFileName)
End Function
I do not remember which site I got this one from, so I cannot give them proper credit
Flores
RE: Configuration management
http://www.cadimensions.com/macros.htm
Flores
RE: Configuration management
You may want to think twice about using one configuration ("Default") per file (part and assembly) method. There are a lot of theories (database) behind this. Part or assembly objects designed this way do not tangle each other. It is more efficient to create documents and revise them.
Every person in this country has a social security number, and no one complains about that.
Alex