<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Update Max with new objects from outside 3d Package running Python? in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276066#M17479</link>
    <description>Monitor through Maxscript?  Or is there a way to set up max to do it automatically?  I checked to see if there were any maxscript events that can monitor a folder, but haven't seen any so far.</description>
    <pubDate>Mon, 24 Dec 2012 22:46:49 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2012-12-24T22:46:49Z</dc:date>
    <item>
      <title>Update Max with new objects from outside 3d Package running Python?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276064#M17477</link>
      <description>So I'm a fairly technical artist, although not a hardcore programmer, coming from another software package learning the technical aspects of Max.  Just for practice, I wrote a script in Softimage that acts like a “Send to 3ds Max” button.  Within Softimage, it saves selected objects in an FBX file, creates a max script which is saved to hard drive, then opens a new instance of Max with an argument to open said maxscript which of course imports the FBX file into a clean scene.  All works great.  But what would be cool is if I could update an already open Max scene with new objects sent from Softimage. &lt;BR /&gt;&lt;BR /&gt;Here's what I'm wondering.  Is Max or Maxscript open in such a way that I am able to send objects to an already open version Max from an outside Python process running in Softimage (or any other package)?  Or is this something lower level that would be accessed through Max's SDK in C++?  &lt;BR /&gt;&lt;BR /&gt;Any hints on how this is done would be appreciated.&lt;BR /&gt;&lt;BR /&gt;FYI, if any of you are thinking, "There already is a send to Max button in Soft", Well, yeah there is, but it only sends particles unfortunately.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Paul</description>
      <pubDate>Mon, 24 Dec 2012 18:03:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276064#M17477</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-24T18:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Update Max with new objects from outside 3d Package running Python?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276065#M17478</link>
      <description>How about this (abstract):&lt;BR /&gt;From an open 3dsmax session you monitor a specific export-folder.&lt;BR /&gt;If something is exported from SI in this folder, it gets imported into 3dsmax.</description>
      <pubDate>Mon, 24 Dec 2012 21:41:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276065#M17478</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-24T21:41:17Z</dc:date>
    </item>
    <item>
      <title>Re: Update Max with new objects from outside 3d Package running Python?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276066#M17479</link>
      <description>Monitor through Maxscript?  Or is there a way to set up max to do it automatically?  I checked to see if there were any maxscript events that can monitor a folder, but haven't seen any so far.</description>
      <pubDate>Mon, 24 Dec 2012 22:46:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276066#M17479</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-24T22:46:49Z</dc:date>
    </item>
    <item>
      <title>Re: Update Max with new objects from outside 3d Package running Python?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276067#M17480</link>
      <description>You can use Max OLE Automation feature.&lt;BR /&gt;&lt;BR /&gt;Windows (from 95 to the last) come with native script engine WSH (Windows Scripting Host) that allow running JScript and VBScript (without installing whatever).&lt;BR /&gt;&lt;BR /&gt;So here is what I use in VBScript&amp;amp;colon;&lt;BR /&gt;&lt;PRE&gt;REM ------------------------------------------------&lt;BR /&gt;'&lt;BR /&gt;'   Running MAXScript using OLE Automation&lt;BR /&gt;'&lt;BR /&gt;'   Author: P. Karabakalov (project3d.narod.ru)&lt;BR /&gt;'&lt;BR /&gt;'   In the MAXScript Reference READ this topics:&lt;BR /&gt;'     * Setting Up MAXScript OLE Automation&lt;BR /&gt;'     * Exposing MAXScript Functions&lt;BR /&gt;'&lt;BR /&gt;'   Be SURE you expose at least Mxs FileIn function:&lt;BR /&gt;'   for example:&lt;BR /&gt;'     registerOLEInterface #(Execute, FileIn)&lt;BR /&gt;'&lt;BR /&gt;'&lt;BR /&gt;REM ------------------------------------------------&lt;BR /&gt;&lt;BR /&gt;Option Explicit&lt;BR /&gt;&lt;BR /&gt;Dim MXSObj, MSFile&lt;BR /&gt;&lt;BR /&gt;With WScript.Arguments&lt;BR /&gt;&lt;BR /&gt;    '** break if no argument   '&lt;BR /&gt;    If .Count &amp;lt;&amp;gt; 1 Then WScript.Quit(-1)&lt;BR /&gt;&lt;BR /&gt;    '** store the file name    '&lt;BR /&gt;    MSFile = .Item(0)&lt;BR /&gt;&lt;BR /&gt;    With CreateObject("Scripting.FileSystemObject")&lt;BR /&gt;&lt;BR /&gt;        '** break if file not exist   '&lt;BR /&gt;        If Not .FileExists(MSFile) Then WScript.Quit(-2)&lt;BR /&gt;&lt;BR /&gt;        '** break if not a .MS file   '&lt;BR /&gt;        If .GetExtensionName(MSFile) &amp;lt;&amp;gt; "ms" Then WScript.Quit(-3)&lt;BR /&gt;&lt;BR /&gt;    End With&lt;BR /&gt;&lt;BR /&gt;End With&lt;BR /&gt;&lt;BR /&gt;On Error Resume Next&lt;BR /&gt;&lt;BR /&gt;'** connect to last COM registered Max version   '&lt;BR /&gt;Set MXSObj = CreateObject("MAX.Application")&lt;BR /&gt;&lt;BR /&gt;'** if you have not at least one 3ds Max registered as OLE server  '&lt;BR /&gt;'** an automation error will arise                                 '&lt;BR /&gt;If Err Then&lt;BR /&gt;    MsgBox Err.Description, , "Error # " &amp;amp; CStr(Err.Number)&lt;BR /&gt;    WScript.Quit(-4)&lt;BR /&gt;End If&lt;BR /&gt;&lt;BR /&gt;Err.Clear  ' end of error handle   '&lt;BR /&gt;&lt;BR /&gt;'** we`re here if everything is fine                              '&lt;BR /&gt;&lt;BR /&gt;'** if 3ds Max is not running then VB built-in IsObject function  '&lt;BR /&gt;'** will pause the script until Max load                          '&lt;BR /&gt;'** (it`s my own discovery though) ;)                             '&lt;BR /&gt;If IsObject(MXSObj) Then MXSObj.FileIn(MSFile)&lt;BR /&gt;&lt;BR /&gt;'** clean the OLE object (that not close Max)   '&lt;BR /&gt;Set MXSObj = Nothing&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;If you prefer to rewrite this as python script, then as am not work with it I can post only this snippet code:&lt;BR /&gt;&lt;PRE&gt;from win32com.client import Dispatch&lt;BR /&gt;&lt;BR /&gt;MXSObj = Dispatch("MAX.Application")&lt;BR /&gt;&lt;BR /&gt;MXSObj._FlagAsMethod("Execute")&lt;BR /&gt;MXSObj.Execute("Box()")&lt;BR /&gt;&lt;BR /&gt;MXSObj._FlagAsMethod("FileIn")&lt;BR /&gt;MXSObj.FileIn("script.ms")&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 25 Dec 2012 08:49:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276067#M17480</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-25T08:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Update Max with new objects from outside 3d Package running Python?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276068#M17481</link>
      <description>Hey, thanks for the time and effort Anubis.  Very informative post.&lt;BR /&gt;&lt;BR /&gt;This definitely points me in the right direction I think.  I did a little research online regarding using OLE/COM to talk to Max.  Seems some guys are getting good results using socket listener/server setup too after reading this interesting thread on the subject. &lt;BR /&gt;&lt;A href="http://tech-artists.org/forum/showthread.php?2723-Python-to-MaxScript-to-Python" target="_blank"&gt;http://tech-artists.org/forum/showthread.php?2723-Python-to-MaxScript-to-Python&lt;/A&gt;</description>
      <pubDate>Tue, 25 Dec 2012 23:46:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276068#M17481</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-25T23:46:03Z</dc:date>
    </item>
    <item>
      <title>Re: Update Max with new objects from outside 3d Package running Python?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276069#M17482</link>
      <description>Glad to know that I helps with something &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 26 Dec 2012 11:03:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276069#M17482</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-26T11:03:22Z</dc:date>
    </item>
    <item>
      <title>Re: Update Max with new objects from outside 3d Package running Python?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276070#M17483</link>
      <description>As you mention socket, maybe you`re after two-sided connection?&lt;BR /&gt;If you only need to get the result back from Max to your script, &lt;BR /&gt;I think that the clipboard (setclipboardText) is a good approach.&lt;BR /&gt;&lt;BR /&gt;An example MXS function:&lt;BR /&gt;&lt;PRE&gt;fn ExecuteEx cmd = (&lt;BR /&gt;    global gvResult = (execute cmd) as string&lt;BR /&gt;    setclipboardText gvResult&lt;BR /&gt;    globalVars.remove #gvResult&lt;BR /&gt;)&lt;/PRE&gt;&lt;BR /&gt;And of course in your py code should make some wait-loop.&lt;BR /&gt;I can show only how it looks like in vbs --&lt;BR /&gt;&lt;PRE&gt;Dim retData, iRetry : iRetry = 0&lt;BR /&gt;With New Clipboard  'Clipboard is my own class  '&lt;BR /&gt;    .Clear&lt;BR /&gt;    If IsObject(MXSObj) Then MXSObj.ExecuteEx("2+2")&lt;BR /&gt;    Do Until Len(retData) &amp;lt;&amp;gt; 0&lt;BR /&gt;        WScript.Sleep 100  'time in millisec. '&lt;BR /&gt;        retData = .Data&lt;BR /&gt;        iRetry = iRetry + 1&lt;BR /&gt;        If iRetry &amp;gt; 100 Then Exit Do&lt;BR /&gt;    Loop&lt;BR /&gt;End With&lt;BR /&gt;MsgBox retData  'display return result  '&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Dec 2012 12:43:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276070#M17483</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-26T12:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Update Max with new objects from outside 3d Package running Python?</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276071#M17484</link>
      <description>Hey Thanks Anibus.&lt;BR /&gt;Yes, 2 way is way more sexy than one way (no pun intended).  This isn't something I need to do now, but possibly in the months to come and wanted to at least get an idea on how to think about the problem in the mean time.  I have some pretty pressing things to learn at the moment.&lt;BR /&gt;&lt;BR /&gt;Regarding how Max, Maya and Softimage communicate now, it's default and nativly coded for 2 way communication.  I wonder if it's safe to assume they are using old school tcp sockets, or something fancy and propitiatory.</description>
      <pubDate>Wed, 26 Dec 2012 16:26:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/update-max-with-new-objects-from-outside-3d-package-running/m-p/4276071#M17484</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-12-26T16:26:12Z</dc:date>
    </item>
  </channel>
</rss>

