Hello
I have parts family files for screws with a lot of configurations. For each configuration that carries a $Num ero property I want to rename the configuration as follows: $Num ero&(&Configuration&)& and create a configuration Title = $Num ero.
So I use Integration but suddenly it takes the $Num ero property of the active configuration and uses this property in all the configs
Is there a solution to read and write the $Num ero property of each configuration?
Related Topic: https://forum.lynkoa.com/t/comment-renommer-plusieurs-configurations-avec-le-module-integration-de-mycadtools/104255
Part of my solution with batchproperties
1 Like
To rename the name of the configuration according to the property, why not do it in the part family directly by putting =$Num ero in the 1st column (name of the config=
Be careful to select " Standard " in the format of this column before entering the formula. Here in the example I use the value of another property (D1) to rename my configuration:
You can apply the same thing with $Num ero and then just stretch the excel formula to the bottom of your table (make a backup of your file before just in case)
I don't see the point of going through Integration to rename the configs in a family of parts, the Excel way is much simpler, in my opinion.
3 Likes
Otherwise via Integration it does not work either with part family, or without part family:
@fmarchand or one of his colleagues may be able to confirm the error in the rule, if there is one, or the bug on this rename? (2022 Sp2.1 version)
1 Like
Yes, I agree that with the excel table it's easier.
It's that I have a lot of files to process, and several properties to fill in that we have previously extracted from our erp. That's why I'm looking for a "mass" treatment
Purpose of retrieving data in 3DEXPERIENCE
Thank you for the answers, I will give news and @fmarchand was also asked on the question
2 Likes
Otherwise another solution via macro vba.
This code modified from codestack does the job perfectly, for me the property tested was $PROPRIETE@NUMERO:
'**********************
'Copyright(C) 2022 Xarial Pty Limited
'Reference: https://www.codestack.net/solidworks-api/data-storage/custom-properties/rename-configurations-based-custom-property/
'License: https://www.codestack.net/license/
'**********************
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
If Not swModel Is Nothing Then
Dim prpName As String
'prpName = InputBox("Specify the property name to read the value from")
prpName = "NUMERO" 'ici le nom de la propriété à modifier
'If prpName <> "" Then
Dim vConfNames As Variant
Dim i As Integer
vConfNames = swModel.GetConfigurationNames()
For i = 0 To UBound(vConfNames)
Dim swConf As SldWorks.Configuration
Set swConf = swModel.GetConfigurationByName(vConfNames(i))
Dim prpVal As String
If swConf.CustomPropertyManager.Get3(prpName, False, "", prpVal) Then
If prpVal <> "" Then
swConf.Name = prpVal
End If
End If
Next
'End If
Else
MsgBox "Please open the model"
End If
End Sub
Modify it with your property and test it on a part (after a save).
If it works, to run it in batch you create a rule in Integration with SOLIDWORKS= systematic condition, and in operation, Miscellaneous macro and you go find the macro previously saved with the code above.
1 Like
Hello
In the end, I used Integration with a little extra manipulation.
I retrieve all the config names and filenames of my different screw files using smartbom. I associate them with my property matrix in excel via a VLOOKUP and then with integration I can write all the properties in the right config (see screenshots)
Note: I didn't take the time to test the @sbadenis macro (I'm not very comfortable with macros )
The key is to get the right result.
2 Likes