Preview image

Preview image

Anonymous
Not applicable
438 Views
4 Replies
Message 1 of 5

Preview image

Anonymous
Not applicable
Can I use a macro in excel to reach the preview image stock with each inventor part?
0 Likes
439 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Take a look at the iProps Excel program on my site for a example.

http://www.mymcad.com/KWiK/iCode/icode.htm



--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Nihiliste" wrote in message news:f181d1b.-1@WebX.maYIadrTaRb...
> Can I use a macro in excel to reach the preview image stock with each inventor part?
0 Likes
Message 3 of 5

Anonymous
Not applicable
Download and install the BOMxTractor from cbliss.com. Once installed,
you will see a FilePreview.dll file. Run the BomXtractor program and
allow it to create a Spread Sheet. Open the macros section of the
spread sheet and look at the code. If you copy that code and the button
to run it into other spread sheets, you should have what you need. If
you want to distribute to other PC's you will need to register the
FilePreviw.dll and, I think DSOFile.dll on that other PC's. This should
allow you to view all versions of Inventor files which have Preview images.

Nihiliste wrote:

> Can I use a macro in excel to reach the preview image stock with each
> inventor part?
0 Likes
Message 4 of 5

robmatthews
Collaborator
Collaborator
If anyone is looking for something like this:

Sub ShowFilePreview()
Dim FileName As String
Dim ChosenFile As String
'Declare the Apprentice object
Dim oApprentice As New ApprenticeServerComponent
' Open a document using Apprentice
Dim oApprenticeDoc As ApprenticeServerDocument
'Dim Filename As String
ChosenFile = Cells(ActiveCell.Row, ActiveCell.Column).Value
'enter YOUR working folder here, and filename masks as necessary
FileName = Dir("c:\InventorWork\" & Cells(ActiveCell.Row, ActiveCell.Column).Value & "*.*")
If Len(FileName) > 0 Then
Set oApprenticeDoc = oApprentice.Open("c:\InventorWork\" & FileName)
FilePreview.Image1.Picture = oApprenticeDoc.PropertySets.Item("Inventor Summary Information").ItemByPropId(kThumbnailSummaryInformation).Value
FilePreview.Caption = "Preview: " & FileName
FilePreview.Show
End If
oApprentice.Close
Set oApprenticeDoc = Nothing
Set oApprentice = Nothing
End Sub

You'll also need a form called "FilePreview", with an image sized to suit you, called image1. I set the onclick of the image to "unload me", and created a cancel button, as well as an "open button", with code:

Private Sub OpenPreviewedFile_Click()
Dim FileName As String
FileName = "C:\InventorWork\" & mid(FilePreview.Caption, 10,100)
Unload Me
OpenInvFile (FileName)
End Sub


Hope this helps someone out there.
(works on IV9, not tested beyond that... ie not 10, not 11, not 2008 or 2009... We're well behind, hey?)
=============================================
This is my signature, not part of my post.
0 Likes
Message 5 of 5

Anonymous
Not applicable

hi Charles Can you send the macros in an excel file?

0 Likes