First of all, thank you to the forum for existing, it is a real source of solution, and thank you all for your participations, which make it live!
I have come to join you in a new company and I would like to set up new ways of working.
To do this, I'm looking for a macro that will generate for me, from the 3D sldprt part, a STEP file with in the file name, the name of the part + the revision, i.e. the NomPièce_Révision.stp format, with if possible an icon when you are on the part window in the taskbar.
And for drawings, a macro that exports the drawing, with the revision and description of the part, i.e. the NomPièce_révision - description.pdf format, while taking up the personalized properties of the part (it is at the part level that the revision and description fields are edited).
Hoping to have been precise in my request, I thank you in advance for your help!
Hello By accumulating macros already available, you can create a macro that does the job according to the type of file opened (a single launch icon in the interface). It's also good to get started if you have a little knowledge of VBA
I have some time on my lunch break, so what is the name of the custom properties (review and description) so that I can provide the final code directly? Do we agree that File Name = Part Name?
Re Attached is the code commented as much as possible. The .dot having no properties I put xxx, to change to the right values Macro-PDF_STEP.swp (87.5 KB)
Is there a trick either to fill in the fields of the customize tab (and they readable by macros) or that macros can read the fields in the tab specific to the configuration?
In addition, once I have filled in the fields of my part, they are not automatically written in the fields of the properties of the drawing (of the part concerned)
Hello If it's readable via macros when the file is opened in SW. It's only if you want to play them without opening the file, that's where it gets complicated. In the macro I provided, you can add a processing to find out if there is any info in the configuration specific tab (only on part and asm).
Macros can read custom or configuration-specific properties, but not the same (macro) function for either. For the last point there are macros to take the properties of the part and re-write them in the MEP, but the properties are also accessible from the MEP by going to the property of the part linked to the view. Example for the material: $PRPSHEET:"Material" fetches the material from the part to the view referenced in the MEP, while $PRP:"DATE" refers to the property of the MEP: https://help.solidworks.com/2020/french/EnterprisePDM/Admin/t_creating_SOLIDWORKS_PRP_PRPSHEET_links.htm
I want the fields on the property map to be populated by the fields filled in the room and not just the block. For the moment, I fill in the properties of the part but in the drawing, the fields of the property card are empty, while my title block follows those of the part
As a result, because the fields are empty, the macro does not run as it should
There are two possibilities: either you get the 3D attached to the plane and you inject the values into the properties of the drawing. Another solution: scan the cartridge and retrieve the properties we are interested in and copy them into the properties of the drawing. To retrieve the values that are in the specific to the configuration of a part or asm you have to change in these lines: sRevision = swModel.CustomInfo2("", "xxx") By:
sRevision = swModel.CustomInfo2("Défaut", "xxx")
Default being the name of a configuration. If several configurations are required, the different information must be scanned in case there are differences and the right treatment applied.
Both are simple. After another solution in the properties you just have to put in the expression column $PRPSHEET:"xxx" and it allows you to link the properties and values. To see if it spreads in the form