Announcements
Notice: Upload of PDF documents is currently unavailable across the Community due to an ongoing issue.

Code for looking for missing drawings

Code for looking for missing drawings

felix.bouchard
Contributor Contributor
479 Views
3 Replies
Message 1 of 4

Code for looking for missing drawings

felix.bouchard
Contributor
Contributor

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.

0 Likes
480 Views
3 Replies
Replies (3)
Message 2 of 4

Curtis_W
Consultant
Consultant

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")

 

 EESignature

0 Likes
Message 3 of 4

felix.bouchard
Contributor
Contributor

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

Thanks.

0 Likes
Message 4 of 4

Curtis_W
Consultant
Consultant

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")

 EESignature

0 Likes