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: 

Opening an Assembly to update and save

4 REPLIES 4
Reply
Message 1 of 5
Anonymous
250 Views, 4 Replies

Opening an Assembly to update and save

I created a master excel spreadsheet to get around the i-assembly issue,
fake parts and excel driven/linked BOMs. (Thanks for the nice tuts Sean),
but now I have a problem working with the Inventor API.

My VB6 program updates a few spreadsheets, but now I need to update the
master assembly before opening the drawings for printing.


I've tried a few ways to open and update an assembly, but to no avail.

Private Sub Command1_Click()
Dim oAssyDoc As Inventor.AssemblyDocument
Set oAssyDoc = GetObject("J:\...\...\...\...\...\...\...\ASSY.iam")
oAssyDoc.Update
oAssyDoc.Save
oAssyDoc.Close
End Sub

Error: Run-time Error '7' - Out of Memory on the Second Line


I hate to ask for debug help...but what am I missing?
The file I'm opening is but 250k, but it has links to many parts that need
to update from the excel change.

Should there also be some reference to a project, or can I only use the
current project that Inventor was closed with?

Thanks,

-af
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: Anonymous

The problem is using the GetObject function to open the document. Replace
the call to GetObject with something like....

Dim myApp As Inventor.Application

Set myApp = GetObject(, "Inventor.Application")
myApp.Open "yourfile.iam", True
Set oAssyDoc = myApp.ActiveDocument

No error checking so be careful....
rw

"It's not the modeler mate, It's how you use it"

"A.Fickes" wrote in message
news:D8421E11EF14BF48430285E6F5F736BF@in.WebX.maYIadrTaRb...
> I created a master excel spreadsheet to get around the i-assembly issue,
> fake parts and excel driven/linked BOMs. (Thanks for the nice tuts Sean),
> but now I have a problem working with the Inventor API.
>
> My VB6 program updates a few spreadsheets, but now I need to update the
> master assembly before opening the drawings for printing.
>
>
> I've tried a few ways to open and update an assembly, but to no avail.
>
> Private Sub Command1_Click()
> Dim oAssyDoc As Inventor.AssemblyDocument
> Set oAssyDoc = GetObject("J:\...\...\...\...\...\...\...\ASSY.iam")
> oAssyDoc.Update
> oAssyDoc.Save
> oAssyDoc.Close
> End Sub
>
> Error: Run-time Error '7' - Out of Memory on the Second Line
>
>
> I hate to ask for debug help...but what am I missing?
> The file I'm opening is but 250k, but it has links to many parts that need
> to update from the excel change.
>
> Should there also be some reference to a project, or can I only use the
> current project that Inventor was closed with?
>
> Thanks,
>
> -af
>
>
Message 3 of 5
Anonymous
in reply to: Anonymous

I input the code:

Private Sub Command1_Click()

Dim oAssyDoc As Inventor.AssemblyDocument
Dim InvApp As Inventor.Application
Set InvApp = GetObject(, "Inventor.Application")
InvApp.Open "J:\ASSY.iam", True
Set oAssyDoc = InvApp.ActiveDocument
oAssyDoc.Update
oAssyDoc.Save
oAssyDoc.Close

End Sub

but now I get the error on line 3
------
Run-time error '429'

ActiveX component can't create object
----------

Am I missing Project References?

I am using:

Visual Basic For Applications
Visual Basic runtime objects and procedures
Visual Basic objects and procedures
OLE Automation
Autodesk Inventor Object Library


"Rob W." wrote in message
news:444180BBDD589C153EC7FEC3BF02D106@in.WebX.maYIadrTaRb...
> The problem is using the GetObject function to open the document. Replace
> the call to GetObject with something like....
>
> Dim myApp As Inventor.Application
>
> Set myApp = GetObject(, "Inventor.Application")
> myApp.Open "yourfile.iam", True
> Set oAssyDoc = myApp.ActiveDocument
>
> No error checking so be careful....
> rw
>
> "It's not the modeler mate, It's how you use it"
>
> "A.Fickes" wrote in message
> news:D8421E11EF14BF48430285E6F5F736BF@in.WebX.maYIadrTaRb...
> > I created a master excel spreadsheet to get around the i-assembly issue,
> > fake parts and excel driven/linked BOMs. (Thanks for the nice tuts
Sean),
> > but now I have a problem working with the Inventor API.
> >
> > My VB6 program updates a few spreadsheets, but now I need to update the
> > master assembly before opening the drawings for printing.
> >
> >
> > I've tried a few ways to open and update an assembly, but to no avail.
> >
> > Private Sub Command1_Click()
> > Dim oAssyDoc As Inventor.AssemblyDocument
> > Set oAssyDoc = GetObject("J:\...\...\...\...\...\...\...\ASSY.iam")
> > oAssyDoc.Update
> > oAssyDoc.Save
> > oAssyDoc.Close
> > End Sub
> >
> > Error: Run-time Error '7' - Out of Memory on the Second Line
> >
> >
> > I hate to ask for debug help...but what am I missing?
> > The file I'm opening is but 250k, but it has links to many parts that
need
> > to update from the excel change.
> >
> > Should there also be some reference to a project, or can I only use the
> > current project that Inventor was closed with?
> >
> > Thanks,
> >
> > -af
> >
> >
>
>
Message 4 of 5
Anonymous
in reply to: Anonymous

