Inventor General Discussion

Inventor General Discussion

Reply
Active Member
otterolly
Posts: 9
Registered: ‎05-25-2007
Message 1 of 7 (83 Views)

**HELP**Macros in assemblies ???

83 Views, 6 Replies
09-17-2009 05:32 AM
Hi

is it possible to make a macro that will run the copy component command when you open up an assembly ??

I want to be able to copy a generic assembly to a new project as a starting point for the new assembly.

Many thanks
Valued Contributor
jonbrabbs
Posts: 76
Registered: ‎07-26-2007
Message 2 of 7 (83 Views)

Re: **HELP**Macros in assemblies ???

09-17-2009 06:09 AM in reply to: otterolly
Olly,

Why not save the new assembly with your generic part as a new template with a specific name? Then it'll alway be there for you... Make sure you save it to you default templates folder tho.

Jon
///////////////////////////////////////////////////////////////////////////////////////////////////
If this post helps you, please give kudos.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Active Member
otterolly
Posts: 9
Registered: ‎05-25-2007
Message 3 of 7 (83 Views)

Re: **HELP**Macros in assemblies ???

09-17-2009 06:49 AM in reply to: otterolly
Hi Jon

thanks for the reply.............I have already done that, just wanted to make it a little easier for people when using the template assembly.

thanks
Valued Contributor
jonbrabbs
Posts: 76
Registered: ‎07-26-2007
Message 4 of 7 (83 Views)

Re: **HELP**Macros in assemblies ???

09-17-2009 06:56 AM in reply to: otterolly
Olly,

What are you trying to do? Do you want to pattern the assembly along a row or something?

Jon
///////////////////////////////////////////////////////////////////////////////////////////////////
If this post helps you, please give kudos.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Active Member
otterolly
Posts: 9
Registered: ‎05-25-2007
Message 5 of 7 (83 Views)

Re: **HELP**Macros in assemblies ???

09-17-2009 07:18 AM in reply to: otterolly
Jon

I am in the process of putting together a catalogue of assemblies. I am making a html document that acts as a sort of register where you can pick from a number of different assemblies which are located in a number of different folders. The html document cantains images of the assembly with a link to open the assembly in Inventor (2010) where it opens up read only. I just wanted the copy component command to start up when the assembly is opened up ......kind of to show the draughtsman what to do.

thanks

olly
Valued Contributor
jonbrabbs
Posts: 76
Registered: ‎07-26-2007
Message 6 of 7 (83 Views)

Re: **HELP**Macros in assemblies ???

09-17-2009 08:23 AM in reply to: otterolly
Olly,

As far as I'm aware, there is no way to copy components within an assembly through code. To get something to fire when the model is opened, you would need to access the events within the code.
Option Explicit

Private WithEvents eFA As ApplicationEvents

Private Sub Class_Initialize()
Set eFA = ThisApplication.ApplicationEvents
End Sub

This code will give you access to the OnOpenDocument event.

In here you could create something that would instruct the user to do something..e.g

sub eFA_OnOpenDocument(ByVal DocumentObject As Document, ByVal FullDocumentName As String, ByVal BeforeOrAfter As EventTimingEnum, ByVal Context As NameValueMap, HandlingCode As HandlingCodeEnum)

MsgBox "Copy Component"

End Sub

This would need to be copied into each file that you wanted it to fire on, and would fire every time it was opened. If you're working on a lot of files, you would be best to create an Addin using VB.Net or the like, which is loaded with Inventor, and is not file specific.

Or you could get it to insert a new instance of the assembly on open, ready to work on - this is something which is fairly straight forward, and I could help you with if you need it.

To get more help with this, I would recommend re-posting in the Inventor Customisation forum, where you will get help from people who do this kind of thing every day.

Jon
///////////////////////////////////////////////////////////////////////////////////////////////////
If this post helps you, please give kudos.
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Active Member
otterolly
Posts: 9
Registered: ‎05-25-2007
Message 7 of 7 (83 Views)

Re: **HELP**Macros in assemblies ???

09-17-2009 08:26 AM in reply to: otterolly
Jon

thanks for your advice, I thought I could struggle with this.
I will repost in the customisation forum as well

thanks again

olly
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.