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: 

Code for looking for missing drawings

3 REPLIES 3
Reply
Message 1 of 4
felix.bouchard
210 Views, 3 Replies

Code for looking for missing drawings

Hi, i would like a code that can check if every parts and assemblies contained i a main assembly have a drawing linked to it. 

 

I would like every content center parts to be excluded. 

 

i need to look in this folder C:\3D Novathermboiler LOCAL

 

Thanks.

3 REPLIES 3
Message 2 of 4

Hi @felix.bouchard ,

 

Here is an example that will report which drawings exists for the models in the active assembly file.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 
Dim NoDrawingList As String
Dim HasDrawingList As String

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then Exit Sub

For Each xDoc As Document In oDoc.AllReferencedDocuments

	oPath = IO.Path.GetDirectoryName(xDoc.FullFileName)
	oModelName = IO.Path.GetFileName(xDoc.FullFileName)
	oName = IO.Path.GetFileNameWithoutExtension(xDoc.FullFileName) & ".idw"
	oDrawingFilePath = oPath & "\" & oName

	If System.IO.File.Exists(oDrawingFilePath) = True Then
		HasDrawingList = HasDrawingList & vbLf & oModelName
	Else
		NoDrawingList = NoDrawingList & vbLf & oModelName
	End If
Next

MsgBox("has drawing:" & vbLf & HasDrawingList & vbLf & vbLf & "has NO drawing:" & vbLf & NoDrawingList, , "iLogic")

 

Message 3 of 4

This is great, is there a way to exclude the content center parts?

Thanks.

Message 4 of 4

Hi @felix.bouchard ,

 

ooops! I thought I had that in there. ( I wrote this using a different method at first and then changed my mind and apparently dropped the CC line in doing so).

 

Give this a try ( note, I didn't test it just now, so post back it this doesn't work).

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim NoDrawingList As String
Dim HasDrawingList As String

Dim oDoc As Document = ThisApplication.ActiveDocument
If oDoc.DocumentType <> DocumentTypeEnum.kAssemblyDocumentObject Then Exit Sub

For Each xDoc As Document In oDoc.AllReferencedDocuments
	If xDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
		If xDoc.ComponentDefinition.IsContentMember = True Then Continue For
	End If

	oPath = IO.Path.GetDirectoryName(xDoc.FullFileName)
	oModelName = IO.Path.GetFileName(xDoc.FullFileName)
	oName = IO.Path.GetFileNameWithoutExtension(xDoc.FullFileName) & ".idw"
	oDrawingFilePath = oPath & "\" & oName

	If System.IO.File.Exists(oDrawingFilePath) = True Then
		HasDrawingList = HasDrawingList & vbLf & oModelName
	Else
		NoDrawingList = NoDrawingList & vbLf & oModelName
	End If
Next

MsgBox("has drawing:" & vbLf & HasDrawingList & vbLf & vbLf & "has NO drawing:" & vbLf & NoDrawingList, , "iLogic")

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

Post to forums  

Autodesk Design & Make Report