SaveAs iLogic in sub-assemblies within a top-level assy

SaveAs iLogic in sub-assemblies within a top-level assy

D.Wheeler3GADA
Advocate Advocate
164 Views
1 Reply
Message 1 of 2

SaveAs iLogic in sub-assemblies within a top-level assy

D.Wheeler3GADA
Advocate
Advocate

Greetings,

        I am trying to write iLogic for an external rule that sizes a read-only generic sub-assy within a top-level assembly and then saves it out as a project level sub-assembly to the file location of the top-level assy it is placed in using the "project" iProperty and adding it as a prefix to the filename, then replacing the generic version in the top-level assembly with the new project specific sub-assembly. 

        I have all the coding working to size the sub-assembly. The code is even working correctly as far as pulling and adding the project specific prefix. My error resides in the ilogic to save the "resized, project specific" assembly out to the new location and replace the generic version in the top-level assy...

 

Once I have that issue fixed, I'd like to be able to add a numerical suffix to the project specific part number to distinguish it from other sub-assemblies of the same name (all though they could end up being identical sub-assemblies, the desire is to distinguish each instance separately for tracking). I have been gifted coding to do this alphabetically, but I'd like to use 2-digit numbers in this case (i.e. 01 02 03 ...etc)

 

Any help, guidance, tips or ideas are greatly appreciated as always! 

0 Likes
165 Views
1 Reply
Reply (1)
Message 2 of 2

dalton98
Collaborator
Collaborator

I don't quite understand what you are trying to do. Could you provide code and pictures? As far as Save/As and replacing components this can be done with ilogic.

Dim oAss As AssemblyDocument
oAss = ThisApplication.ActiveDocument
oAss.SaveAs("C:\temp\project\RevisedAss.iam", True)

Dim oRevisedAss As AssemblyDocument
oRevisedAss = ThisApplication.Documents.Open("C:\temp\project\RevisedAss.iam", False)
oRevisedAss.ComponentDefinition.Occurrences.Item("Sub-Ass generic:1").Replace("C:/project/NewSubAssembly.iam", True)
oRevisedAss.Close()
0 Likes