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.

RectCoordinatesSub ( pieceA ; pieceB ; materialA ; materialB ; positionX ; positionY )

Featured Replies

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

Description: Returns the coordinates of rectangles (with dimensions pieceA x pieceB,) that can be cut from an area of materials (with dimensions materialA x materialB), starting from positionX, positionY.

This is designed to be used by the xmChart plugin to generate a graphic representation of how to cut the most pieces from the material.

This is a sub function of RectCoordinates(), located here (along with a demo):)

http://www.fmforums.com/forum/showtopic.php?tid/179077/post/216239/#216239/

Sample Input:

RectCoordinatesSub(12;12;15;25;0;0)

Results:

AddRect( 0;0;12;12;white)¶

AddFrame(0;0;12;12;1;black)¶

AddRect( 0;12;12;12;white)¶

AddFrame(0;12;12;12;1;black)¶

Recursive: yes

Formula:

//RectCoordinatesSub ( pieceA ; pieceB ; materialA; materialB; positionX; positionY )



/*

Returns the coordinates of rectangles (with dimensions pieceA x pieceB,) that can be cut from an area of materials (with dimensions materialA x materialB), starting from positionX, positionY.



This is designed to be used by the xmChart plugin to generate a graphic representation of how to cut the most pieces from the material. 

Coordinates start from the top, left.  

The string returned is in the form: 



AddRect( 0;0;12;12;white)¶

AddFrame(0;0;12;12;1;black)¶

AddRect( 0;12;12;12;white)¶

AddFrame(0;12;12;12;1;black)¶





Sub function of: RectCoordinates().

CFs Required: RectCount(), and DrawRect().



7-29-2006

By Mike Hackett

*/





Let(

[

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

  countRows = Case(materialA ≥ pieceA and Div(materialB; pieceB) > 0; 

                               Div(materialB; pieceB) + 

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



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

  countColumns = Case(materialB ≥ pieceA and Div(materialA; pieceB) > 0; 

                               Div(MaterialA;PieceB) + 

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

];



Case(countRows > 0 or countColumns > 0;

  Case(countRows > countColumns; 

    //Draw as many rows as will fit first

    DrawRect(positionX; positionY; pieceA; pieceB; "Down"; Div(materialB; pieceB)) &

       RectCoordinatesSub( pieceA; pieceB; materialA - pieceA; materialB; positionX + pieceA; positionY );



    //Draw as many columns as will fit first

    DrawRect(positionX; positionY; pieceB; pieceA; "Across"; Div(materialA;PieceB)) &

       RectCoordinatesSub( pieceA; pieceB; materialA; materialB - pieceA; positionX; positionY + pieceA )))

) 

Required Functions: RectCount()

DrawRect()

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.

Account

Navigation

Search

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.