I regularly design mechanically welded assemblies from which I retrieve the lists of welded parts to integrate them into my drawings.
In these lists of welded parts, I retrieve, through a custom property named "Description" (see pj) the geometric characteristics of my profiles, which I rename according to these characteristics. For example, for a 100x3 square tube with a length of 1544 mm, the body will be called TC100x3... 1544.
On the other hand, it gets complicated when my body is a sheet of metal... I would like to be able to recover the thickness (e.g. 3mm), the length (400 mm) and the width (100 mm) of the unfolded sheet metal to name my body as follows: Sheet metal ep.3... 400x100 .
The body does have the properties Sheet Metal Thickness, Sheet Metal Sidewall Length and Sheet Metal Sidewall Width, but how do I integrate them into the "Description" property?
Recently for a customer (one-off use), we had a similar need: in a mechanically welded part (in the SW sense), displayed long x width in a body property. We just got the content used to have the length and width and pasted everything in the box we were interested in.
In this case, it would be: "SW-Length of the flank of tôle@@@... " x "SW-Width of the flank of tôle@@@... " x etc.
I'm a bit late but I've been using the same thing as Stefbeno for a long time, copying the formulas of the desired variables, putting them in a row interspersed with the desired text, it works perfectly And the values change when copying, copying trees and renaming configs, or I don't see any problem with doing it like that!
All that remains is to copy/paste in the summary of properties: Example: Laser "SW-Sidewall Length of tôle@@@Tole<2>@Pièce1.SLDPRT"x"SW-Sidewall Width of tôle@@@Tole<1>@Pièce1.SLDPRT" ep"SW-Thickness of tôlerie@@@Tole<2>@Pièce1.SLDPRT"
For existing parts you will have to go through a macro, I made this one personally, for a similar problem:
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swFeat As SldWorks.Feature
Dim swCustPropMgr As SldWorks.CustomPropertyManager
Dim NF As String
Dim Liste As String
Dim Final As String
Dim st As String
Dim swBodyFolder As SldWorks.BodyFolder
Dim swBody As Body2
Dim vBody As Variant
Dim i As Integer
Sub main()
On Error Resume Next
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swCustPropMgr = swModel.Extension.CustomPropertyManager("")
NF = swModel.GetTitle() & ".SLDPRT"
st = """"
Set swFeat = swModel.FirstFeature
Do While Not swFeat Is Nothing
If swFeat.GetTypeName() = "CutListFolder" Then
Liste = swFeat.Name
Set swBodyFolder = swFeat.GetSpecificFeature2
swBodyFolder.UpdateCutList
Final = st & "SW-Longueur du flanc de tôle@@@" & Liste & "@" & NF & st & "x" & st & "SW-Largeur du flanc de tôle@@@" & Liste & "@" & NF & st
Set swCustPropMgr = swFeat.CustomPropertyManager
swCustPropMgr.Add3 "Dimension", swCustomInfoText, Final, 1
End If
Set swFeat = swFeat.GetNextFeature
Loop
End Sub
All you have to do is adapt this line:
Final = st & "SW " " tôle@@@ Flank Length & "@" & "NF & st & "x" & "SW " " & "SW " " Sidewall Width tôle@@@& " " & "@" & "NF & st NF being a concatenator of: part name + . SLDPRT st being the quotation mark character (")
Then you can do what you want as a formula, add text, that's the advantage of macros!
Thank you Michael! On the other hand, I don't see how to put this body property in the default model: Laser "SW-Flank Length of tôle@@@""x"SW-Sidewall Width of tôle@@@"" ep"SW-Thickness of tôlerie@@@@@@""
For the default model, my advice is to just create a mechanically soldered function in the default model to add your variable that is fine. Normally, from the creation of bodies, they will take on the appropriate value.
You can also make a normal part model and a welded mechanic if the fact that you have the mechanically welded function on all the parts bothers you
The problem with sheet metal bodies is that the "Description" property automatically takes the value "Sheet" when the sheet metal is created.
Under SW2019, in Option => Document Properties => Welded Constructions, there is the possibility to change this default value (see pj). But what expression should I write instead of Sheet to get my famous Sheet Metal.# ... ### x ###?