How to save as this iam to another folder and rename every file include substitute modelstate file?

How to save as this iam to another folder and rename every file include substitute modelstate file?

Stakin
Collaborator Collaborator
161 Views
1 Reply
Message 1 of 2

How to save as this iam to another folder and rename every file include substitute modelstate file?

Stakin
Collaborator
Collaborator

This assembly ("test-00-00.iam") has a occurrence named "test.iam" ,the "test.iam" has two substitute modelstates,how to save it as a new assembly,and rename every file with suffix of "_Ver0"? And replace the reference file of the substitute file.

thanks

By now, i only got so far as below: it will break at a substitute modelstate Assembly.

0 Likes
Accepted solutions (1)
162 Views
1 Reply
Reply (1)
Message 2 of 2

Stakin
Collaborator
Collaborator
Accepted solution

solved. 

First ,save as each occurrence to new folder with new name and replace with new file.(if the occurrence has substitute modelstate, must open it in master modelstate.  )

and then Save derived file "oDerivedFile" to "oNewDerivedFile",and then the replace "oNewDerivedFile"  derived source reference file with "oDestFile":("oDestFile"  has saved to new folder before replacing)

oDerivedFile.ComponentDefinition.ReferenceComponents.DerivedAssemblyComponents.Item(1).ReferencedDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference(oDestFileName)

and then Replace the modelstate substitute reference file with "oNewDerivedFile"

oModelState.SubstituteDocumentDescriptor.ReferencedFileDescriptor.ReplaceReference(oNewDerivedFileName)