I regularly import files (types of assemblies and parts) from suppliers and before working with them, I first carry out an import diagnosis and sometimes recognition of the functions. Nevertheless, I find it tedious to do it for each "file" of an assembly (see attached files). Is there a way to do this faster and thus perform this task for a batch of files?
If, in addition to the task scheduler, you have to make a macro, then it may not be worth bothering with this one... Your need is quite achievable by macro, of course it depends on your degree of knowledge on the subject. The following is a list of functions to use to analyze an assembly and perform import diagnostics and feature recognition for each child element:
Opening of the ASM then: - ActiveDoc (ISldworks) - GetRootComponent3 (IConfiguration) - GetChildren (IComponent) - GetModelDoc2 (IComponent) - OpenDoc6 (ISldworks) - ImportDiagnosis (IPartDoc) - CallBack("fworks@FWPlaybackManager", 0, "...... ") (ISldworks) - SaveAs (IModelDocExtension) - CloseDoc (ISldworks) Then we loop on the next element to the last child. Don't forget to save the ASM at the end of the treatment.
It can make a pretty nice macro and that would surely be very useful to many users ...
If I have time soon, I can possibly get started on the subject. I'll add a few more functions, including the choice of assembly export (personally I export assemblies in .sldprt in order to lighten my designs).
Maybe you should first try to have a code that works on a part and then we'll see for the rest for an assembly?
You will then have to be careful in the event that your assembly is made up of the same part several times. I will read the architecture of the assembly, when I see a new file name I put the file name in a list, then once finished I perform the import diagnosis on the files in the list. Maybe there are simpler things, but I'm a mechanic, not a computer scientist :-).
All the necessary functions are already given in a previous message, as a reminder:
The following is a list of functions to use to analyze an assembly and perform import diagnostics and feature recognition for each child element:
Opening of the ASM then: - ActiveDoc (ISldworks) - GetRootComponent3 (IConfiguration) - GetChildren (IComponent) - GetModelDoc2 (IComponent) - OpenDoc6 (ISldworks) - ImportDiagnosis (IPartDoc) - CallBack("fworks@FWPlaybackManager", 0, "...... ") (ISldworks) - SaveAs (IModelDocExtension) - CloseDoc (ISldworks) Then we loop on the next element to the last child. Don't forget to save the ASM at the end of the treatment.
An old subject but one on which I have made progress in recent weeks. The principle of my macro is as follows:
Look at the input file extension (SLDASM, SLDPRT, STP, X_T, ...) and by various means saved it in . SLDPRT and close the template file. Then he will carry out an import diagnosis on the saved part, repair the defective faces, block the part and save this new part. Attached is the macro in VBA.
I let you modify it as you wish and or improve it as needed. Feel free to post your future revisions!