Reply

Replace part while maintaining relations

Hi everyone,

 

I try to make an Excel driven configurator for Solid Edge assemblies.
One problem that I encounter is that with the Occurrence.Replace method some relations are lost. The Occurrence.Replace method, does not give the same result as manually performing the replace part command in Solid Edge. With the latter, the relations are kept (if relations are applied on custom or standard reference planes).
Relations placed on the standard reference planes or coordinate system are kept with the Occurrence.Replace method, but relations on custom reference planes (custom reference planes have the same name in all interchangeable parts), are lost.

 

Does someone know how to solve this? I would like the code to respond in the same manner as the manual replace part command. With the manual command it’s important to have the assembly option "Use default placement name during Replace Part" on. Perhaps this has something to do with it.

 

I use SE ST5 en my piece of code for replacing the parts is:

 

Set objOccs = objAsm.Occurrences

For i = 1 To objOccs.Count

     If objOccs(i).OccurrenceDocument.Name = "T40001.par" Then
            Call objOccs(i).Replace(strCache & Range("part1").Text, 0)

     ElseIf objOccs(i).OccurrenceDocument.Name = "T40002.par" Then
            Call objOccs(i).Replace(strCache & Range("part2").Text, 0)

     ElseIf objOccs(i).OccurrenceDocument.Name = "T40003.par" Then
            Call objOccs(i).Replace(strCache & Range("part3").Text, 0)

     ElseIf objOccs(i).OccurrenceDocument.Name = "T40004.par" Then
            Call objOccs(i).Replace(strCache & Range("part4").Text, 0)

     End If
Next i

2 REPLIES

Re: Replace part while maintaining relations

In the automation I do, everything is grounded so there are no relationships to loose.

Terry Tyson
Software Automation Designer

Re: Replace part while maintaining relations

Thanks for your reply Terry. 

 

As far as I see it, grounding is not ideal. However, it is an option. The consequence is that relations have to be built in the program code (or am I missing something?). This leads to problems when maintenance has to be applied. All engineers knows how to make relations in Solid Edge, but only one knows something about VBA. Also applying the relations in Solid Edge gives a far better overview of the relations.

 

With my non-programming background, I find it a bit strange that the manual command works different than the programming method. I assumed it would be possible to replicate the manual command (perhaps with some options set or something alike).

 

In the meantime I discovered that the method sometimes works, but it depends on the sequence the constraints are placed and somehow on the sequence in which I change the parts. For example if I change part 1 from option one to option two it loses its relations, but if I change it from option one to option three and then to option two it maintains all relations. There must be some kind of logic behind this, but I haven’t figured it out yet.