YP69
May 26, 2020, 12:40pm
1
Hi all
I am looking via a macro to automatically fill in a property (in my case the DESCRIPTION variable) of my list of welded parts.
My welded parts list is composed of the main and insert sheet metal from a library function
I found how to add the variable name in each part to be welded part, but I don't know how to retrieve the information from the design libraries.
In the library, there is a DESCRIPTION property in each Configuration. Is it recoverable?
Or the name of the library config.
I'm attaching my macro, my library piece and the SW file
Thank you in advance for your help
Cdlt
Yannick
cutlist.zip
Hello I don't know how to automatically import the description of the parts from the library. On the other hand, it can be done by macro: - Go through the functions to find each library piece - extract the file path and the name of the inserted configuration - open the file to find the description corresponding to the configuration - find the welded part corresponding to the function - write the description in the welded part
1 Like
YP69
May 27, 2020, 1:32pm
3
Thank you for the feedback Jerome
Unfortunately, I don't have the skills.
I started the macro, but I'm already stuck on extracting the name of the library.
Sub recherche_fonction_biblio()
Dim swApp As SldWorks.SldWorks Dim swModel As SldWorks.ModelDoc2 Dim swFeat As SldWorks.feature Dim swSubFeat As SldWorks.feature
Set swApp = Application.SldWorks Set swModel = swApp.ActiveDoc Set swFeat = swModel.FirstFeature
Do While Not swFeat Is Nothing If swFeat.GetTypeName2() = "Crimp Nut,Steel" Then swSubFeat. (Path & name) End If Loop End Sub
A little trick, adding debug.print to see what it looks like as it goes along, it helps a lot to debug.
debug.print swFeat.GetTypeName2()
And you'll see all the values paraded and if you enter your loop or not.
https://www.developpez.net/forums/d1358915/logiciels/microsoft-office/access/vba-access/explication-debug-print/