on the inventor 2013 64bit(vba6) , there was no problem.
But on the inventor 2014 64bit(vba7) , there is a problem.
An error occurs.
private sub xx()
Dim oApprentice As New ApprenticeServerComponent
Dim oDoc As ApprenticeServerDocument
Set oDoc = oApprentice.Open("C:\Test\Assembly\A1\A1.iam")
debug.print oDoc.AllReferencedDocuments.count
end sub
i am seeing a brand new error in 2014 as well, that has been fine before now.
it has been seen to happen on a line like i see in yours as well: Set oDoc = oApprentice....
the error info i see is:
runtime error 445
object doesn't support this action
i will be looking further into it tonight and let you know what happens.
looking in the API window in debug mode, i set a break point before the error arises.
now, looking within the object variable i can see some issues now that i have not encountered before now. see snapshot showing values of the returned properties...
so, it makes sense that we would then get an error when running our macro since there is already an issue in the information that it will need to assign to the variable we are using!
i don't know why this is happening now. i did a google search on this and didn't find anyone talking about it but i did see a note on mod the machine that they are now saying to NOT USE APPRENTICE in API WITH A RUNNING INSTANCE OF INVENTOR PROCESS (or words to that effect).
i was not aware of this before. i don't know if it has aything to do with what we are now seeing.
This because after VBA7 is integrated, the VBA editor is in the same process with Inventor. Most of the functions of Apprentice are not worked when it’s in the same process of Inventor.
You can use the VBA7 of Excel (Tools> Reference> add Autodesk Inventor Object Library) to run below VBA code.
Sorry, Microsoft Excel is just a tool example which uses VBA out-process of Inventor. You can use any other tools which can run VBA. Or use VB directly.
Yes, we don't need change code, just make sure use Apprentice with the out-process tools (as Inventor32bitHost.exe for VBA of Inevntor 2013 on 64bit).
thanks Jar Fu,
i think maybe i will try to use the inventor intstead of calling apprentice. especially now that it is integrate. generally speaking i now find that most of the macros seem to work much better now than in 2013 & previous.
thanks.