Notifications
Clear all

[Closed] Share data between 2 running 3dsmax without saving file?

Hi all,
I just wondering is that possible to share (transfer) data between 2 running 3ds max?For example,I have some functions and global value running in the first 3dsmax:


fn fun_in_max_01=
(
myfun="1234"
)
rollout rollout_in_max_01 ""
(
lable myrollout ""
)
global myglobal=223
for i=1 to 10 do print i

When I switch to running 3dsmax 2,I can get the function + rollout + global data(totally “copy” from the first one) in a better way(memory/buffer/pipes) without saving a file and load it,is that possible?Any idea?

12 Replies

I doubt there is an easy way to access all the globals of one max instance from another max instance. That’s generally not how any software works.

There are a few possible options for transferring data: setting up servers-clients using dotNet sockets would be a pretty involved option, but for simple stuff I’ve found using the clipboard is sufficient.

I don’t know of any way to reuse functions and rollouts between instances.
There’s the ancient COM for calling functions outside max and receiving return values, but there’s no telling which instance of max will be handling the requests.

1 Reply
(@momo2012)
Joined: 10 months ago

Posts: 0

You mean OLE Automation?(ancient COM)
How to use clipboard,is there an example to share?thanks !

You could use the clipboard?

Is the SetclipboardText function?

Yes, by COM I meant OLE automation. Not very reliable for transferring data between max instances.

By clipboard I just meant the primitive means of setClipboardText() and [i]getClipboardText/i. It’s a cheap solution for cases when you’re just alt-tabbing between instances and want some settings passed. The most primitive solution is to just initiate the write and read manually when you’re switching; I kind of prefer that to any automatic solution, as having it automated may clobber something useful you had Ctrl+C’d recently.
Come up with some unique prefix for the string to identify what script the data originated from, though…
Hierarchical data you could either format to xml, or just make a function that outputs maxscript code that evaluates to nested arrays/structs if you feel particularly dirty that day.

1 Reply
(@momo2012)
Joined: 10 months ago

Posts: 0

Thanks for your suggestion,if there is a another better solution,I think this is the best one,OK,I am considering of how to use this way to handle data.

Avoid any headaches working with the COM interface and simply use the Clipboard as David suggested. For what you have described it is more than convenient.

You can put whatever you want in the Clipboard, a whole Max scene if you wanted.

3 Replies
(@momo2012)
Joined: 10 months ago

Posts: 0

Thanks for the link,it seems the clipboard can do too many thing,I have a more further question,if using clipboard,do you have any idea to keep some important data “safe”?I know there is no absolutely safe way,but a “relatively safe” way?

(@polytools3d)
Joined: 10 months ago

Posts: 0

If by “safe” you mean to prevent another application to overwrite the Clipboard information, you should validate the information before pasting it, to prevent any crash. Although it is unlikely other application will take control of the clipboard by itself.

On the other hand, if by “safe” you mean if you can put the place where the Holy Grail is hidden in the clipboard and prevent anyone else to read it, the answer is no, there is no way, other than encrypting and praying. Same rule applies to any other technique you decide to use.

The Clipboard is just a piece of memory, either in the RAM or HD, and the rule is very simple, once the data is in the user’s hands, it is up to the users what they will do with it.

(@momo2012)
Joined: 10 months ago

Posts: 0

Got it ,thanks too much!

You could encrypt it before giving to the clipboard and then decrypt it the other side, so that only your tools would know what the data was.

1 Reply
(@momo2012)
Joined: 10 months ago

Posts: 0

I know that,but in a client,you at last have to decrypt the code back to normal,the normal data will be not safe,anyway,thanks for idea and help.