Saveas ComponentOccurrence and rename

Saveas ComponentOccurrence and rename

Anonymous
Not applicable
648 Views
2 Replies
Message 1 of 3

Saveas ComponentOccurrence and rename

Anonymous
Not applicable

 

 //get the active assembly document
AssemblyDocument oAssemDoc = (AssemblyDocument)mApp.ActiveDocument;

 //get the assembly component definition
AssemblyComponentDefinition oAssemDef = oAssemDoc.ComponentDefinition;

//get the assembly occurrences
ComponentOccurrences oCompOccs = oAssemDef.Occurrences;


foreach (ComponentOccurrence part in oCompOccs)
{
MessageBox.Show(part.Name);

How can I saveas part ?

How can I rename part ?

}

 

0 Likes
Accepted solutions (1)
649 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

I try for getting part saved path with

 

 part.OccurrencePath.ToString();

but returning "System.__ComObject" . How can I get saved path for part.

0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution
//get the active assembly document
AssemblyDocument oAssemDoc = (AssemblyDocument)mApp.ActiveDocument;

//get the assembly component definition
AssemblyComponentDefinition oAssemDef = oAssemDoc.ComponentDefinition;

//get the assembly occurrences
ComponentOccurrences oCompOccs = oAssemDef.Occurrences;


foreach (ComponentOccurrence part in oCompOccs)
                {
                    if (part.DefinitionDocumentType == Inventor.DocumentTypeEnum.kPartDocumentObject)
                    {

                        Object obj = part;
                        if (obj is ComponentOccurrence)
                        {
                            ComponentOccurrence occ;
                            occ = (ComponentOccurrence)obj;
                            MessageBox.Show(occ.Definition.Document.FullFileName);
                        }

                    }
                }
0 Likes