Macro: Duplicate sketch

Hello
I regularly draw welding, drilling and inspection jigs in cut sheet metal. The sheets are held together by tenons (nuts) and mortises (CHC screws).

However, I have to manually place each of the mortises on my main sheet and, each time, constrain them in relation to the tenon in order to center them (always 3 constraints).

Do you think it's possible to automate this process? The project seems quite complex to me, especially for a beginner like me who has never done macro, but if I am told that it is feasible then I will take the time it takes to get there.

Thank you in advance for your answers

Hello @Nass_Tdj and welcome to the Forum.

Do you have an example to share? (illustration in conversation, CAD file)

Could you also specify what varies from one size to another?

This is in order to know which paths to go towards (yes there are several: macro, library function, sketch block, smart component, model (PDM pro only))).

1 Like

Hello;
I'm like @Silver_Surfer, I'm missing some visuals.
As well as the version of Solidworks (if we are talking about Solidworks) used.
What are the sketches you want to duplicate (and why only the sketches and not the functions?)
Do you work with assemblies or with derived components?

By the way, for me the mortise and tenon assemblies look like this:
image
And I don't really see the notion of:


Finally, why did you post in the " Macro " section, is this what you expect from us?

1 Like

Hello @Silver_Surfer, @Maclane,

Sorry for my late reply, I didn't have access to SolidWorks until today.

To get started, I'm quickly attaching an example of a mortise so you can visualize what it looks like.

Mortises (which I import from my library in .sldblk format) are still constrained compared to tenons (also imported, but in .sldlfp format). The constraints are always the same: a parallelism and two "midpoint" coincidences. Parallelism is used to block the rotation of the mortise, while coincidences are used to center the mortise in relation to the tenon.

The mortises and tenons are identical from one template to another. What can vary is their orientation in relation to each other, their number, and their "meaning": there are the tenons of the upper sheets (on which the pieces will be placed), and those of the lower sheets which serve as a support and stiffen the whole. So I use two separate sketches: one to extrude all the mortises associated with the tenons of the "lower" sheets, and the other for those of the "upper" sheets. It's mainly to organize myself, it's not essential.

I will only work in assembly because I only constrain my mortises in relation to the tenons of the different sheets.

My question remains the same: do you think it is possible to automate the insertion of each mortise via a macro?
Does VBA on SolidWorks allow this (I don't want to waste time trying things if there's no chance of it succeeding), and if so, where would you advise me to start?

Thank you again in advance for your answer!

example mortise tenon. WWTP (186.1 KB)

coincidence 1
coincidence 2
parallélisme

photo tenon mortaise tole supérieure
photo tenon mortaise tole inférieure

example mortise tenon. SLDASM (72.1 KB)
1.SLDPRT sheet metal (120.9 KB)
2.SLDPRT sheet metal (66.2 KB)

Hello;

… Why import your mortises from a " block " when your tenons are in the form of a " Library Function".
Wouldn't it be easier to harmonize your import formats in the form of a library component?

On the macro side. I don't think this is feasible (the tenons and mortises are not on the same components... I don't see how to identify them, nor orient the mortises in the right direction...
(a macro that would raise as many questions as the function it is supposed to replace doesn't make much sense to me) but maybe I'm wrong...

On the other hand, why not work directly in the assembly (with the tenons AND the mortises as library functions).
Place your material removals (still in the assembly) and check the " Propagate the function to parts " cell. And finally (but it's optional), break the external references and sketch derivations to have " clean " parts. (I'm not a fan of external references...

… The easiest way would be to use the Tenon/Mortise functions integrated into Solidworks, but is it possible to create custom cutting profiles? It's not sure. (Open question to users)...

… Another possible avenue is: the " intelligent components" function:

PS: Remember to indicate the version of Solidworks used for your shared native files...'Solidworks is not the specialist in backwards compatibility).

2 Likes

Hello

I like it with @Maclane : smart components seem to be made for you.

Sketch repetition can also make your life easier: just place the points and SW will repeat the function at the specified locations. And the repeat repetition will allow you to add all the screws / nuts in 1 click.

Very stupid question: in real life the nuts are just held by the tightening of the screw and are they what holds the sheets together? If so, it seems daring to me as a design given the reduced surface of the nut/sheet metal contact. If it is for the installation before welding of the whole thing this remark self-destructs.

2 Likes

I didn't know the repetition by sketch, the problem in my case is to quickly create a point that is centered in relation to the tenon (maybe once again make a macro that seems to me much simpler?)

As for the screws and nuts, I never insert them in my final assembly.

Finally, to answer your question about rigidity, except for very small sheets, almost the majority of the others are crossed in relation to each other at 90° and it's often 4/5/6+ sheets that intersect which with a certain amount of screws/nuts makes the whole thing super solid.

We want to avoid any welding to be able to easily modify/change the template if necessary.

Hello, thank you for your answer

For the import of mortise in the form of a block I don't see how to do otherwise.

And I'm having trouble understanding what you mean by " Place your material removals (still in the assembly) and check the "Propagate function to parts" cell. And finally (but it's optional), break the external references and sketch derivations to have "clean" parts. (I'm not a fan of external references...  »

In fact I first place my sheets on which there are all my tenons and from there I place my mortises but doing the opposite is impossible.

For the mortise tenon function of solidworks, I was told that it was not possible to create custom cutting profiles, but I will still take a look.

Regarding the " smart component" function, I didn't know it either, so I'll look into it.