PDA

View Full Version : How to use this C# library?


martinB
08-15-2011, 05:22 PM
How would I go about using this C# library:
http://miconvexhull.codeplex.com/documentation

My problem is the return value of the principal function of that library:
List<IVertexConvHull> ConvexHull.FindConvexHull(optional int dimensions)

List<IVertexConvHull> ConvexHull.FindConvexHull(out List<IFaceConvHull> faces, Type face_Type, optional int dimensions)


Any suggestions how to use/access that using MAXScript?

Thanks a lot in advance
-- MartinB

lo
08-15-2011, 08:47 PM
Have you been able to even load the dotnet assembly?? It gives me an error.

The return type is a generic list of type <IVertexConvHull>
If you can tell me how you loaded the assembly I'll try to get it to work...


edit: found the problem, I forgot to un-sandbox the dll.

lo
08-15-2011, 09:28 PM
Something seems strange in that assembly. It's referencing other assemblies not included in the dll (namely StarMath library).
I downloaded StarMath dll from CodePlex, but it seems that MIConvexHull is calling methods in StarMath that are not found in the library.

Here's what I have so far:

assembly = dotNetClass "System.Reflection.Assembly"

r2 = assembly.loadfrom "C:\\StarMath.dll"
r = assembly.loadfrom "C:\\MIConvexHullPlugin.dll"

myMesh = snapShotAsMesh $Teapot01
myVerts = #()

myArr = dotNetObject "System.Double[,]" myMesh.numVerts 3

for i = 0 to myMesh.numVerts-1 do
(
local v = getVert myMesh (i+1)
myArr.Set i 0 (v.x as double)
myArr.Set i 1 (v.y as double)
myArr.Set i 2 (v.z as double)
)

chClass = (dotNetClass "MIConvexHull.ConvexHull")
chClass.inputvertices myArr

newVerts = chClass.FindConvexHull 2

CGTalk Moderation
08-15-2011, 09:28 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.