Event Manager With Macros And Mechanisms

I am trying to set up a simulation using the Event Manager to trigger Macros to create, attach and detach parts and also move Mecanisms to a Pose.

My first issue is with the triggering the macros.  When I trigger a macro using an output from the robot program the macro gets triggered twice.  Therefore two parts are created, attached and detached from the robot.  This is not a huge problem as you can only see one part, but i'm not sure if it is a problem with RS.

I also have an issue when detaching the parts from the robot.  When i detach them using a macro i can not keep the current position of the parts, they always go back to the position they were originally created in.  Is there a parameter to keep the current position in the detach method the same as there is for the attach method?

I also have an issue trying to change the color of a part.  The macro compiles fine but when i try to run it i get the error 'System.Reflection.TargetInvocationException, mscorlib'.

The final issue i have is when using the event manager to move a mechanism to a pose.  This works fine unless i want to set a signal when the pose is reached.  If i add a signal, it is added to every event that has a mechanism movement, whereas i want a different signal for each movement.

I have attached a copy of my macros.  Any help would be appreciated.

2007-04-19_092412_ThisApplication.zip

Regards,

Craig Pentecost

Comments

  • Hi Craig,

    To keep the position when detaching you can save and restore the GlobalMatrix. Like this:

        // Detach!
        IHasTransform tf = currentAttachedObject as IHasTransform;
        Matrix4 m = tf.Transform.GlobalMatrix;
        if (flange.Detach(currentAttachedObject))
        {
            tf.Transform.GlobalMatrix = m;
            Logger.AddMessage(new LogMessage("Sample Add-In: Detached"));
        }


    As for the color problem: Unfortunately the System.Drawing.Color type currently isn't supported in VSTA, and there is no known workaround image

    regards,
    Johannes

    Johannes Weiman
    Software Engineer
    ABB Robotics
  • Update: RS 5.09 will include a workaround for the Color problem and some other VSTA limitations :)

    Johannes Weiman
    Software Engineer
    ABB Robotics
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!