Solved! Go to solution

Peer variables

Hi all,


Is it possible to acces and edit the peer variable table?

Can you provide my maybe with an examplecode in c# or

Thanks in advance!


Re: Peer variables

When used interactively, the peer variable asks for an assembly component.

Similarly you may access the OccurrenceDocument or the OccurrenceFileName first and then seek its variables.

If this is acceptable, I can post some code.

Re: Peer variables

It's not really clear to my at first.

Maybe you can provide me with some code to maken things clear. 

I think it's not possible to select a part within the code and acces the peer variable list in the assembly environment. 

I am right that you suggest to open the part in the part environment first and access the normal variable list?

Thank you for your fast answer, hopefully you can help me out!

Accepted by topic author Martijn
‎08-26-2015 04:32 AM

Re: Peer variables

[ Edited ]

Here is the Peer Variable workflow interactively, if you did not understand.



Also as mentioned in earlier reply, the 'OccurrenceDocument' object of an Occurence in the assembly can be used to access the peer variables of the occurrence part as below:


Dim oApp As SolidEdgeFramework.Application = Marshal.GetActiveObject("SolidEdge.Application")

Dim oDoc As AssemblyDocument = oApp.ActiveDocument
Dim oOccu As SolidEdgeAssembly.Occurrence = oDoc.Occurrences.Item(1)
Dim oOccuPart As SolidEdgePart.PartDocument = oOccu.OccurrenceDocument
Dim oVars As SolidEdgeFramework.Variables = oOccuPart.Variables
oVars.Edit("VarInPart", "200") ' Older value = 100

As you see, there is no need to actually open the part and access its variables.

On Line 6, the Part document is referenced directly from the Occurence and its variables are accessed.

Hope that was useful. If so, mark this as a solution.

~Tushar Suradkar