How can i arrange Random logo

I have 6 logo i want to random arrange the logo 6 vertical x 6 horizontal. Is there any macro or way to auto arrange the logo's. Any suggestion or help. Thx

Top Replies

Parents
  • [CgsAddInMacro]
    public void RandomOrder()
    {
        //Number of columns and rows, can be changed to any value > 0
        int cols = 6rows = 6;
        //Initial position, can be changed to any position,
        //remember to use the same value in the column loop
        double posX = 0posY = 0;
     
        ShapeRange logos = corelApp.ActiveSelectionRange;
        
     
        logos.Sort("@shape1.width > @shape2.width");
        double width = logos[1].SizeWidth;
     
        logos.Sort("@shape1.height > @shape2.height");
        double height = logos[1].SizeHeight;
     
     
        Random random = new Random();
     
        for (int i = 0; i < cols; i++)
        {
            for (int j  = 0; j < rows; j++)
            {
                Shape shape = logos[random.Next(1,logos.Count+1)].Duplicate();
                shape.CenterX = posX + width / 2; 
                shape.CenterY = posY + height / 2;
                posX = posX + width;
            }
            posY = posY + height;
            posX = 0;
        }
        logos.Delete();
     
    }
Reply Children