For noobs like us in macro creation, there is a feature to capture functions in SW. You start the recording, you do your manipulation and SW automatically creates the code of what you did on the screen.
With that you have 90% of your macro.
All you will need is the loop(s) to change the .sldblk file as well as the declaration of the variables (name of the record file, probably some more temporary variables..).
I looked at the link on 3dexperience, I updated the data (path of my files and others) but nothing happens when launching the macro. I ran the said macro with an open file, from a sketch, without anything open nothing happens... Shame
I did record a macro that does the job for about 1 file.
On the other hand, I don't know how to integrate a loop and a recording under the same name as the block. Is there a topic about these elements, it could be an alternative to my search.
Attached the macro from a selected room, a shot then launch the macro and it works (except that the block is not fixed)
It needs to be improved but we are getting closer.
After seeing your request if you only have 100 blocks to modify, not sure that developing a macro that doesn't exist is faster for 1000 blocks or more, on the other hand, I don't say. 100 block = 1 to 2 hours is much less than the dev of a macro even for someone in the know.
Thank you for your feedback. Yes, I think I used the ririfififi macro with class1 and module1 separate and data (file path...) in accordance with my files.
Thank you for your macro but it doesn't really meet my needs. For my part, with my macro, I manage to make a new room, insert the block to scale, save and close. For 1 defined model.
I lack the "loop" aspect that would automate the opening of the next block and reproduce the actions.
I looked but unfortunately I get stuck... I'm going to switch to "manual" mode so
Answer may be a little late, but the attached macro should answer your problem. Generation of the parts with sketch in the face plane, insertion at the origin, at scale 4. 3 lines are to be modified to adapt it to your system: - line 35: source directory of block documents (with extension "SLDBLK"); - line 36: destination directory of the parts files, with the same name as the blocks, with the extension "SLDPRT"; - Line 40: The path and name of the default part model for your version of SolidWorks.
If this is the case, you need to check that the Part and swModel variables are not empty: in debug mode, you just have to leave the cursor above one of these two variables to display its content. If they are equal to Nothing, it means that the previous statement Part = swApp.NewDocument... (line 40) does not return anything, and the SolidWorks document is not open. Hence the error when creating the sketch manager. The string that defines the template file is probably wrong, you have to check, very carefully, that it exists, with the path indicated (on my source file it is in the SW 2018 folder).