Inserting Multiple Configurations of the Same Component into an Assembly

Hello

I want to make a macro to limit the repetitive tasks that designers do when creating different assemblies.

To try to simplify their work, I develop macros to create the assembly of different profiles (and other configured parts) according to a sketch (I just measure the length of the different sketch lines) and then add the rails by adjusting their length (according to the length of my sketch lines and the imposed clearances).

So I have a rail model that groups different configurations (600) and I have to add between 3 and 7 rails depending on the dimensions of my sketch. Two rails are therefore never the same length (if a wall is more than 3m long, two rails are added). I can position them very well but they are all added in the same configuration and therefore with the same length. But I have many other elements of this type to add (i.e. using configurations) and if I solve the problem for these first rails I solve it for everything else. I could very well add them and manually change the configuration of the component but the macro loses a bit of its interest.

Maybe the configurations don't allow you to do that, or is there another way (which is not to create all the parts: I have 6 different types of rails with 600 references each time).

Thank you for your help and interest.

Do you have a visual example of what you have at the beginning and what you want in the end?

So here's what I have at the beginning

 

What I want on arrival

And what I actually have

We can see that the different profiles are not the right size except for the first one (the one that is the "bottomest" of the image. And all the others are displayed with the configuration of the first one

Good evening

Without having seen the macro, I think there must be a problem in the call of the configurations. If the same is displayed, it means that the macro is linked without modifying the file being called. (assumption)

True, but I've tried several methods and I can't change the active configuration inserted in the assembly

I tried like this :

value = instance.EditConfiguration3(Name, NewName, Comment, AlternateName, Options)

J'avais aussi vu ce sujet

http://www.lynkoa.com/forum/cao/activer-une-configuration-de-piece-dans-un-assemblage-avec-une-macro

But I have a mistake every time on the line:

Set selObj = selectionMgr.GetSelectedObject6(1, -1)
    Set Value = selectionMgr.GetSelectedObjectsComponent4(1, -1)

Or on

ReferencedConfiguration

In short I'm a bit lost and I don't really see how to do it, oh yes and I'm on SW2012

I finally found the solution and I had an error in the call of my configurations that I couldn't identify.

It is therefore necessary to use:

boolstatus = swTmpModel.ShowConfiguration2("Ma_Config")

Thank you to all those who have looked into my problem

1 Like