Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

The database in < LODFactoryRep> could not be saved

0 REPLIES 0
Reply
Message 1 of 1
Matthew_Policelli
126 Views, 0 Replies

The database in < LODFactoryRep> could not be saved

Edit: I just found this: Autodesk Support Article, but I wonder if there is a resolution for this yet or anything code-wise I could do to prevent the error

 

I am trying to create an iLogic to delete old model states that were migrated over from Levels of Detail that were present on a template my company used years ago. My plan is to put this in the Before Save event trigger, however while testing it I get this error:

Matthew_Policelli_0-1687195151968.png

 

I should note that my testing involves creating a new document, adding the Model State with the name from the old template, and trying to save to see if it conflicts with other Before Save iLogics we use. So I am not 100% sure this would happen outside of a testing scenario. Regardless, it does cause a crash so I'd like to figure out how to deal with it.

 

A couple other notes:

- The goal of this iLogic rule is to help clean up unnecessary/unused model states to reduce file size during the course of regular document editing, without requiring users to check out anything they are not already working on.

- I originally wanted to put the code in the Open Document trigger. However, doing so would add the steps of checking that the document is the active document (and not subassemblies that the user is not editing) can be checked out/edited by the user, which for some large assemblies seems to cause a large slowdown when opening. Therefore I decided that Before Save would be better as it would only effect the assemblies the user is actively editing.

 

Here  is my code:

 

Dim ListOfOldModelStates As New List(Of String) From {"Low", "Medium", "Client Request", "Cabinet shop detail" }	'list of old template levels of detail that would have become model states after migration

Dim FoundList As List(Of ModelState) = ThisAssembly.Document.ComponentDefinition.ModelStates.Cast(Of ModelState).Where(Function(m) ListOfOldModelStates.Any(Function(x) x = m.Name)).ToList

If FoundList.Count >= 1 Then
	For Each oMS As ModelState In FoundList
		Try
			oMS.Delete
		Catch
			MessageBox.Show("Could Not Delete " & oMS.Name)
		End Try
	Next
End If

 

0 REPLIES 0

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report