Message 1 of 1
Content center inserting same part for different parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I've encountered a problem with Content Center, i wanted to add with Ilogic 4parts from content center It's a simple rope and the only difference is length
After i insert sling with Wire_Diameter X the length just stays as the previous was.
I found out you can remove Content Center cache files but if i do it in Ilogic the first part inserts fine but second time i get an error
After i close and open assembly it works again.
Here's the code i've tried to make
Sub Main() RemoveCache("Sling With Thimble") Dim Sling_wire_Ø24_MBL_4Pos = ThisAssembly.Geometry.Point(-695.404364, 1145.249467, 177.144171) Dim Sling_wire_Ø24_MBL_4 = Components.AddCustomContentCenterPart("Sling wire Ø24 MBL 41T:1", "Gleipnir Standard Parts:Slings", "Sling With Thimble", {"D_", "70", "Wire_Diameter", "24"}, {"L_", "5000 mm"}, asCustom := False, position := Sling_wire_Ø24_MBL_4Pos) RemoveCache("Sling With Thimble") Dim Sling_wire_Ø24_MBL_4_0Pos = ThisAssembly.Geometry.Point(-1049.873622, 1350.027514, 278.837454) Dim Sling_wire_Ø24_MBL_4_0 = Components.AddCustomContentCenterPart("Sling wire Ø24 MBL 41T:2", "Gleipnir Standard Parts:Slings", "Sling With Thimble", {"D_", "70", "Wire_Diameter", "24"}, {"L_", "3000 mm"}, asCustom := False, position := Sling_wire_Ø24_MBL_4_0Pos) End Sub Sub RemoveCache(folder As String) ' iLogic rule to delete a specific folder Dim folderPath As String = "D:\Documents\en-US\" & folder If System.IO.Directory.Exists(folderPath) Then Try Dim files As String() = System.IO.Directory.GetFiles(folderPath) For Each filePath As String In files System.IO.File.Delete(filePath) Next MessageBox.Show("All files deleted in folder: " & folderPath, "Success") Catch ex As Exception MessageBox.Show("Error deleting files: " & ex.Message, "Error") End Try Else MessageBox.Show("Folder does not exist: " & folderPath, "Info") End If End Sub
Sub Main() ' Ensure we’re working with an assembly Dim doc As AssemblyDocument = TryCast(ThisApplication.ActiveDocument, AssemblyDocument) If doc Is Nothing Then MessageBox.Show("This rule only works on assembly documents.", "Error") Exit Sub End If ' Get full file path for reload Dim filePath As String = doc.FullFileName If String.IsNullOrEmpty(filePath) Then MessageBox.Show("Please save the assembly before running this rule.", "Error") Exit Sub End If ' Remove content center cache before first insert RemoveCache("Sling With Thimble") ' Insert first part Dim Sling_wire_Ø24_MBL_4Pos = ThisAssembly.Geometry.Point(-695.404364, 1145.249467, 177.144171) Dim Sling_wire_Ø24_MBL_4 = Components.AddCustomContentCenterPart("Sling wire Ø24 MBL 41T:1", "Gleipnir Standard Parts:Slings", "Sling With Thimble", {"D_", "70", "Wire_Diameter", "24"}, {"L_", "5000 mm"}, asCustom := False, position := Sling_wire_Ø24_MBL_4Pos) ' Remove cache again before second insert RemoveCache("Sling With Thimble") Dim Sling_wire_Ø24_MBL_4_0Pos = ThisAssembly.Geometry.Point(-1049.873622, 1350.027514, 278.837454) Dim Sling_wire_Ø24_MBL_4_0 = Components.AddCustomContentCenterPart("Sling wire Ø24 MBL 41T:2", "Gleipnir Standard Parts:Slings", "Sling With Thimble", {"D_", "70", "Wire_Diameter", "24"}, {"L_", "3000 mm"}, asCustom := False, position := Sling_wire_Ø24_MBL_4_0Pos) ' Save, close and reopen the assembly doc.Save() doc.Close(True) ThisApplication.Documents.Open(filePath, True) End Sub Sub RemoveCache(folder As String) Dim folderPath As String = "D:\Documents\en-US\" & folder If System.IO.Directory.Exists(folderPath) Then Try Dim files = System.IO.Directory.GetFiles(folderPath) For Each filePath As String In files System.IO.File.Delete(filePath) Next Catch ex As Exception MessageBox.Show("Error deleting cache files: " & ex.Message, "Cache Error") End Try End If End Sub
Does someone know how to work around this issue? It would make things easier for me.
Thanks for all the answers in advance 😄