CGTalk > Software > Autodesk 3ds max > 3dsMax SDK and MaxScript
Login register
reply share thread « Previous Thread | Next Thread »
 
Thread Tools Search this Thread Display Modes
Old 10-17-2007, 11:53 PM   #1
erilaz
Stealthy Tea Monkey
 
erilaz's Avatar
portfolio
Martin Brennand
VFX Artist
Melbourne, Australia
 
Join Date: Jun 2002
Posts: 13,756
dotNet + MXS

In light of David Mackenzie's excellent Python+MXS thread, I figured it would make sense to have a thread focused on dotNet as well. Admittedly this is mainly because i'm interested in using it right now, but any and all techniques about dotNet can be discussed here!

In addition, don't forget the beautiful piece of work that is Bobo's ongoing work with the Maxscript dotNet Resource page.
__________________
"There Really is No Secret"
Martin Brennand - mocha Product Manager - Imagineer Systems
 
Old 10-18-2007, 08:38 AM   #2
ypuech
Lord of the posts
portfolio
Yannick Puech
Software Engineer
Solid Angle SL
Madrid, España
 
Join Date: Jun 2005
Posts: 552
dotNet + MXS = MXS++
With the addition of dotNet in MAXScript, you can now develop powerful tools that you never thought possible!

dotNet bridge in MAXScript is very useful to access .Net classes:
- .Net forms controls
- file access
- XML read/write
- GDI+
- DirectX Managed classes (video and audio)
- OS informations
- etc.

You can also create your own .Net classes and use them in script. This can be used to share components with your asset and workflow applications for example. Think also interop between your 3D applications (Maya wit Python, XSI with C# and 3ds Max with dotNet can now share components and communicate more easily).

I've recently released a small Avi Player developed in MAXScript and dotNet : http://ypuechweb.free.fr/avi_player.html. It uses DirectX Managed classes (video and audio) and a HScrollBar control (very useful because there's no equivalent in MAXScript).
I also began the translation to dotNet and GDI+ of the "How To ... Develop a Bitmap Painting Tool In Nine Easy Steps". GDI+ is powerful but sometimes (very) slow.
I'll release this doc and others (about XML access, some .Net forms controls and managed classes creation and use in script) in a couple of days/weeks .

One of the limitation of the dotNet bridge is the impossibility to create and use managed arrays in MAXScript (corrected in Max 2008?).
__________________

Last edited by ypuech : 10-18-2007 at 08:41 AM.
 
Old 10-18-2007, 11:50 AM   #3
PEN
R&D/Technical Director
 
PEN's Avatar
portfolio
Paul Neale
PEN Productions
Canada
 
Join Date: Jun 2002
Posts: 7,415
I'll see what I can constribute as well as I have been using dotNet for the project I have been working on and have been using treeView, ListView, calanders, XML and others to get the job done. dotNet is far better then what we had with active X.
__________________
Paul Neale
http://paulneale.com
 
Old 10-18-2007, 02:04 PM   #4
PEN
R&D/Technical Director
 
PEN's Avatar
portfolio
Paul Neale
PEN Productions
Canada
 
Join Date: Jun 2002
Posts: 7,415
This is a timely thread. Can it please be made sticky?

I have an issue finaly that I can't resolve with a simple dotNetControl "system.windows.forms.textBox"

Some of the properties are not working as they should. The ones that I'm having issues with are acceptsTab and acceptsReturn, neither are having any affect on the control. multiLine has worked and I have also added scrollbars.

Any one used this before and have a solution?
__________________
Paul Neale
http://paulneale.com
 
Old 10-18-2007, 02:29 PM   #5
ypuech
Lord of the posts
portfolio
Yannick Puech
Software Engineer
Solid Angle SL
Madrid, España
 
Join Date: Jun 2005
Posts: 552
I would suggest to call Focus() on the TextBox. I had such problems with a RichTextBox control (other solution, useful to format and colour the text) and resolved them by calling Focus().
If it's a multiline TextBox make sure the Multiline property is set to true.
__________________
 
Old 10-18-2007, 02:34 PM   #6
PEN
R&D/Technical Director
 
PEN's Avatar
portfolio
Paul Neale
PEN Productions
Canada
 
Join Date: Jun 2002
Posts: 7,415
ypuech, can you explain to me what managed arrays are?
__________________
Paul Neale
http://paulneale.com
 
Old 10-18-2007, 03:35 PM   #7
ypuech
Lord of the posts
portfolio
Yannick Puech
Software Engineer
Solid Angle SL
Madrid, España
 
Join Date: Jun 2005
Posts: 552
Quote:
Originally Posted by PEN
ypuech, can you explain to me what managed arrays are?

Managed arrays are the arrays from .Net framework. In MAXScript you can't handle them. For example:

Code:
local Array = dotNetObject "System.Windows.Forms.TreeNode[]" 5 -- With a previously defined TreeNode object Array.Add Node -- Not possible to call Add method
__________________

Last edited by ypuech : 10-18-2007 at 03:44 PM.
 
Old 10-18-2007, 04:59 PM   #8
PEN
R&D/Technical Director
 
PEN's Avatar
portfolio
Paul Neale
PEN Productions
Canada
 
Join Date: Jun 2002
Posts: 7,415
Thanks for the explanation on the arrays.

As for the focus() it didn't help at all.

