Re - Codification of welded bodies

For all our mechanically welded parts and sheet metal parts, we systematically rename the welded bodies in SolidWorks.

This codification is as follows :   NAME FICHIERP00

00 , the last 2 digits being an incremental counter that allows each of the bodies to be differentiated.

Examples:

  • Mechanically welded part

  • Sheet metal part

To do this, it's quite simple, we use the "Smartproperties" utility, it works very well.

(Note that I'm interested, I can do a little TUTORIAL)

My problem:

In the event that we rename an existing mechanically welded or sheet metal part, I rename my part and therefore we are obliged to do the same with the list of welded parts. We then have to redo the handling of the Smartproperties for the welded bodies.

In this specific case (where the renamed part evolves in terms of size but the shape does not change), we are looking for a faster and simpler solution to rename the welded bodies.

In practice, we notice that some cartoonists do not think of renaming the welded bodies.....

The idea (here I appeal to the !! macro experts) would be to create a macro that automatically renames (with a simple click....)  the whole list of welded bodies.

Is anyone able to help me with this problem?

I'm interested, of course, if anyone has another idea.

 

Hello

An example can be seen in the SolidWorks Help:

http://help.solidworks.com/2012/English/api/sldworksapi/Get_Solid_Bodies_from_Cut-list_Folders_and_Get_Custom_Properties_Example_VB.htm

The interesting part:

   If Not IsEmpty(vCustomPropNames) Then

        Dim NameFmt As String

        NameFmt = "!" & String(30, "@")

 

A macro in the same style is available here:

https://forum.solidworks.com/thread/55341

 

Or in the help but more synthetic:

http://help.solidworks.com/2014/English/api/sldworksapi/Get_Custom_Properties_for_Cut-list_Item_Example_VB.htm

 

names = swCustPropMgr. GetNames

For Each name In names

    swCustPropMgr. Get2 name, textexp, evalval

    Debug.Print name, textexp, evalval, swCustPropMgr. GetType(name)

Next name

 

To be adapted...

And another macro (a priori that renames this one):

https://forum.solidworks.com/thread/47038

 

Thank you@lucas

but all this is "Chinese" for me!!!!

Never done macro in VBA?

Unfortunately no,

I keep telling myself that I have to be interested in it!!!

but I haven't found the time.

To try the 1st link gives a macro that should be functional to get the names.

But we have to work on it to be able to change the names.

If you want to learn VBA check out my tutorials, they are commented on every line:

http://www.lynkoa.com/tutos/3d/macro-enregistrer-sous-avec-solidworks

http://www.lynkoa.com/tutos/3d/macro-solidworks-retirer-lecture-seule-pour-fichiers-de-bibliotheque

 

And there may be some interesting information in this macro:

http://www.leguide3d.com/profiles/blogs/api-solidworks-traversal-liste-des-pi-ces-soud-es

 

2 Likes

For the moment I have put this "problem" on hold.

I rely on the goodwill of the cartoonists so that they don't forget to do the manipulation which since Smarproperties is ultra simple (you just have to remember to do it !!!) ......