Well .. After some keyboard damage I figured it out ..

I need to have Inventor running in the backgound.

I guess the bigger question is: How do I launch inventor -
Inventor.Application.Visible(False)
from my program that is the only thing running? so that when I save it says
ok to the dialog box?



"A.Fickes" wrote in message
news:816DD4544D5A0C49EE3C8865221C51C2@in.WebX.maYIadrTaRb...
> I input the code:
>
> Private Sub Command1_Click()
>
> Dim oAssyDoc As Inventor.AssemblyDocument
> Dim InvApp As Inventor.Application
> Set InvApp = GetObject(, "Inventor.Application")
> InvApp.Open "J:\ASSY.iam", True
> Set oAssyDoc = InvApp.ActiveDocument
> oAssyDoc.Update
> oAssyDoc.Save
> oAssyDoc.Close
>
> End Sub
>
> but now I get the error on line 3
> ------
> Run-time error '429'
>
> ActiveX component can't create object
> ----------
>
> Am I missing Project References?
>
> I am using:
>
> Visual Basic For Applications
> Visual Basic runtime objects and procedures
> Visual Basic objects and procedures
> OLE Automation
> Autodesk Inventor Object Library
>
>
> "Rob W." wrote in message
> news:444180BBDD589C153EC7FEC3BF02D106@in.WebX.maYIadrTaRb...
> > The problem is using the GetObject function to open the document.
Replace
> > the call to GetObject with something like....
> >
> > Dim myApp As Inventor.Application
> >
> > Set myApp = GetObject(, "Inventor.Application")
> > myApp.Open "yourfile.iam", True
> > Set oAssyDoc = myApp.ActiveDocument
> >
> > No error checking so be careful....
> > rw
> >
> > "It's not the modeler mate, It's how you use it"
> >
> > "A.Fickes" wrote in message
> > news:D8421E11EF14BF48430285E6F5F736BF@in.WebX.maYIadrTaRb...
> > > I created a master excel spreadsheet to get around the i-assembly
issue,
> > > fake parts and excel driven/linked BOMs. (Thanks for the nice tuts
> Sean),
> > > but now I have a problem working with the Inventor API.
> > >
> > > My VB6 program updates a few spreadsheets, but now I need to update
the
> > > master assembly before opening the drawings for printing.
> > >
> > >
> > > I've tried a few ways to open and update an assembly, but to no avail.
> > >
> > > Private Sub Command1_Click()
> > > Dim oAssyDoc As Inventor.AssemblyDocument
> > > Set oAssyDoc =
GetObject("J:\...\...\...\...\...\...\...\ASSY.iam")
> > > oAssyDoc.Update
> > > oAssyDoc.Save
> > > oAssyDoc.Close
> > > End Sub
> > >
> > > Error: Run-time Error '7' - Out of Memory on the Second Line
> > >
> > >
> > > I hate to ask for debug help...but what am I missing?
> > > The file I'm opening is but 250k, but it has links to many parts that
> need
> > > to update from the excel change.
> > >
> > > Should there also be some reference to a project, or can I only use
the
> > > current project that Inventor was closed with?
> > >
> > > Thanks,
> > >
> > > -af
> > >
> > >
> >
> >
>
>
Message 5 of 5
Anonymous
in reply to: Anonymous

If I am following correctly you need to set the SilentOperation property.

Also I think you are looking for the CreateObject function.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"A.Fickes" wrote in message
news:DE7FDA1075FC2E7032C2BBE3774BA038@in.WebX.maYIadrTaRb...
> Well .. After some keyboard damage I figured it out ..
>
> I need to have Inventor running in the backgound.
>
> I guess the bigger question is: How do I launch inventor -
> Inventor.Application.Visible(False)
> from my program that is the only thing running? so that when I save it says
> ok to the dialog box?

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

Post to forums  

Autodesk Design & Make Report