Hi all,
I have to attach two mesh and to do it I have to use the .Net API.
Every time I need to find something in the c# API I'm completely lost.
Can I have some help?
Thanks
Solved! Go to Solution.
I need to add this feature on the BabylonExporter unfortunately
https://github.com/BabylonJS/Exporters
I need to do it in a proper way or they will never accept the pull request
So what's the problem to pass a string which is holding the MXS code to a C# function? You'll have to have 3dsmax running anyway..
Sorry I already had this discussion with someone else, and make me completely upset.
It is not a big priority for me right now, if I want to do it fast I will do it as you said.
But calling max script is a really dirty solution, there is no way to maintain and verify that string in the long term.
I leave it up to you. It was just a suggestion. IMHO maintaining a MXS file is more simple than with C#. E.g. no need to compile against a certain Max Version, no VS debugging necessary, simple interactive development, ..
You have to use the epi, Editable Poly interface to do that.
To do that, get the node, the ref object, cast it to polyobject then get the interface EPoly. The EPoly interface has the attach method which you can use to attach multiple objects together.
Here you can find how to get the EPoly interface properly.
How do you do the conversion?
IEPoly epoly = (IEPoly)myObject.GetInterface( EPOLY13_INTERFACE );
EPOLY13_INTERFACE does not exist.
class EPolyInterface { private static readonly IGlobal Global = GlobalInterface.Instance; public static readonly IInterface_ID EditablePolyInterfaceID = Global.Interface_ID.Create(0x092779, 0x634020); }
I'm trying to do what you say and I get the EditablePoly Interface without problem, thanks to you.
bu this cast should work, instead epoly is always null
What am I missing?
IEPoly epoly = (IEPoly)mNode.GetInterface(EPolyInterface.EditablePolyInterfaceID);
So this actually works
IEPoly epoly = (IEPoly)mNode.ActualINode.ObjectRef.GetInterface( Loader.EditablePoly);
Before to do this I need to convert the mesh in a Editable Poly
How can I do it?
Thanks
For the MNMesh class, there are two methods, which can convert your object to an MNMesh or bact to a Mesh object.
These are the two methods:
IMesh m = Global.Mesh; IMNMesh mn = Global.MNMesh; mn.OutToTri(m); mn.SetFromTri(m);
But if you have a Mesh object (Editable Mesh), then you can add one mesh object to the other one since the IMesh has an Add method.
IMesh mesh1 = Global.IMesh.Create(); IMesh mesh2 = Global.IMesh.Create(); mesh1.Add(mesh2);
And in fact: Doing operations on a mesh object is almost always faster then doing the same on an Editable Poly object. So first do your job first on a Mesh object, then convert it to an EditablePoly object.
So thanks again, I'm doing some progress understanding how does it work under the hood
But this has still no sense for me
How you see in the watch section seems like the add function doesn't work, or probably I' m missing something else
I'm doing this on a simple teapot
Thanks again for your patient
Can't find what you're looking for? Ask the community or share your knowledge.