Message 1 of 7
iLogic-Can't Copy and save an Assembly under the same name as a deleted Assembly

Not applicable
12-10-2019
06:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
The title is a little complicated so let me try and simplify. I'm using iLogic to create a wall builder. Currently I am trying to copy an assembly of a door from another location to my wall file. It worked once, but I deleted the door file and tried to recreate it and it gives me this error
It works for a unique name but if I delete the door file from the wall file, I can't recopy the file under the same name.
Here's my code.
Dim oDoc As AssemblyDocument oDoc = ThisApplication.ActiveDocument Dim oDef As AssemblyComponentDefinition oDef = oDoc.ComponentDefinition '--------------------------------------------------------------------------------------------------------- Dim oOcc As ComponentOccurrence Dim Dcounter As Integer Dcounter = 0 For Each oOcc In oDoc.ComponentDefinition.Occurrences If oOcc.Name.Contains("DOOR") Then Dcounter = Dcounter + 1 End If Next Dim nextdoor As Integer nextdoor = Dcounter + 1 Dim nextdoorname As String nextdoorname = "DOOR" & nextdoor Dim DocPath As String DocPath = ThisDoc.Path & "\" Dim DoorPath As String DoorPath = "Z:\DRAWINGS\INVENTOR MODELS\2000-XXXXX (KITS, WEDLEMNTS)\29XX-XXXXX FR\DOOR\DOOR MAKER.iam" Dim NewDoorPath As String NewDoorPath = DocPath & nextdoorname & ".iam" Dim oDoorDoc As AssemblyDocument Try Try oDoorDoc = ThisApplication.Documents.Open(DoorPath, False) Catch MessageBox.Show("Could not find " & DoorPath) End Try Try oDoorDoc.SaveAs(NewDoorPath, True) oDoorDoc.Close Catch ex As Exception MessageBox.Show(ex.ToString()) MessageBox.Show("COULD NOT COPY") End Try Catch MessageBox.Show("Failed") End Try