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: 

Check whether the file names of the drawings are consistent

3 REPLIES 3
Reply
Message 1 of 4
fanxh
126 Views, 3 Replies

Check whether the file names of the drawings are consistent

fanxh
Contributor
Contributor

Hi, I have a question for the experts.

About using the ilogic to automatically check the file name. 

Check whether the file name of the drawings are consistent with the iProperty name of part.

See the figure below for details

 

0 Likes

Check whether the file names of the drawings are consistent

Hi, I have a question for the experts.

About using the ilogic to automatically check the file name. 

Check whether the file name of the drawings are consistent with the iProperty name of part.

See the figure below for details

 

3 REPLIES 3
Message 2 of 4
fanxh
in reply to: fanxh

fanxh
Contributor
Contributor

To further explain, because we have a lot of drawings and expect each drawing to be automatically checked.

0 Likes

To further explain, because we have a lot of drawings and expect each drawing to be automatically checked.

Message 3 of 4
JelteDeJong
in reply to: fanxh

JelteDeJong
Mentor
Mentor

I expect that this is what you are looking for:

Dim doc As DrawingDocument = ThisDoc.Document
Dim sheet As Sheet = doc.Sheets.Item(1)
Dim firstView As DrawingView = sheet.DrawingViews.Item(1)
Dim refDoc As PartDocument = firstView.ReferencedDocumentDescriptor.ReferencedDocument

Dim docFileName = System.IO.Path.GetFileNameWithoutExtension(doc.FullFileName)
Dim refDocFileName = System.IO.Path.GetFileNameWithoutExtension(refDoc.FullFileName)

If (docFileName <> refDocFileName) Then
    MsgBox(String.Format("Drawing filename {0} is not the same as {1}", docFileName, refDocFileName))
End If

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes

I expect that this is what you are looking for:

Dim doc As DrawingDocument = ThisDoc.Document
Dim sheet As Sheet = doc.Sheets.Item(1)
Dim firstView As DrawingView = sheet.DrawingViews.Item(1)
Dim refDoc As PartDocument = firstView.ReferencedDocumentDescriptor.ReferencedDocument

Dim docFileName = System.IO.Path.GetFileNameWithoutExtension(doc.FullFileName)
Dim refDocFileName = System.IO.Path.GetFileNameWithoutExtension(refDoc.FullFileName)

If (docFileName <> refDocFileName) Then
    MsgBox(String.Format("Drawing filename {0} is not the same as {1}", docFileName, refDocFileName))
End If

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 4 of 4
adk
Explorer
in reply to: JelteDeJong

adk
Explorer
Explorer

Thank you for your reply. I'll test this ilogic rule.

0 Likes

Thank you for your reply. I'll test this ilogic rule.

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

Post to forums  

Autodesk Design & Make Report