Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

RectCount ( pieceA ; pieceB ; materialA ; materialB )

Featured Replies

Name & Parameters: [color:red][big] RectCount ( pieceA ; pieceB ; materialA ; materialB ) [/big]

Description: Returns the number of rectangles (with dimensions PieceA x PieceB,) that can be cut from an area of materials (with dimensions MaterialA x MaterialB.

Sample Input:

RectCount(20;30;40;80)

Results:

5

Recursive: yes

Formula:

//RectCount ( pieceA ; pieceB ; materialA; materialB )



/*

Returns the number of rectangles (with dimensions PieceA x PieceB,) that can be cut from an area of materials (with dimensions MaterialA x MaterialB.)



Sub function of: RectCoordinatesSub().

CFs Required:  None



10-13-2005

Rev: 7-29-06

By Mike Hackett

*/



Case((materialA * materialB) / (pieceA * pieceB) < 125; 

  Let(

  [

    PieceLongSide = Max(pieceA; pieceB);

    PieceShortSide = Min(pieceA; pieceB);

    MaterialLongSide = Max(materialA; materialB);

    MaterialShortSide = Min(materialA; materialB;);



    /*Check the count with first cutting hozontal pieces from horizontal material.*/

    CountRows = Case(materialLongSide ≥ pieceLongSide and Div(materialShortSide; pieceShortSide)>0; 

                               Div(materialShortSide; pieceShortSide) + 

                                    RectCount(pieceA; pieceB; materialShortSide; materialLongSide - pieceLongSide));



    /*Check the count with first cutting vertical pieces from horizontal material.*/

    CountColumns = Case(materialShortSide ≥ pieceLongSide and Div(materialLongSide; pieceShortSide)>0; 

                               Div(materialLongSide; pieceShortSide) + 

                                    RectCount(pieceA; pieceB; materialLongSide; materialShortSide - pieceLongSide))

  ];



  /*Return the greater count*/

  Max(countrows; countcolumns)

  );

  "Too many pieces to calculate."

) 

Required Functions:

Author(s):) Ender

Date: 07/29/06

Credits: Based on the discussion in this thread: http://www.fmforums.com/forum/showtopic.php?tid/170643/

Disclaimer:

FM Forums does not endorse or warrantee these files are fit for any particular purpose. Do not post or distribute files without written approval from the copyright owner. All files are deemed public domain unless otherwise indictated. Please backup every file that you intend to modify.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.