The problem statement emphasizes the requirement for user-created parts to be saved using organization-generated predefined naming conventions. These naming conventions result from a combination of inputs, originating from either user-defined values or pre-established defaults. Now, let’s delve into how this can be achieved using SOLIDWORKS.
Setting up the predefined structure of code
To embark on our journey, the initial phase involves establishing a standardized structure for the code or formula that will underpin the entire process. The specifics of this structure may vary depending on the organization and the intricacy of the code. Within this procedural framework, we’ll employ a logic that comprehensively encompasses various scenarios, leaving no space unexplored. This strategic approach ensures thorough coverage throughout the process.
The part number schema will look something like this: XXX.XX.XX.X.XX
The first 3 sections are dependent on each other. Like every assembly type has already assigned to a particular department and the depending on subtypes are also assigned.
Creating the Excel sheet for the dependable
As per the data gathered from the organizational structure, we can proceed with the making of the excel sheet. We have the data in the following format.
The data can be huge but let’s use this for the first 3 parts. Save the data in the excel file. And head towards the Custom Property Tab Builder.
Creating the tabs in property tab builder
In the Custom Property Tab Builder, Let’s build the tabs and the associated values.
First open the custom property tab builder.
⦁ Assigning the Excel Data in the list Format:
Make your SolidWorks design work easier by adding a “List Group” above the “Groupbox.” This helps make things look better and keeps your project organized. First, change the properties to fit your project. Then, add your Excel file data and make sure to start from the second row, with the headers in the first row (like A2:D9). Since you have four columns of data, drag, and drop new lists into the “List Group” to match. Set up the columns in order, from the first to the last. Keep everything consistent across all configurations, so your design works well. (Click on this Icon to apply it to all configurations)
⦁ Adding remaining file properties:
The capacity can be added by simply inserting the list and filling it up with the needed capacity values, such as 1, 2, 3, or 4. Next, include a Textbox in the same group. This allows users to manually input revisions, providing flexibility and customization options for your project. With this straightforward approach, you enhance the capacity of your project and empower users to easily manage, and update revisions as needed.
After making all the changes your tab will look like the following.
Now save it to the custom property template location and open a new part.
Assigning Custom Properties Through Tab Builder
After opening of the part, Now we can open the custom properties in the task pane by selecting this icon . Now press F5 in the window and select the template we just saved.
You will see a form we just created which can be filled as per the requirements of the part file. After clicking apply, the custom properties will be applied to the file which can be viewed in the file properties. If we do all the above steps correctly. Our file properties should look something like this:
Creating the code in custom property.
Add the new property by typing “Formula” as name in the latest row. And use the expression ($PRP:”property name”) to link the custom property to the formula.
Now use the same expression again and again to link all the properties in correct order. So that the evaluated value of the property will look like the code we want. If we take look at the formula which evaluates the code we are generating will look something like this: ($PRP:”Abbrevation”$PRP:”SubType”$PRP:”Department”$PRP:”Capacity”$PRP:”Revisions”).
And the Code will be evaluated to: SHT01LR101
This is how we can generate the code we required.
Assigning the code to the file name
After successfully creating the code, add the another property which will only reflect the same code by using the expression $PRP:”Formula” and rename the property to Part Number.
Save the current opened part file to rename the file. Then run the following macro file which will rename the part file with the custom property “Part Number”
Option Explicit
Sub RenamePartBasedOnCustomProperty()
‘ Declare variables
Dim swApp As Object
Dim swModel As Object
Dim swCustPropMgr As Object
Dim swNewModel As Object
Dim propName As String
Dim propValue As String
Dim propEvaluatedValue As String
Dim newPartName As String
‘ Initialize SolidWorks
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
‘ Check if a document is open
If swModel Is Nothing Then
MsgBox “Please open a SolidWorks part document first.”, vbExclamation
Exit Sub
End If
‘ Specify the custom property to use for renaming
propName = “Part Number”
‘ Get the custom property manager
Set swCustPropMgr = swModel.Extension.CustomPropertyManager(“”)
‘ Check if the custom property exists
If Not swCustPropMgr Is Nothing Then
‘ Get the custom property value
propValue = swCustPropMgr.Get(propName)
If Not IsEmpty(propValue) Then
‘ Validate and clean the custom property value for use in a file name
propValue = CleanFileName(propValue)
‘ Get the evaluated value of the custom property
propEvaluatedValue = swModel.GetCustomInfoValue(“”, propName)
‘ Get the full path of the part using a workaround
Dim modelPath As String
modelPath = swModel.GetPathName
If modelPath = “” Then
‘ If the part is not saved, prompt user to save
MsgBox “Please save the part before renaming.”, vbExclamation
Exit Sub
End If
‘ Generate the new part name using the evaluated custom property value
newPartName = Left(modelPath, InStrRev(modelPath, “\”)) & propEvaluatedValue & “.SLDPRT” ‘ You can adjust the file extension if needed
‘ Save the part with the new name using SaveAs3
swModel.SaveAs3 newPartName, 0, 0
‘ Close the original part without saving changes
swApp.CloseDoc modelPath
‘ Open the new part to refresh the SolidWorks model
Set swNewModel = swApp.OpenDoc(newPartName, swDocPART)
‘ Set the custom property in the new part
Dim swNewCustPropMgr As Object
Set swNewCustPropMgr = swNewModel.Extension.CustomPropertyManager(“”)
swNewCustPropMgr.Set propName, propEvaluatedValue
‘ Save the new part to retain the custom property
swNewModel.Save
MsgBox “Part successfully renamed to: ” & propEvaluatedValue, vbInformation
Else
MsgBox “Custom property ‘Description’ is empty.”, vbExclamation
End If
Else
MsgBox “Custom property manager not found.”, vbExclamation
End If
End Sub
Function CleanFileName(value As String) As String
‘ Replace invalid characters in a file name with underscores
Dim invalidChars As String
Dim i As Integer
invalidChars = “\/:*?””<>|”
For i = 1 To Len(invalidChars)
value = Replace(value, Mid(invalidChars, i, 1), “_”)
Next i
CleanFileName = value
End Function
And with this your File will be renamed with the part code successfully.
Tip: You can save the part as template to save the formula in the template. Just make sure you delete the values in the custom properties and then save it as a template.
We Urge You To Call Us For Any Doubts & Clarifications That You May Have. We Are Eager to Talk To You
Call Us: +91 7406663589
pin up giris https://azerbaijancuisine.com/# pin up 360
pin up
mexican drugstore online purple pharmacy mexico price list mexican rx online
medicine in mexico pharmacies mexican pharmacy northern doctors medicine in mexico pharmacies
buying from online mexican pharmacy mexican pharmacy northern doctors best online pharmacies in mexico
mexican online pharmacies prescription drugs mexican pharmacy northern doctors mexican pharmaceuticals online
reputable mexican pharmacies online: mexican pharmacy northern doctors – mexican drugstore online
https://northern-doctors.org/# п»їbest mexican online pharmacies
https://northern-doctors.org/# mexican rx online
medicine in mexico pharmacies: mexican northern doctors – mexican border pharmacies shipping to usa
https://northern-doctors.org/# mexico drug stores pharmacies
mexico drug stores pharmacies: mexican pharmacy online – best online pharmacies in mexico
http://northern-doctors.org/# mexican pharmaceuticals online
reputable mexican pharmacies online: mexican pharmacy – mexican border pharmacies shipping to usa
mexico drug stores pharmacies mexican northern doctors buying prescription drugs in mexico
buying prescription drugs in mexico online: mexican pharmacy online – mexico pharmacies prescription drugs
https://northern-doctors.org/# mexican online pharmacies prescription drugs
buying from online mexican pharmacy: northern doctors pharmacy – mexico pharmacies prescription drugs
mexico pharmacy: best online pharmacies in mexico – buying from online mexican pharmacy
http://northern-doctors.org/# medication from mexico pharmacy
mexico drug stores pharmacies: Mexico pharmacy that ship to usa – mexican online pharmacies prescription drugs
http://northern-doctors.org/# mexico pharmacies prescription drugs
buying prescription drugs in mexico online: mexican northern doctors – mexico drug stores pharmacies
mexican rx online: northern doctors – mexican border pharmacies shipping to usa
mexican rx online mexican pharmacy online mexican mail order pharmacies
https://northern-doctors.org/# pharmacies in mexico that ship to usa
mexico pharmacies prescription drugs: northern doctors – purple pharmacy mexico price list
mexican pharmacy: mexican pharmacy – mexican border pharmacies shipping to usa
https://northern-doctors.org/# mexican mail order pharmacies
mexico pharmacies prescription drugs: mexican pharmacy northern doctors – medicine in mexico pharmacies
https://northern-doctors.org/# buying from online mexican pharmacy
mexican pharmacy: northern doctors – pharmacies in mexico that ship to usa
mexican mail order pharmacies: Mexico pharmacy that ship to usa – mexican pharmacy
https://northern-doctors.org/# п»їbest mexican online pharmacies
mexican mail order pharmacies Mexico pharmacy that ship to usa mexico pharmacies prescription drugs
mexican rx online: northern doctors – mexican mail order pharmacies
http://cmqpharma.com/# mexican mail order pharmacies
buying prescription drugs in mexico online
mexican pharmacy online mexican pharmacy buying prescription drugs in mexico online
mexican mail order pharmacies cmq mexican pharmacy online medicine in mexico pharmacies
mexican pharmaceuticals online mexican online pharmacy medicine in mexico pharmacies
mexico pharmacies prescription drugs: cmq pharma mexican pharmacy – mexican mail order pharmacies
mexican rx online cmq pharma mexican pharmacy purple pharmacy mexico price list
buying from online mexican pharmacy mexican online pharmacy mexican pharmacy
mexico pharmacies prescription drugs
https://cmqpharma.online/# medicine in mexico pharmacies
mexican border pharmacies shipping to usa
mexican border pharmacies shipping to usa mexico pharmacy mexican online pharmacies prescription drugs
mexican pharmacy mexican online pharmacy mexican border pharmacies shipping to usa
medicine in mexico pharmacies buying prescription drugs in mexico online medication from mexico pharmacy
pharmacies in mexico that ship to usa cmqpharma.com п»їbest mexican online pharmacies
mexico drug stores pharmacies mexican pharmaceuticals online mexican online pharmacies prescription drugs
http://foruspharma.com/# mexican online pharmacies prescription drugs
http://foruspharma.com/# buying from online mexican pharmacy
reputable mexican pharmacies online buying prescription drugs in mexico mexican border pharmacies shipping to usa
https://foruspharma.com/# buying prescription drugs in mexico online
can i get generic clomid pills: cost cheap clomid now – can i order cheap clomid without a prescription
doxyhexal: doxycycline antibiotics – doxycycline uk cost
amoxicillin canada price: amoxicillin 500mg buy online uk – amoxicillin 500
purchase amoxicillin online without prescription: how to get amoxicillin over the counter – amoxicillin 500 mg brand name
paxlovid india: paxlovid india – paxlovid cost without insurance
cost cheap clomid price: get generic clomid no prescription – can i purchase cheap clomid no prescription
п»їpaxlovid: Paxlovid over the counter – paxlovid for sale