Improving Property Extraction in 3ds Max

Published on January 07, 2026 | Translated from Spanish
Optimized code to improve property extraction in 3ds Max using an enhanced version of getUserProp in MaxScript.

The getUserProp function in MaxScript has presented errors since old versions of 3ds Max, affecting the retrieval of values stored in objects' user properties. To solve this issue, an improved version has been developed that optimizes data extraction and ensures more precise handling.

Solution to a long-standing error

The problem with the original MaxScript function lies in the fact that it does not always return the correct values when dealing with boolean, numeric, or text string data. This flaw has been present since 3ds Max 9 and has never been officially fixed. To avoid these errors, a new implementation has been designed that improves stability in data retrieval.

Main features of the improved getUserProp

Applications in automation scripts

This script is especially useful for developers working with custom tools in 3ds Max, as it allows more precise access to data stored in objects' user properties. Its application extends to:

Optimization for advanced workflows

The implementation of this new version facilitates the obtaining of reliable data within the 3ds Max environment. Its goal is to improve consistency and stability in the use of user properties, avoiding common problems in information extraction.

Code of the improved script


-- Checks if a string contains only numbers
fn isNumeral txt = (
 s= txt as string
 for i = 1 to s.count do(
  if(findString "0123456789" s[i]) == undefined then(
   return false
  )
 ) 
 return true
)

-- Enhanced getUserProp function
fn getUserProp2 obj =(
 local ss = (getUserPropBuffer obj) as stringStream
 if ss != undefined then(
  while (eof ss) != true do(
   local txt = readline ss 
   local arr = filterstring txt " = " 

   if arr[2] != undefined then( 
    if (arr[2] == "true") or (arr[2] == "false") or ((isNumeral arr[2]) == true ) then( 
     txt = arr[1] + "=" + arr[2]

     execute txt
     readline ss 
    )else(
     arr[2] = "@\"" + arr[2]
     append arr[2] "\""
     txt = arr[1] + "=" + arr[2] 

     execute txt
     readline ss 
    )
   )else( 
    txt = arr[1] + "=" + "\"\""

    execute txt
    readline ss 
   )
  )
 )else(
  return(); 
 )

Code explanation

This script is an effective solution for developers working with data stored in 3ds Max, eliminating errors and improving reliability in information retrieval within their projects.