Accessing a Copied Part document from the assembly

Hello guys, this is driving me mad.


In order to model mechanized parts which come from standar elements (i. e. sprockets) we use the part copy feature, generating a living link between the mechanized part (which is the one we insert in the assembled machine) and the raw one, so I can keep track of both later. Like this:



In order to collect the info, I need to access to the raw part from within the assembly, which holds the "mechanized father". Solidedge has no problem showing the Copied Part inside the Property Manager of the main assembly, where you an modify properties and so on, like in the picture. However, I can't get access to that info from the API :-(


Currently, from the API I can get access to the document of the mechanized part; from there, I just can get the filename of the Copied Part, no access to its document or any other information. My code looks like this:


Dim objModels As SolidEdgePart.Models = Nothing
Dim objModel As SolidEdgePart.Model = Nothing
Dim objCopiedParts As SolidEdgePart.CopiedParts = Nothing
Dim objCopiedPart As SolidEdgePart.CopiedPart = Nothing


objModels = CType(objDocument, SolidEdgePart.PartDocument).Models


For Each objModel In objModels
    objCopiedParts = objModel.CopiedParts
    If objCopiedParts.Count > 0 Then
        For Each objCopiedPart In objCopiedParts
            If Not objCopiedPart.IsBroken Then
                strPath = objCopiedPart.FileName 'Just this!!! 

So, if I need to collect internal info from the copied part, I must Open it into SE and proceed. However, when using property manager, SE has direct access to that info without the need of opening the part, or at least it seems so. Also, I'm having trouble when opening the parts from the API in order to get the info (some of them launch an exception and don't open, not sure why), so the thing becomes quite frustrating


Any ideas for a better way to access the document for the Copied Part? Much thanks, my apologies for so much extension! 



Re: Accessing a Copied Part document from the assembly

Which information are you going to read from the copied part document?

If there are just some properties, you don't need to open the whole document.

If you need any feature specific information, then you might open the document without creating a window and then close it again after having read the desired info.

Re: Accessing a Copied Part document from the assembly

I just need to read some "text" properties. If I get access to the Document Object of the Copied Part that's an easy task, but in order to get it I currently need to open the part.


Maybe, in the future, it would be nice to be able to reach nested Copied Parts inside it too, so I can "navigate" through all the hierarchy of Copied Parts. Since Property Manager allows this within the assembly, without opening any aditional part, I was wondering if it was possible by the API too.


Thanks for the help!

Re: Accessing a Copied Part document from the assembly

If you only need to access text properties, then have a look at the File Properties type library in the SE SDK, which gives you access to the file properties without opening the document in SE!!

Re: Accessing a Copied Part document from the assembly

Wow, that's truly nice. I will test that this week as soon as possible.


However, if I have a Copied Part of a Copied Part, I can't get access to the second one, since I would need the document of the first one to gain access to the CopiedParts Collection and ...


Sounds weird, but we use a lot nested hierarchy of copied parts for sprockets, gears and so (i. e. if two of them are mechanized nearly the same way but not 100%). I need to go over the whole hierarchy (at most two steps, most of the time) until getting to the last link, which holds the normalized element I need to keep track of.


Since the assembly environment seems capable of reaching that hierarchy, I would love to mimic that from the API.


Thanks for your answers, it was really useful.

Re: Accessing a Copied Part document from the assembly

You can open the occurrence document in RevisionManager to get its linked document names:

Sub ShowLinkedDocs(ByVal objDoc As RevisionManager.Document, Optional ByVal indent As Integer = 2)
  Dim objLinkedDocs As RevisionManager.LinkedDocuments = objDoc.LinkedDocuments(RevisionManager.LinkTypeConstants.seLinkTypeNormal)
  For Each objLinkDoc As RevisionManager.Document In objLinkedDocs
    Console.WriteLine("{0}LinkedDoc:  {1}", New String(" ", indent), objLinkDoc.FullName)
    ShowLinkedDocs(objLinkDoc, indent + 2)
End Sub

' ASM/REVMGR: Show nested links of first part occurrence
Dim objAsmDoc As AssemblyDocument = objApp.ActiveDocument
' Get the reference to the cavity occurrence
Dim objOcc As Occurrence = objAsmDoc.Occurrences.Item(1)
Dim strFileName As String = objOcc.OccurrenceFileName

Dim objRevMgr As RevisionManager.Application = Nothing
  objRevMgr = New RevisionManager.Application()
  If objRevMgr Is Nothing Then
    MessageBox.Show("ERROR: could not start Revision Manager.")
    Exit Sub
  End If
  objRevMgr.Visible = False

  ' Open the top level assembly
  Console.WriteLine("Occurrence:  {0}", strFileName)
  Dim objDoc As RevisionManager.Document = objRevMgr.Open(strFileName)
Catch ex As Exception
  Dim msg As String = String.Format("EXCEPTION: {0}", ex.Message)
End Try
If objRevMgr IsNot Nothing Then
End If


Re: Accessing a Copied Part document from the assembly

Much thanks! Working into the revision manager seems the fastest way to get access to all links.


In fact I can get access to the links simply opening the parts in their environment, although is a bit slow. The limitation is that SE seems to fail opening certain parts (no idea why, I posted it in thie forum too) so my worries are that they will fail when opening them into Revision Manager too.


Seems a bit weird having to launch another app for getting that info, while the Property Manager its capable to collect it within the assembly/part environment. Anyway, I will try it in depth this weekend.

Re: Accessing a Copied Part document from the assembly

[ Edited ]



I am aslo facing the same issue.

Incase of copied parts , we are unable to get the SE document. Due to this we are opening the corresponding part/sub assembly to access the info of  it. With this there is lot of performance issue coming into the picture.


Could you please tell, If you find any alternate solution for this issue ?




Re: Accessing a Copied Part document from the assembly

You cannot get the SE Document from a PartCopy, as it does NOT get opened in SE as any other part. In order to get information from it, YOU have to open it manually (or via API).


What type of information are you going to read from these documents?

If you store your information in Custom properties, you can acces this info very fast through the FileProperties API without opening the whole document in SE.