RobotStudio event

Visual Studio. Create body and attach it to positioner

Hi everyone!

I want to use VSTA to create object and attach it to positioner. I created body. How can I attach it to IRBP A (using code)?

I think I need add only one line like:
*******.Attach(p, true, new Matrix4(new Vector3(0.0, 0.0, 1.0)));

My code:

public void Macro_Sample1()
        {
            Project.UndoContext.BeginUndoStep("BodyCreateSolids");
            try
            {
                Station station = Project.ActiveProject as Station;
                Mechanism mech = station.ActiveTask.Mechanism;
                Part p = new Part();
                p.Name = "My_Solid_Bodies";
                station.GraphicComponents.Add(p);


                // Create a cylinder.
                Matrix4 matrix_origo1 = new Matrix4(new Vector3(Axis.X), 0.0);
                Vector3 size1 = new Vector3(0.500, 0.500, 0.500);
                Body b1 = Body.CreateSolidCylinder(matrix_origo1, 0.5, 0.5);
                b1.Name = "Cylinder1";
                p.Bodies.Add(b1);
               
            }

            catch {}
            finally {}
            
          }