3ds max file units mismatch issue

3ds max file units mismatch issue

cvijayakumar
Explorer Explorer
760 Views
3 Replies
Message 1 of 4

3ds max file units mismatch issue

cvijayakumar
Explorer
Explorer

Dear Autodesk,

 

In Autodesk 3ds Max 2025, some files are created with units that differ from the system default. When opening these files programmatically, the units can become inconsistent. How can I set the units before opening each file programmatically to avoid this issue?

 

We are launching the 3ds Max 2025 application via the command line and opening files using our C# library with Autodesk.Max.dll through a WebSocket connection. However, the files are opening with incorrect units.

 

Here is an example snippet:

public void OpenDocument(IInterface14 coreInterface, string filePath)
{
   coreInterface.LoadFromFile(filePath, true);
}

 

We are manually launching the 3ds Max 2025 application and attempting to open files with different units. When we do this, we encounter the unit mismatch dialog. After selecting the “Adopt the File’s Unit Scale” option, the file opens with the expected units.

 

cvijayakumar_0-1733304345109.png

 

0 Likes
Accepted solutions (2)
761 Views
3 Replies
Replies (3)
Message 2 of 4

larryminton
Autodesk
Autodesk
Accepted solution

The 2nd arg to LoadFromFile is 'unsigned long lFlags'. Two of the bit flags are:


/*! When this flag is set, messages about file unit mismatch and obsolete 
file versions will be suppressed.
*/

kSuppressPrompts = 0x02,
/*! This flag is only valid in conjunction with kSuppressPrompts. If the current 
scene's system units differ from those of the scene's being loaded, turning 
on this flag will cause the system unit scale of the incoming scene to be used 
(objects that are loaded are not scaled). Otherwise, the incoming scene's objects 
will be rescaled to the current scene's system unit.
*/
kUseFileUnits	= 0x04,

 


Larry Minton
Principal Engineer, M&E-Design Animation
Message 3 of 4

larryminton
Autodesk
Autodesk
Accepted solution

Also note methods regarding system units in maxsdk\include\units.h

/*! Retrieves the System Unit settings in effect. These are the System Unit type (Inches, Feet, Meters, and so on) and the System Unit scale settings. These are the values that users enter in the "1 Unit = XXX field" of the System Unit Setup dialog box.
 */
CoreExport void GetSystemUnitInfo(int *type,float *scale);

/*! Sets the System Unit settings. These are the System Unit type (Inches, Feet, Meters, and so on) and the System Unit scale settings. */
CoreExport int SetSystemUnitInfo(int type,float scale);

Larry Minton
Principal Engineer, M&E-Design Animation
Message 4 of 4

cvijayakumar
Explorer
Explorer

Thanks for your help. I updated my code like below and it works for me.

 

uint loadFlags = (0x02 | 0x04);
coreInterface.LoadFromFile(filePath, loadFlags);

0 Likes