Under Catia, I had a macro that allowed me to modify the numbers on a part.
On a coin, I had a number in hundreds, and when in my Catia macro I marked " 123 " the writing on the coin changed to 123. If I marked 245, the number changed to 245. How can I reproduce this on Solidworks.
Thank you for your help
It has to be achievable, but not all inclusive.
A screenshot of what you want would be appreciated.
How is the text made, what function is used?
Sketch text with material removal, extrusion?
Otherwise without a macro pass:
https://forum.mycad.visiativ.com/t/numerotation-incrementale-sw/106936?lang=fr
I forgot in information version of SW?
First of all, thank you for answering
My version of Solidworks is 2025 SP1.0
Here is the type of part to be set up
And here is the principle of the macro in CATIA
The macro would open a window, which would change the number and then it would also change the extrusion on the part.
Is that a little clearer?
Without a macro possibility, as indicated above, to modify the text via a family of parts, or otherwise to control the text via a global variable, no need for a macro in my opinion for this use, which remains simple.
You can easily link the text to be extruded to a component property using: $PRP:" SW-Property-Name(property-title) "
For example, here the engraving depends on the text entered in the " Title " property:
$PRP:" SW-Title "
https://help.solidworks.com/2022/french/solidworks/sldworks/t_link_notes_to_document_properties.htm
Yes the global variable doesn't actually work @Maclane, I just realized against it too, that you have to pass via a property.
To modify the digits, go through the file property and modify the digit, then CTRL+Q
Attached is an example SW2024
Numeral plate. SLDPRT (165.1 KB)
The CTRL+Q being practically the most important...
To go further, modifying a property by macro is not very complicated but I'm not sure if it's relevant in this case.
Subject to more " use case" expiations.
To go a little further, the writing parameter also influences a raised binary code
Each digit corresponds to a code
Are your " plates " from a family of parts (configuration?)
If this is the case (I hope it is, it would be so much more convenient...) the property can be directly changed in the Excel table.
https://help.solidworks.com/2020/french/SolidWorks/sldworks/c_Design_Table_Configurations.htm
For binary code, going through a family of parts would be a solution, or else an equation perhaps, but for that we would have to understand how it works.
Otherwise effectively via macro it must be possible as well, but you need VBA basics.
By macro it is only playable if each " plate " is a unique document, I don't see how to manage several text extrusions on the same document, unless you ask the user to choose each time the text to modify which, in my opinion, would be a nonsense for a Macro (not really time saving).
As for the equations (Yuck).
It remains to understand the context in which these " binary codes" were created...
I was going to go in the direction of @Maclane with the formulas/parameter ... The binary side makes it very complex!
Is there a formula linking numbers and repetitions?
Hello
Considering how the subject is presented, for me the plate is unique in the model (even Catia doesn't know how to manage such a basic macro to manage several models in the same file).
The only complexity is the generation of the binary code associated with the number, which probably has to be done in the macro and manage a repetition of shapes.
If @sebastien_beaujard_1 still have access to the macro under Catia, there should be a possibility to transcribe it under SW (you will just have to put back the variables adapted to SW but the code that converted into binary must certainly be able to be retrieved directly).