示例#1
0
    def gridify(self,*args):
        #take the selected object and create a new object that are the point inside
        #use a default stepsize for the grid
        #use some usefull tools from histovol.grid ?
        #probably need the normal for that
        mode = self.getVal(self.mode)
        step = self.getVal(self.grid_step)
        if self.object_target is None :
            self.object_target = self.helper.getCurrentSelection()[0]
        mesh = self.object_target
        #canwe usethe ogranelle mesh system from autopack
        from autopack.Organelle import Organelle
        faces,vertices,vnormals,fn = self.helper.DecomposeMesh(mesh,
                                    edit=False,copy=False,tri=True,transform=True,fn=True)
        o1 = Organelle(self.helper.getName(mesh),vertices, faces, vnormals,fnormals=fn)
        o1.ref_obj = mesh
        o1.number = 1
        b=self.helper.getObject("BBOX")
        if b is None :
            b = self.helper.Box("BBOX", cornerPoints=o1.bb)
            bb=o1.bb
        else :
            bb=self.helper.getCornerPointCube(b)
        display = self.getVal(self.rt_display)
        useFix= self.getVal(self.useFix)
        if mode =="bhtree_dot":
            inner, surface = o1.getSurfaceInnerPoints(bb,step,display=display,useFix=useFix)
        elif mode ==  "sdf_fixdimension":
            inner, surface = o1.getSurfaceInnerPoints_sdf(bb,step,display=display,useFix=useFix)
        elif mode ==  "sdf_interpolate":
            inner, surface = o1.getSurfaceInnerPoints_sdf_interpolate(bb,step,display=display,useFix=useFix)
        elif mode ==  "jordan_raycast":
            inner, surface = o1.getSurfaceInnerPoints_jordan(bb,step,display=display,useFix=useFix)
        elif mode ==  "jordan_3raycast":
            inner, surface = o1.getSurfaceInnerPoints_jordan(bb,step,display=display,useFix=useFix,ray=3)
#        inner, surface = o1.getSurfaceInnerPoints(bb,step,display=display,useFix=useFix)
        n1=n=o1.name+"_innerPts"
        n2=o1.name+"_surfacePts"
        if self.helper.host == "maya" :
            n=o1.name+"_innerPtsds"
        s = self.helper.getObject(n)
        if s is None :
            s = self.helper.PointCloudObject(n1, vertices=inner )
            s2 = self.helper.PointCloudObject(n2, vertices=surface )
        else :
            if self.helper.host == "c4d" :
                self.helper.updateMesh(s,vertices=inner)
            else :
                self.helper.updateParticle(s,inner,None)
示例#2
0
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 29 15:05:07 2012

