MEP 3D Function Name

Hello
Does anyone know how to display the name of a feature or its description as a note in a drawing, in this case a library function?

Thank you



CAPTURE 000460

Hello

To my knowledge, it is currently impossible to retrieve the name of a function.
Several workarounds:

  1. Bubble with Tracking Library

  2. Library Note

  3. A 1+2 combi (save a note in the library with the tracking library defined, even if it means deleting the non-existent markers in the room)

  4. Macro (subject to possibility - but there are some very strong ones among the members of the forum who will certainly be able to give their opinion on this point.)

1 Like

Maybe by adapting this code from an MEP:

3 Likes

Hello

I haven't had the opportunity to test, but I have the impression that it's pretty close to your need, right?

How do I link notes to custom properties in SOLIDWORKS? (javelin-tech.com)

In reply to coin37coin
The problem with this approach is that in each part manufactured you have to add properties, it's unsuitable in my case

you should be able to add the properties in the library functions and call them, I can't find how to do it in the MEP
knowing that the properties would all be the same but 1 in each room
This would display the Qty and Description

for the moment and failing that I'm looking to adapt the macro
In the MEP, instead of selecting the function in the tree, selecting it in the plan and putting the code without a separate function back, a single macro

Sub main()
'https://www.codestack.net/solidworks-api/document/features-manager/get-feature-type-name/
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim Fonction As String
Dim myNote As Object

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc


If swModel.GetType <> 3 Then Exit Sub '1 = pièce, 2 = assemblage, 3 = plan
Fonction = GetTypeNames(swModel.SelectionManager)
Debug.Print Fonction
Set myNote = swModel.InsertNote("$PRPWLD:""QUANTITY""x" & Fonction)

End Sub

Function GetTypeNames(selMgr As SldWorks.SelectionMgr) As String
Dim typeNames As String
Dim i As Integer

For i = 1 To selMgr.GetSelectedObjectCount2(-1)
On Error Resume Next
Dim swFeat As SldWorks.Feature
Set swFeat = selMgr.GetSelectedObject6(i, -1)

If Not swFeat Is Nothing Then
'typeNames = typeNames & vbLf & swFeat.Name & ": " & swFeat.GetTypeName() & "; " & swFeat.GetTypeName2
typeNames = swFeat.Name
End If

Next
GetTypeNames = typeNames
End Function

This video can probably give you the start of how to retrieve a function from a note (here it's not the name of the function but the path for istoolbox):

I seemed to have understood that your function is a library piece integrated into your 3D.
However, they explain to you how to add properties to your library room and then how to recall them via a call-out in your MEP.

So, it seemed to me to be perfect for your use. But maybe I missed a point

1 Like

I tried it doesn't work at home, I put a personal property in the library function, I inserted the library room in a room, in a mep room impossible to put a note with the name of the property

This is a stamping function:

b7cb9801b0f26fbf8e2dff444b59cbcbf032e1c9_2_229x499

so maybe see the punching IDs...

1 Like

@Silver_Surfer not using (or no longer) a punch, I didn't know this id trick for a punching table.
Thanks for the tip!.
https://help.solidworks.com/2021/french/SolidWorks/sldworks/c_Punch_Tables.htm

2 Likes

I want to get the name of the function it doesn't matter if it's stamping or a custom function

Try adding a punch ID to the shape tool, and then call the punch ID property in the note. It should work.

As for custom library functions (Engraving N° visible in the construction tree), the link proposed by @coin37coin can work provided that the function uses properties present regardless of the file.

Otherwise it's the macro: I'll try to make a macro which, from the selection of a function in the drawing tree, creates a note to put on the view/element.

But in my opinion, creating a predefined note in the same folder as the library functions is still the best solution in terms of efficiency (and simplicity).

The following library functions can also provide some answers:

Hex weld nut. SLDLFP (630.6 KB)
HELICOIL® fillet insert. SLDLFP (2.6 MB)
TUBTARA®. SLDLFP (944.0 KB)

Each requires a ref point (point in a sketch).
The choice was made to integrate the geometry of the element directly into the function, and to prefer to integrate the complete description of the element into the text of the thread representation.
Thus, by dimensioning the thread representation, the element is identified.
For sheet metal, 2 repetitions per sketch are necessary in order to obtain an unfolded without the nut or tubtara®.

1 Like

If I understand correctly, it only works if there is a thread or thread with the property in thread representation, related text, and you can't count the number of occurrences

The advantage is that it's easier to position the elements than with part insertion.

The thing is that here the inserts are put with part insert and the hole apart with a library function

I'm looking here for a way to make a note appear with the name of the function in it

for the moment I have this macro
-it is missing to select the function from a part view for the note to be attached to it
-the quantity of function of the same type used

Sub Fonction()
'MEP : Copie le nom de la fonction dans une note
'01 : Sélectionner une fonction dans l'arborescence pièce
'02 : La macro va créer une note avec le nom de la fonction

Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swSel As SldWorks.SelectionMgr
Dim swFeat As SldWorks.Feature
Dim Note As Object

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSel = swModel.SelectionManager

If swModel.GetType <> 3 Then Exit Sub '1 = pièce, 2 = assemblage, 3 = plan
If swSel.GetSelectedObjectCount2(-1) <> 1 Then Exit Sub

Set swFeat = swSel.GetSelectedObject6(1, -1)

If Not swFeat Is Nothing Then
'Set Note = swModel.InsertNote("$PRPWLD:""QUANTITY""x" & swFeat.Name)
Set Note = swModel.InsertNote(swFeat.Name)
End If

End Sub

Why not add a property at the part body level?
For the punching function, I don't see any other way than using the punch ID.

However, because you are using part insertion, you can easily retrieve the following properties:
In the inserted part file, create the property e.g. " Name ".
At the time of insertion, in the transfer options, select Custom Properties and Prop. Welded Parts. as below.
image
Saved a note in your library that contains: $PRPWLD:" Name ".

All that remains is to install it by attaching it to the body of the piece.
Also in this way, your welded part list will be completed automatically.

Tip for existing parts (with parts already inserted):
Enable welded construction.
Right-click on the icon, select properties.
image

The properties created in this window will be created automatically for all welded parts bodies

Then, right-click on a folder/item in the Welded Parts List > Properties > Property Summary, select the prop. who is fine and fill in the values.

If we take the example of the description for tubtara:

… with a note $PRPWLD: " DESCRIPTION ", we get:

Another point: in the options - document property - make sure that the " collect identical bodies" option is enabled.

Everything works fine for inserting a part in another part the problem comes from inserting a library part, the parts properties are present but impossible to display in a plan

Are you sure that your annotation is fixed on the bookcase piece and not on the final piece?
Because you should be able to make your callout with " component to which the annotation is attached"