Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

iLogic to Automate Duplicate Part Search

estringer
Advocate

iLogic to Automate Duplicate Part Search

estringer
Advocate
Advocate

I had asked this question on the forum in 2021 and was wondering if anything has been added for this functionality or if anyone has any cool ideas?

 

"I was wondering if anyone knows of any iLogic/code to automate the duplicate part search function within Inventor? I would like to be able to set it up so that Assemblies are opened up and then the search can be run against them automatically."

0 Likes
Reply
720 Views
6 Replies
Replies (6)

bradeneuropeArthur
Mentor
Mentor
you mean if a part (file) is more than one time used in an assembly, correct?

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

estringer
Advocate
Advocate

Inventor and Vault have the Duplicate Part search that looks through indexed files within Vault to see if a similar or exact match already exists within Vault. Is there an iLogic function that allows this to happen through the use of an Event trigger or through other code?

0 Likes

Cadkunde.nl
Collaborator
Collaborator

If I am correct. Vault duplicate search is searching filenames that are identical in different folders.

 

Here is a solution to find duplicates in your assembly with ilogic:

 

Dim AsmDoc As AssemblyDocument = ThisDoc.Document

Dim List_Dir As New List(Of String)
Dim List_Files As New List(Of String)

For Each odoc As Document In AsmDoc.AllReferencedDocuments
	Dim dir As String = System.IO.Path.GetDirectoryName(odoc.FullFileName)
	Dim filename As String = System.IO.Path.GetFileName(odoc.FullFileName)
	List_Dir.Add(dir)
	List_Files.Add(filename)
Next

If List_Files.Count > 0 Then
	For i = 0 To List_Files.Count - 1
		For j = 0 To List_Files.Count - 1
			If Not i = j Then
				If List_Files(i) = List_Files(j) Then
					MsgBox("Found duplicate for:" & List_Files(i) & vbLf & List_Dir(i) & "\" & List_Files(i) & vbLf & List_Dir(j) & "\" & List_Files(j))
				End If
			End If
		Next
	Next
End If
	

I am sure that there is better way to search in the Lists to find duplicates from programming point of view.

But for a user, this works.

0 Likes

LukeDavenport
Collaborator
Collaborator

Hi estringer,

I think the previous responses might have misunderstood your question. The Vault duplicate search as I understand it looks through all the files (that have been indexed for duplicates) in the Vault to find files that have duplicate geometry to each other, not duplicate file names. It also allows you to search Vault for any parts with geometry matching a part file in the active Inventor assembly, so that you can replace a component in the active assembly with the matching one in Vault, and therefore not add another duplicate to Vault upon check in and gunk up your Vault with duplicates.

 

So to address your question - yes you can run the command in an assembly with the below single line of code. You can also pre-select a component (using code or manually) and then run the code below.

 

ThisApplication.CommandManager.ControlDefinitions.Item("VaultFindDuplicates").Execute

However all this will do is open the Find Duplicates form. You'll need to then select what you want to do. Run a search / replace one / replace all, etc.

 

If you want a more automated approach:

 

If you're expecting a lot of duplicate parts in your Inventor assemblies (and I see that you are working with curtain walls, so you definitely will :-)) - then you may want to consider a ready-made solution for replacing all  the duplicate parts in your Inventor assemblies before you involve Vault. It's an Inventor addin called The Duplicate Replacer and as well as duplicate component replacement (for the entire assembly in one operation if desired) it also allows Part Number iProperty replacement if you only care about BOM merging of parts with identical geometry.

 

Video on the app:

https://youtu.be/sbFZaeBHehY

 

Email:

info@ldcadsolutions.co.uk

 

Full disclosure - I'm the developer, so enormously biased 🙂

Luke

 

 

 

0 Likes

estringer
Advocate
Advocate

@LukeDavenport ,

Thank you for your response. Yes, we do have a lot of duplicate parts in curtain wall! We have a proprietary system that works between Inventor and Vault to look for duplicate parts within Vault and replace parts in the assembly or create a new one in Vault if there is not a match. We are running into an error rate that we have been trying to figure out why or figure out a cleanup method. We have been manually running the Duplicate Part Search function after this system but I am hoping to find a way to automate that part of the process.

 

I have watched the video on your application and think it is a cool system!

0 Likes

LukeDavenport
Collaborator
Collaborator

@estringer thanks!

Good luck with catching the bugs!

0 Likes