3DS Max Script for Cabinet Cutlist
Budget: $10 – $30 USD
i need a 3ds max script to make a cutlist for my cabinets or wardrobe i draw as 3d models in 3dsmax, this can help me know how many wood panels i need to make my boq and to send this list as excel sheet to the wood manufacture and cut them as is in this excel sheet, this script can make an excel sheet includes length, width, depth, and thickness of the cabinet or wardrobe that i draw in 3d max software as 3d model, it the model must includes top panel, bottom panel, left and right side panels, back panel, shelves, dividers, and the doors, so i need the script for 3dmax software to read all this as names and numbers and put them in excel sheet.
i asked gemeni ai about max script to use it in my 3dsmax projects to help making cutlist for cabinets and any design i draw! and i got this script but it didn't work! anybody can help plz?
-- Function to extract dimensions and thickness from an object
fn extractDimensions obj = (
local bbox = getBoundingBox obj
local length = bbox.max.x - bbox.min.x
local width = bbox.max.y - bbox.min.y
local depth = bbox.max.z - bbox.min.z
-- Calculate thickness, considering potential thickness modifier
local thickness = 0
for mod in obj.modifiers do (
if classOf mod == Thickness then
thickness = mod.amount
)
return {length:length, width:width, depth:depth, thickness:thickness}
)
-- Function to export data to a CSV file (a simpler approach)
fn exportToCSV data fileName = (
local file = createfile fileName
-- Write header row
format "Part Name,Length,Width,Depth,Thickness\n" to:file
-- Write data rows
for item in data do (
format "%s,%f,%f,%f,%f\n" item.partName item.dimensions.length item.dimensions.width item.dimensions.depth item.dimensions.thickness to:file
)
close file
)
-- Main script
(
-- Select the cabinet or wardrobe objects
select $YourCabinetOrWardrobe*
-- Create an empty data structure
local cutlistData = #()
-- Iterate through selected objects
for obj in selection do (
try (
local partName = obj.name
local dimensions = extractDimensions obj
append cutlistData {partName:partName, dimensions:dimensions}
) catch (error) (
print "Error processing object: " + obj.name + "\n" + error
)
)
-- Export the data to a CSV file
exportToCSV cutlistData "cutlist.csv"
print "Cutlist exported to cutlist.csv"
)
i asked gemeni ai about max script to use it in my 3dsmax projects to help making cutlist for cabinets and any design i draw! and i got this script but it didn't work! anybody can help plz?
-- Function to extract dimensions and thickness from an object
fn extractDimensions obj = (
local bbox = getBoundingBox obj
local length = bbox.max.x - bbox.min.x
local width = bbox.max.y - bbox.min.y
local depth = bbox.max.z - bbox.min.z
-- Calculate thickness, considering potential thickness modifier
local thickness = 0
for mod in obj.modifiers do (
if classOf mod == Thickness then
thickness = mod.amount
)
return {length:length, width:width, depth:depth, thickness:thickness}
)
-- Function to export data to a CSV file (a simpler approach)
fn exportToCSV data fileName = (
local file = createfile fileName
-- Write header row
format "Part Name,Length,Width,Depth,Thickness\n" to:file
-- Write data rows
for item in data do (
format "%s,%f,%f,%f,%f\n" item.partName item.dimensions.length item.dimensions.width item.dimensions.depth item.dimensions.thickness to:file
)
close file
)
-- Main script
(
-- Select the cabinet or wardrobe objects
select $YourCabinetOrWardrobe*
-- Create an empty data structure
local cutlistData = #()
-- Iterate through selected objects
for obj in selection do (
try (
local partName = obj.name
local dimensions = extractDimensions obj
append cutlistData {partName:partName, dimensions:dimensions}
) catch (error) (
print "Error processing object: " + obj.name + "\n" + error
)
)
-- Export the data to a CSV file
exportToCSV cutlistData "cutlist.csv"
print "Cutlist exported to cutlist.csv"
)