@author: -
"""
import sys
sys.path.append("/Users/ludo/DEV/Autofill_svn_test/autofill/trunk")
sys.path.append("/Users/ludo/DEV/MGLTOOLS/mgl32/MGLToolsPckgs/")
sys.path.append("/Users/ludo/DEV/MGLTOOLS/mgl32/MGLToolsPckgs/PIL")
import numpy
from autopack.Organelle import Organelle
o1 = Organelle("vesicle_Mesh",None, None, None,
               filename="/Users/ludo/DEV/Autofill_svn_test/autofill/trunk/autopack/cache_organelles/vesicle")
print "ok o1"
inner, surface = o1.getSurfaceInnerPointsSDF(o1.bb,20.0)
#print inner
# 
#from UTpackages.UTsdf import utsdf
#dim = 64
#dim1=dim+1
#size = dim1*dim1*dim1
# #can be 16,32,64,128,256,512,1024
#verts = numpy.array(o1.vertices)
#tris = numpy.array(o1.faces,"int")
#utsdf.setParameters(dim,0,1,[0,0,0,0,0,0])#size, bool isNormalFlip, bool insideZero,bufferArr
#datap = utsdf.computeSDF(verts,tris)

#try :
#    datap = utsdf.computeSDF(verts,tris)
#except :
示例#3
0
    def gridify(self, *args):
        #take the selected object and create a new object that are the point inside
        #use a default stepsize for the grid
        #use some usefull tools from histovol.grid ?
        #probably need the normal for that
        mode = self.getVal(self.mode)
        step = self.getVal(self.grid_step)
        if self.object_target is None:
            self.object_target = self.helper.getCurrentSelection()[0]
        mesh = self.object_target
        #canwe usethe ogranelle mesh system from autopack
        from autopack.Organelle import Organelle
        faces, vertices, vnormals, fn = self.helper.DecomposeMesh(
            mesh, edit=False, copy=False, tri=True, transform=True, fn=True)
        o1 = Organelle(self.helper.getName(mesh),
                       vertices,
                       faces,
                       vnormals,
                       fnormals=fn)
        o1.ref_obj = mesh
        o1.number = 1
        b = self.helper.getObject("BBOX")
        if b is None:
            b = self.helper.Box("BBOX", cornerPoints=o1.bb)
            bb = o1.bb
        else:
            bb = self.helper.getCornerPointCube(b)
        display = self.getVal(self.rt_display)
        useFix = self.getVal(self.useFix)
        if mode == "bhtree_dot":
            inner, surface = o1.getSurfaceInnerPoints(bb,
                                                      step,
                                                      display=display,
                                                      useFix=useFix)
        elif mode == "sdf_fixdimension":
            inner, surface = o1.getSurfaceInnerPoints_sdf(bb,
                                                          step,
                                                          display=display,
                                                          useFix=useFix)
        elif mode == "sdf_interpolate":
            inner, surface = o1.getSurfaceInnerPoints_sdf_interpolate(
                bb, step, display=display, useFix=useFix)
        elif mode == "jordan_raycast":
            inner, surface = o1.getSurfaceInnerPoints_jordan(bb,
                                                             step,
                                                             display=display,
                                                             useFix=useFix)
        elif mode == "jordan_3raycast":
            inner, surface = o1.getSurfaceInnerPoints_jordan(bb,
                                                             step,
                                                             display=display,
                                                             useFix=useFix,
                                                             ray=3)
#        inner, surface = o1.getSurfaceInnerPoints(bb,step,display=display,useFix=useFix)
        n1 = n = o1.name + "_innerPts"
        n2 = o1.name + "_surfacePts"
        if self.helper.host == "maya":
            n = o1.name + "_innerPtsds"
        s = self.helper.getObject(n)
        if s is None:
            s = self.helper.PointCloudObject(n1, vertices=inner)
            s2 = self.helper.PointCloudObject(n2, vertices=surface)
        else:
            if self.helper.host == "c4d":
                self.helper.updateMesh(s, vertices=inner)
            else:
                self.helper.updateParticle(s, inner, None)
示例#4
0
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 29 15:05:07 2012

@author: -
"""
import sys
sys.path.append("/Users/ludo/DEV/Autofill_svn_test/autofill/trunk")
sys.path.append("/Users/ludo/DEV/MGLTOOLS/mgl32/MGLToolsPckgs/")
sys.path.append("/Users/ludo/DEV/MGLTOOLS/mgl32/MGLToolsPckgs/PIL")
import numpy
from autopack.Organelle import Organelle
o1 = Organelle(
    "vesicle_Mesh",
    None,
    None,
    None,
    filename=
    "/Users/ludo/DEV/Autofill_svn_test/autofill/trunk/autopack/cache_organelles/vesicle"
)
print "ok o1"
inner, surface = o1.getSurfaceInnerPointsSDF(o1.bb, 20.0)
#print inner
#
#from UTpackages.UTsdf import utsdf
#dim = 64
#dim1=dim+1
#size = dim1*dim1*dim1
# #can be 16,32,64,128,256,512,1024
#verts = numpy.array(o1.vertices)
#tris = numpy.array(o1.faces,"int")
#utsdf.setParameters(dim,0,1,[0,0,0,0,0,0])#size, bool isNormalFlip, bool insideZero,bufferArr