25 things you probably didn't know about the 3DS MAX SDK

Source: Internet
Author: User
ArticleDirectory
    • 25 things you probably didn't know about the 3DS MAX SDK

Http://area.autodesk.com/blogs/chris/25-things-you-probably-didn039t-know-about-the-3ds-max-sdk

 

25 things you probably didn't know about the 3DS MAX SDK

I 've adventured deep into the darkest corners of the 3DS MAX SDK to bring you a set of largely unknown but useful tips and tricks.

  1. Use the 3DS max sdk from maxscript by loading the Autodesk. Max. dll. Add the following maxscript to your start-up scripts and you can use the maxglobal variable to access the 3DS max sdk.

    FN loadautodeskmax = (local assembly = dotnetclass "system. reflection. assembly "Local maxroot = pathconfig. getdir # maxroot assembly. loadFile (maxroot + "\ Autodesk. max. DLL ") Local globalinterface = dotnetclass" Autodesk. max. globalinterface "Global maxglobal = globalinterface. instance) loadautoscaling max ()
  2. Execute Arbitrary maxscript code using the executemaxscriptscript () global function (see the maxscriptmaxscript. h header ).
  3. Execute Code safely in the main thread in 3DS MAX by either creating a Windows timer object using the main 3DS MAX window as the window handle, or by using the following function to trigger code as soon as 3DS MAX is idle next.
    # Define wm_trigger_callback wm_user + 4764 void postcallback (void (* funcptr) (uint_ptr), uint_ptr PARAM) {postmessage (getapphwnd (), wm_trigger_callback,
    (Uint_ptr) funcptr, (uint_ptr) PARAM );}
  4. Work with different types of meshes (mesh, mnmesh and patchmesh) using theobjectwrapper class. This can simplify writing plug-in that have to deal with Arbitrary Mesh types such as modifiers.
  5. Collect comprehensions about all nodes in the scene in an efficient way using theisceneeventmanager class. It's ideal to use for UI refresh, when you need to monitor the scene for events to trigger a refresh.
  6. Output text to the 3DS MAX maxscript listener window (see the maxscriptmaxscript. h header) as follows:
    The_listener-> edit_stream-> wputs ("hello") the_listener-> edit_stream-> flush ()
  7. Execute a Python script from A. Net assembly with a few lines of code after downloading and installing ironpython
    Using ironpython. hosting; using Microsoft. scripting. hosting; public static void runpythonfile (string filename) {try {var Options = new dictionary <string, Object> (); options ["debug"] = true; scriptengine Se = python. createengine (options); scriptsource Ss = Se. createscriptsourcefromfile (filename); compiledcode cc = ss. compile (); CC. execute ();} catch (exception e) {MessageBox. show ("error occurred:" + E. message );}}
  8. Extend 3DS MAX with new drag and drop functionality by deriving from thedraganddrophandler class.
  9. Download a file from an arbitrary URL to disk using: idraganddropmgr: downloadurltodisk ().
  10. Compress data using the zlip compression library. Check out the zlibdll. h header file in the 3DS max sdk.
  11. Log messages to the 3DS MAX log file and even print out messages to Visual Studio console using logsys class.
  12. Evaluate mathematical expressions stored as strings using the expr class.
  13. Generate repeatable sequences of random numbers using the random class.
  14. Store objects in one of the following container template types:
    • Stack
    • Shortlist
    • Array
    • Tab
  15. Read and Write Unicode files easily and correctly using the filereaderwriter class.
  16. Compute the time it takes to complete a task using the Timer class.
  17. Automatically delete objects when you are done with them using the autoptrtemplate.
  18. Output unobtrusive status messages to the user using the interface: pushprompt () function.
  19. Retrieve the user define UI colors using icolormanager.
  20. Launch a web browser using ibrowsermgr.
  21. Retrieve. Max file Properties Using interface11: openmaxstoragefile ().
  22. Format a time value as a string using interface10: formatrendertime ()
  23. Open the Windows Explorer using interface8: revealinexplorer ().
  24. Perform a quick render to A Bitmap Using interface8: quickrender ()
  25. Execute Code when 3DS MAX is fully initialized in C #:
    Using managedservices; public class my3dsmaxassembly {public const int startupnotification = 0x50; public static void assemblymain () {// This causes an event to be raised once the 3DS MAX application has been started var M = new maxnotificationlistener (startupnotification); M. notificationraised + = new eventhandler <maxnotifeventargs> (afterstartup);} public static void afterstartup (Object sender, maxicationeventargs e) {If (E. notificationcode = startupnotification) {// do whatever }}}

Special thanks to Michaelson Britt, Stephen Taylor, and David cunnheim for several of theses cool tips. Please share in the comments your unordered ented or frequently overlooked tips and tricks for using the 3DS max sdk!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.