Using VBA to control Nested Sub-Assamblies

 

Hi All,

I`m looking for a way to control Family of Assembly Members inside a sub-assembly. I have an assembly here that contains 5 other subassemblies. These 5 sub-assemblies have to be configured. That means that the sub-assemblies have to be replaced by other familymembers. I all ready found a way to control FoA members in a normal assembly without subassemblies. But I find it hard to switch when it's an sub-assembly.Working code for normal assembly:

Set objAsm = objAsm.ActiveDocument

Call objAsm.AssemblyFamilyMembers.ActivateMember("Left")False code for assembly with sub-assembly that I want to switch:

 

Set objAsm = objApp.ActiveDocument

 

Set objTest3 = objAsm.Occurrences(1)

Set objTest3Doc = objTest3.OccurrenceDocument

filename = objTest3Doc.FullName

LBL1.Caption = filename 'Build in check to make sure that document is selected

Call objAsm.AssemblyFamilyMembers.ActivateMember("Left")

 

 

This code doesn't work. The first steps do work, I build in a control frame so I can check if the occurrence is selected. There I do see the right path, so I believe that only the last line of code doesn't work. Who can help me achieve my goals?

 

Any help will be appreciated!

BoE. Laurens Rolf

Btw. I believe this topic can help you to build an very cheap productconfigurator, in combination with family of assemblies. I'm working on such a project right now. 

 

Posted by: Laurens Rolf
Post date: 2/24/2009 1:22:48 AM

6 REPLIES

RE: Using VBA to control Nested Sub-Assamblies

Hi All,

 

I'm still looking for a way to activate an member of an assembly, inside an other main-assembly. Does anyone have suggestions?

 

Structure of main assembly

 

Main assembly

+ Sub-assembly one

¦ +Variable one

¦ +Variable two

+ Sub-assembly two

¦ +Variable one

¦ +Variable two

¦ +Variable three

+ Part one

+ Part two

 

So, I try to chance the sub-assembly variables. Who can help?

 

BoE. Laurens Rolf

Bollengraaf Appingedam, the Netherlands

 

System info:

- Solidedge V20

- Programm with VBA (by Excel)

 

 

Posted by: Laurens Rolf
Post date: 3/2/2009 11:36:30 PM

RE: Using VBA to control Nested Sub-Assamblies

 

HI,

probably, you should take a look to \Custom

 

you find some examples that show how to traverse assemblies. (ex BOM)

 

Also you can try this:

AssemblyDocument..::ActivateAll

 

Best regards

Massimo

 

Posted by: Massimo Magris
Post date: 3/2/2009 11:40:06 PM

RE: Using VBA to control Nested Sub-Assamblies

Hi Massimo,

 

Thanks for your reply. But I don't understand what you mean with: take a look to \Custom. I've searched the forum for other posts who tell about traverse family of assembly members, but I can't find it.

 

Do you think activatin the sub-assembly will help me with a traverse member action? Maybe there's a problem selecting the sub-asm when it's not activated. BUT, if so, I find it strange that the build in check (the textbox with path to sub-asm) does work. Can you explane how this works then?

 

If anybody knows a post on the forum who tells about traverse family of assembly members, please let me know

 

Thanks for any help!

 

Best regards

 

BoE. Laurens Rolf

Bollengraaf Appingedam, the Netherlands

 

System info:

- Solidedge V20

- Programm with VBA (by Excel)

 

Posted by: Laurens Rolf
Post date: 3/3/2009 12:42:46 AM

RE: Using VBA to control Nested Sub-Assamblies

 

HI,

previous post was incomplete.

When you install SolidEdge, under the installation folder, (ex. c:\programs\solidedge 19\custom) you find a Custom directory.

There you can find various example of code.

Also, if you check the conference presentation of Jason,

there you find LOTS of examples in VB.

I think thats a good starting point.

Good Luck!!

Massimo

 

Posted by: Massimo Magris
Post date: 3/3/2009 1:33:24 AM

RE: Using VBA to control Nested Sub-Assamblies

 

Hi Massimo,

 

Thanks for your info! I did a check if there was some usefull programs in the SE folder, I found the programs, but there wasn't a program that switches between Family of Assembly members. I also looked if I could find the code in the examples of Jason, but I didn't found it..

 

So I'm still looking for the right code (VBA) to switch between family of assembly members of an sub-assembly inside an big-assembly, who can help?

 

Thanks in advance!

BoE. Laurens Rolf

 

Posted by: Laurens Rolf
Post date: 3/4/2009 12:36:35 AM

RE: Using VBA to control Nested Sub-Assamblies

Is there anybody that uses VBA to program Solid Edge?

 

Greets Laurens

 

Posted by: Laurens Rolf
Post date: 3/11/2009 12:59:05 AM