AnsweredAssumed Answered

How to make Macro embeded into a part

Question asked by Charlie Fan on Jul 20, 2015
Latest reply on Jul 29, 2015 by Charlie Fan

Hi all,

 

I have a simple macro. All it does is to change the dimension of a part.

 

I used those "active doc" thing to refer to the part file and to the dimension I want to change.

 

When I open this part and run the macro, no problems it can change the dimension.

 

However, when I put this part file in an assembly, and then run the macro, it doesn't work since the "Activedoc" is changed to the assembly, not the part.

 

I need the macro I made, or the logic I programmed to be embedded into the part file, so when this part file is in assembly, the logic can still run automatically.

 

This is particularly useful, if the part need to be intelligent and fit the change of the assembly, and if this logic need to be achieved by programming in vba.

 

In other words, this logic(macro) must run automatically when I rebuild model, and interact with only this part, not the assembly file I have opened.

 

I have tried to attach macro to part, use equation to trigger it. But this is a silly work around since the equation editor always stand in my way and, you cannot edit this macro once attached.

 

I have tried to squeeze macro codes into properties and that is also another silly solution, since I cannot easily debug the code and it cannot be longer than 1024 Bytes.

 

I don't understand why the competitor of solidworks, namely Autodesk Inventor, can have a function "iLogic" to have vba code built into a part decently and travel with the part. Even when this part is in the assembly those logic can still run smoothly to fit the change of the assembly. Is it true that Solidworks is a software that inferior to Autodesk Inventor?

 

Any insights or suggestions will be highly regarded.

 

Thank you.

Outcomes