Here is what I have...
Code:
rollout test "Test" ( dotNetControl tb "system.windows.forms.textBox" height:80 on test open do ( tb.multiLine=true sb=dotNetClass "System.Windows.Forms.ScrollBars" tb.scrollBars=sb.vertical tb.acceptsReturn=true tb.acceptsTab=true tb.wordWrap=true tb.focus() ) ) createDialog test


Can any one get that to work?
__________________
Paul Neale
http://paulneale.com
 
Old 10-18-2007, 08:56 PM   #9
Light
Let there be Light
 
Light's Avatar
Houdini FX TD
Animatrix
Montreal, Canada
 
Join Date: Mar 2005
Posts: 987
Hi Paul,

Are you trying to set the focus to the textbox? If so, it works here.




Light
 
Old 10-18-2007, 09:06 PM   #10
ypuech
Lord of the posts
portfolio
Yannick Puech
Software Engineer
Solid Angle SL
Madrid, España
 
Join Date: Jun 2005
Posts: 552
Well, in fact the Enter and Tab keys aren't working in the TextBox. Yes, the focus is set but we cannot go to the next line with Enter and use the Tab key. I *think* the messages are intercepted by the main window of 3ds Max.
__________________
 
Old 10-18-2007, 11:51 PM   #11
erilaz
Stealthy Tea Monkey
 
erilaz's Avatar
portfolio
Martin Brennand
VFX Artist
Melbourne, Australia
 
Join Date: Jun 2002
Posts: 13,756
Quote:
Originally Posted by PEN
This is a timely thread. Can it please be made sticky?


No worries. I actually thought I already had!
__________________
"There Really is No Secret"
Martin Brennand - mocha Product Manager - Imagineer Systems
 
Old 10-19-2007, 12:15 AM   #12
erilaz
Stealthy Tea Monkey
 
erilaz's Avatar
portfolio
Martin Brennand
VFX Artist
Melbourne, Australia
 
Join Date: Jun 2002
Posts: 13,756
One thing i've been focusing on is the use of message boxes and all their meanings. Although I can call a messagebox with a simple text call via:

message = dotNetClass "System.Windows.Forms.MessageBox"
message.Show "Test"

I can't work out the call of the buttons. Do I need to have a separate object call to define the button properties in .Show? I think i'm getting the syntax confused.
__________________
"There Really is No Secret"
Martin Brennand - mocha Product Manager - Imagineer Systems
 
Old 10-19-2007, 06:41 AM   #13
specxor
Frequenter
portfolio
David Mackenzie
Technical Director
Sydney, Australia
 
Join Date: Feb 2005
Posts: 122
Quote:
Originally Posted by erilaz
In light of David Mackenzie's excellent Python+MXS thread, I figured it would make sense to have a thread focused on dotNet as well. Admittedly this is mainly because i'm interested in using it right now, but any and all techniques about dotNet can be discussed here!

In addition, don't forget the beautiful piece of work that is Bobo's ongoing work with the Maxscript dotNet Resource page.



I don't no that I would say excellent! but ill take any complements I can get so thanks Martin. I am very excited about the this thread as I am using dotnet more and more in my scripts and am sure I will have lots of questions...

Moving on DotNet, I have some trouble creating a SQL connection in MXS. I have been trying to use System.Data.Odbc but have had no luck Im sure there is something simple i have to do to get this to work but I'm having a mental blank!

I am presuming that it should be some thing like db = dotNetClass "System.Data.Odbc"
but all I get is undefined... Any help would very much appreciated!


Cheers
Dave
 
Old 10-19-2007, 08:15 AM   #14
ypuech
Lord of the posts
portfolio
Yannick Puech
Software Engineer
Solid Angle SL
Madrid, España
 
Join Date: Jun 2005
Posts: 552
Quote:
Originally Posted by specxor
Moving on DotNet, I have some trouble creating a SQL connection in MXS. I have been trying to use System.Data.Odbc but have had no luck Im sure there is something simple i have to do to get this to work but I'm having a mental blank!

I am presuming that it should be some thing like db = dotNetClass "System.Data.Odbc"
but all I get is undefined... Any help would very much appreciated!


Cheers
Dave

System.Data.Odbc is a namespace name, not a class name.

I've not much experience with Database usage but I looked at the MSDN documentation and found some examples.

Here is one:
Code:
connectionString = "Driver={SQL Native Client};Server=(local);Trusted_Connection=Yes;Data base=AdventureWorks;" connection = dotNetObject "System.Data.Odbc.OdbcConnection" connectionString connection.Open()


You can have a look at :
the namespace documentation : http://msdn2.microsoft.com/en-us/li....data.odbc.aspx
this tutorial : http://www.functionx.com/vbnet/odbc/paradox.htm
__________________
 
Old 10-19-2007, 11:06 AM   #15
PEN
R&D/Technical Director
 
PEN's Avatar
portfolio
Paul Neale
PEN Productions
Canada
 
Join Date: Jun 2002
Posts: 7,415
Quote:
Originally Posted by Light
Hi Paul,

Are you trying to set the focus to the textbox? If so, it works here.
Light


Thanks but it is the tab and enter and I think that I have come to the same conclusion as ypuech, Max must be interfering with the operation. I'm just going to live with it at the moment as I have bigger things to deal with.
__________________
Paul Neale
http://paulneale.com
 
reply share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 06:36 PM.


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