Dont break part's Y dimension when its smaller than 2.5

Continuing the discussion from Break part into 8 pieces:

  1. What do you want to achieve? Keep it simple and clear!
    When a part’s (for example) Y size is not following the requirements, I dont want it to break, keeping the original Y size and only breaking into 4 the X and Z.

Requirements to break: if YSize < 4 or YSize == 4 or YSize/2 < 2.5 or YSize/2 == 2.5 then

  1. What is the issue? Include screenshots / videos if possible!
    A part with Y size of 2 keeps breaking into 4 parts with a Y/4 size. I want to keep the original size.

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I tried many ways, but since im not experienced with these, I couldn’t find a solution.

Why not make it

print("YSize = ", YSize)  -- tells you what the YSize is used for the following:
if YSize > 5 then
      -- do code to break part
end 

which covers the smallest dimension that the YSize should be . It doesn’t make sense when you are checking YSize of 4 from your post title since 4/2 = 2, which is lower than 5/2 = 2.5.
The print tells you what your YSize is, and if it isn’t printing the correct dimension then you need to troubleshoot the code that reads the YSize of the part.

The other question is are you actually seeing the Y dimension of the Part, or are you seeing the X or Z dimension?

No, that doesnt work. The part breaks into another 8 different and equal sized parts. If the Y dimension of the part doesnt cover that requirements (and yes, that specific requirements), then I dont want it to modify the Y dimension and only break into 4 parts. These is because in extremely small parts with X or Z dimension correct, it becomes a thing layer.

What does the print give you for the YSize? If that value isn’t less than 5 then your if check will fail.
If the smallest size you want to break is > 2.5 studs then why have if Y <= 4?

Just FYI Putting
if YSize < 4 or YSize == 4
is the exact same equation as
if YSize <= 4

try putting 4 and 5 into your equation. If it’s less than 5/2 it’s less than 4 so you don’t need the first half. 2.5 is always lower than 4 so the 4 check is unnecessary.

I just reworked the entire code since it made it easier to manage. Plus it was extremely confusing.

1 Like