Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Configuration management

Status
Not open for further replies.

macPT

Mechanical
Oct 22, 2002
607
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
 
Replies continue below

Recommended for you

I use one configuration ("Default") per file (part and assembly).

Alex
 
Here, some engineers will do "what if" (min,max,nom) configs during design. They will name the configs min,max or nom. The nom will usually be the default config unless it is special. When time to send to designers/drafters, they will "strip" the configs or leave them, as long it is clear that the dwgs will be created based on the nom. Either way, the SW files are fixed before the dwgs are created. The engineers will also check-in their files into PDMWorks as "development" then moved to "transferred". Then D/D will take over for final release.

Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP2.0 / PDMWorks 05
ctopher's home site
 
I normally leave all the developement configurations in the assembly and add a brief message to the comments box under the configurations properties, "layout use only" for example. We also leave them in there to show difference between them, fwd and rev positions for example. Also a lot of my drawings have alternate position views so we need to keep multiple configurations.

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
 
My comments to your posts:

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
 
macPT, I know. Normally the default config IS created at nominal. All models are used at nom, as they should be.
Thanks for your feedback.

Chris
Sr. Mechanical Designer, CAD
SolidWorks 05 SP2.0 / PDMWorks 05
ctopher's home site

FAQ559-1100
FAQ559-716
 
This macro does not delete unused configs, but it saves all configurations of a part/assembly into its own part/assembly (depending if you are using it on a part or assembly).

"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
 
Hi, macPT:

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor