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: 

automaticly save an assembly macro

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
Anonymous
332 Views, 3 Replies

automaticly save an assembly macro

I believe this is a stupid question but I just got stuck with it. So please help 🙂

 

I have made a macro that asks for a location on the file server (=client name) and then the project name. It then automatic creates the correct folders, opens my custom assembly template and changes an ipart that is by default in it.

 

That's all great and can save us a ton of time, but the last step is to automatic save the assembly! I just can't get it working and can't find the correct code (programming help, this forum, Google, ...)

 

I have defined the target folder earlier and the file name of the assembly is identical to this folder. For example

target folder = O:\Projects\clientName\ClientProject1

file name = ClientProject1.iam

-> result: O:\Projects\clientName\ClientProject1\ClientProject1.iam

 

the code that I think should work looks like this:

 

Sub SaveAssembly()
    Dim oAssDoc As AssemblyDocument
    Set oAssDoc = ThisApplication.ActiveDocument
    oAssDoc.SaveAs ("O:\Projects\clientName\ClientProject1\ClientProject1.iam", False)
End Sub

 

But it doesn't work, I always get the error message "Compile error: Expected: ="
Whatever I do next I don't get the code to work

 

I feel stupid I can get the diffucult part working but that I'm stuck over something easy as an automatic save ...

 

thx for the help!

 

3 REPLIES 3
Message 2 of 4
jdkriek
in reply to: Anonymous

You need to Call it 😉

 

Call oAssDoc.SaveAs()

 

Sub SaveAssembly()
    Dim oAssDoc As AssemblyDocument
    Set oAssDoc = ThisApplication.ActiveDocument
    Call oAssDoc.SaveAs ("O:\Projects\clientName\ClientProject1\ClientProject1.iam", False)
End Sub
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 4
Anonymous
in reply to: jdkriek

I knew I was forgetting something stupid 🙂

 

It works, thx!

Message 4 of 4
jdkriek
in reply to: Anonymous

You're quite welcome.

 

Sometimes it's the simple things. Back in PHP I always forgot semicolons lol

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


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

Post to forums  

Autodesk Design & Make Report