Python + MXS

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

REPLY TO THREAD
 
Thread Tools Search this Thread Display Modes
Old 09 September 2007   #61
Originally Posted by ehulser: also, if anyone is interested in the DLLs for this, I can talk to my supervisor and see about putting just those up until the beta site is up. They've been extremely helpful for me in programming and I think could be really helpful for everyone else as well.


I think I can safely say that everyone will be interested.

Great to see the thread still evolving! We need to start wikifying some of this.
__________________
"There Really is No Secret"
Martin Brennand - mocha Product Manager - Imagineer Systems
 
Old 09 September 2007   #62
Excellent, eagerly awaiting those dll's ehulser
__________________
- d3coy.com -
technical articles, scripts, and gallery
 
Old 09 September 2007   #63
This seems very powerful Eric. Can't wait to use these DLL's.
__________________
 
Old 09 September 2007   #64
Same here, just about to start writting the python portion of the tool that I have been working on.
__________________
Paul Neale
http://paulneale.com
 
Old 09 September 2007   #65
Cool, thanks for the support for the use of these DLL's, I can take this to my supervisor and use it to really push for the beta site to be up. I just have to work on some documentation stuff for everyone to use as well. I'll keep everyone posted, hopefully we'll get it out there for everyone soon.
 
Old 09 September 2007   #66
I'm on the wait list too... Where would the 3dsmax world be without Blur's generous contributiion to the 3ds World ? ? ?

Thanks
__________________
Keith R Morrison
www.focus360.com

XP Pro x64, Win 7 - Max 2009, Max 2013 - Vray 2.30.01 - Backburner (uhg)
 
Old 09 September 2007   #67
I am still trying to get the COM stuff working 100%. It's hit or miss just on telling max to open a file. Sometimes max will just outright crash, sometime is get:

** system exception **
during OLE automation function call

Othertimes i get pywintypes.com_error: CONNECT_E_NOCONNECTION. I'm not sure if I am missing something or what:


...
		m = win32com.client.Dispatch("MAX.Application.8")
		m._FlagAsMethod("loadMaxFile")
...
		try:
			m.loadMaxFile(self.f)
		except pywintypes.com_error, e:
			print e[1]
__________________
"When sales determine status, I hold no faith in the majority" -El P

Draenei:Thread
Troll:Thread

Last edited by TheIvIaxx : 09 September 2007 at 06:28 PM.
 
Old 09 September 2007   #68
Hi Brett,

I just did a quick test and had no problems,

>>> obj = win32com.client.Dispatch("MAX.Application.9")
  >>> obj._FlagAsMethod("loadmaxfile")
  >>> obj.loadmaxfile("C:\\TestMax_1.max")


I would suggest double checking that "loadmaxfile" was registered as a OLE interface in max,

registerOLEInterface #(loadmaxfile)


In general though I have not had many problems with python to max, I do occasionally get errors going the other way (max to python). Although I have not used COM with max 8 in a while.

Let me know how you go...

Cheers
Dave

Last edited by specxor : 09 September 2007 at 11:41 PM.
 
Old 09 September 2007   #69
Originally Posted by specxor:
#Import win32com.
import win32com.client

#Create a connection to Max
conn = win32com.client.Dispatch("MAX.Application.9")

#Flag as a Method otherwise python or win32com will most likely treat it as attribute.
conn._FlagAsMethod("DoSomething")

#Call 'DoSomething'
obj.DoSomething("Box()")



The obj.DoSomething("Box()") threw me. I had to use conn.DoSomething(("Box"))... Maybe this is obvious, but I thought others might have had similar problems.
 
Old 09 September 2007   #70
Maybe this is obvious, but I thought others might have had similar problems.


Don't be afraid to post the bluntly obvious, it's sometimes what throws us.
 
Old 09 September 2007   #71
I agree with RustyKnight, who knows how many times a simple mistake has caused me greif!

Originally Posted by Joel Hooks: The obj.DoSomething("Box()") threw me. I had to use conn.DoSomething(("Box"))... Maybe this is obvious, but I thought others might have had similar problems.


Nice catch I cant believe I did not see that before I posted it up! I hope that did not cause anyone problems....


Cheers
Dave
 
Old 09 September 2007   #72
Just a quick post to say Hi and Thanks very much! This has been very interesting to read along, even though I have very little experience with COM, .Net or Python.

One question though: How do you pass variables/data back an fourth when interfacing with Python via COM? Can I 'send' an array or a struct to Python?

Cheers
-- MartinB
 
Old 09 September 2007   #73
Originally Posted by martinB: Just a quick post to say Hi and Thanks very much! This has been very interesting to read along, even though I have very little experience with COM, .Net or Python.

One question though: How do you pass variables/data back an fourth when interfacing with Python via COM? Can I 'send' an array or a struct to Python?

Cheers
-- MartinB


With the OLE you can only send simple type, INT, String, ect. I don't know if the same is true for COM. Be cooler if you could trade typed objects!
 
Old 09 September 2007   #74
Originally Posted by martinB: Just a quick post to say Hi and Thanks very much! This has been very interesting to read along, even though I have very little experience with COM, .Net or Python.

One question though: How do you pass variables/data back an fourth when interfacing with Python via COM? Can I 'send' an array or a struct to Python?

Cheers
-- MartinB


Hi, Martin,

Just to elaborate on Joel's post, OLE objects in Max can receive(and send) arrays, ints, floats, bools, colours, strings and undefined. These are handled with the SafeArrayWrapper. Unfortunately more complex types such as structs or max objects cannot be parsed through COM. COM implements the VARIANT data structure, for instance when you send an int from python via COM it is converted to VARIANT type VT_14 and on the other end Max is able to convert this back into an int.

Just look up SafeArrayWrapper in the max help, there is a pretty good explanation of it, alternatively just search through the MSDN stuff and it will pop up.

Cheers
Dave
 
Old 09 September 2007   #75
Dave & Joel, thanks for the info!

-- MartinB
 
reply share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 08:58 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.