noch ein geschenk von mir. um kanten zu isolieren.
damit kann man zb. die kanten wie oben abgebildet aus einer geometrie filtern.
def filterEDGE(rm):
#dirk hochegger 2013
sel = cmds.text('selOBJ',q = True,l = True)
thrshld = .1#float(cmds.textField('rsVAL1',q = True, tx=True))
cntE = cmds.polyEvaluate(sel,e = True)
ids = {}
id = 0
for i in range(cntE):
cmds.currentTime(i)
tmpSTR = sel+'.e['+str(i)+']'
faces = cmds.polyInfo(tmpSTR, ef = True)
faces = faces[0].split(' ')
tmpID = 0
tmpF = {}
for f in faces:
if(f != ''):
tmpF[tmpID] = f
tmpID +=1
cntF = tmpID-3;
if(cntF > 1):
face0ID = tmpF[2]
face1ID = tmpF[3]
tmpSTR0 = sel+'.f['+str(face0ID)+']'
tmpSTR1 = sel+'.f['+str(face1ID)+']'
face0NRML = cmds.polyInfo(tmpSTR0,fn = True )
face1NRML = cmds.polyInfo(tmpSTR1,fn = True )
face0NRML = face0NRML[0].split(' ')
face1NRML = face1NRML[0].split(' ')
tmpID = 0
tmpN = {}
for n in face0NRML:
if(n != ''):
tmpN[tmpID] = n
tmpID +=1
face0NRML = tmpN
tmpID = 0
tmpN = {}
for n in face1NRML:
if(n != ''):
tmpN[tmpID] = n
tmpID +=1
face1NRML = tmpN
fn0 = [float(face0NRML[2]),float(face0NRML[3]),float(face0NRML[4])]
fn1 = [float(face1NRML[2]),float(face1NRML[3]),float(face1NRML[4])]
len = cutGEO().dot(fn0, fn1)
if((len >= 1-thrshld)and(len < 1+thrshld)):
pass
else:
ids[id] = i
id += 1
strg = 'filter edges:'+str(i)
windowBRICK().pb(cntE,1,strg)
windowBRICK().pb(cntE,1,False)
tmpLST1_ = {}
tmpSTR0 = sel+'.e['+str(ids[0])+']'
cmds.select(tmpSTR0,r = True)
id1 = 0
for i in range(id):
tmpSTR0 = sel+'.e['+str(ids[i])+']'
cmds.select(tmpSTR0,add = True)
tmpLST1_[i] = tmpSTR0
id1 += 1
strg = 'write string:'+str(tmpSTR0)
windowBRICK().pb(id,1,strg)
windowBRICK().pb(id,1,False)
conv = ''
for i in range(id1):
conv += '|'+str(tmpLST1_[i])
strg = 'write string:'+str(tmpLST1_[i])
windowBRICK().pb(id1,1,strg)
windowBRICK().pb(id1,1,False)
cmds.textScrollList('tsl0', edit = True, append=conv)
items = cmds.textScrollList('tsl0', q = True, ai=True)
itemsCNT = 0
for it in items:
itemsCNT += 1
cmds.text( 'ptBL_txt',edit = True,l=itemsCNT)
def getVEC(rm,id,sel):
#edge 0
tmpSTR = sel+'.e['+str(id)+']'
verts = cmds.polyInfo(tmpSTR,ev = True);
verts = verts[0].split(' ')
tmpID = 0
tmpV0 = {}
for v in verts:
if(v != ''):
tmpV0[tmpID] = v
tmpID +=1
v0 = int(tmpV0[2])
v1 = int(tmpV0[3])
tmpSTR = sel+'.vtx['+str(v0)+']'
posV0 = cmds.xform(tmpSTR,q = True, a = True, t = True)
tmpSTR = sel+'.vtx['+str(v1)+']'
posV1 = cmds.xform(tmpSTR,q = True, a = True, t = True)
vec = [posV0[0]-posV1[0],posV0[1]-posV1[1],posV0[2]-posV1[2]]
return vec
isoliert abweichung auf einem raster
def searchEDGES(rm,*args):
#dirk hochegger 2013
thrshld = float(cmds.textField('rsVAL', q = True , tx = True))
sel = cmds.text('selOBJ',q = True,l=True)
cntV = cmds.polyEvaluate(sel,v = True)
ids_ = {}
id = 0
for i in range(cntV):
cmds.currentTime(i)
tmpSTR = sel+'.vtx['+str(i)+']'
edges = cmds.polyInfo(tmpSTR, ve = True)
edges = edges[0].split(' ')
tmpID = 0
tmpE = {}
for e in edges:
if(e != ''):
tmpE[tmpID] = e
tmpID +=1
eID = 0
edges_ = {}
for e in range(tmpID-2):
edges_[e] = tmpE[2+e]
eID += 1
len = 0
for e in range((tmpID-2)/2):
vec0 = rm.getVEC(edges_[e],sel)
vec1 = rm.getVEC(edges_[1+e],sel)
len += cutGEO().dot(vec0, vec1)
#length vector
len /= (tmpID-2)/2
if((len >= -thrshld)and(len <= thrshld)):
ids_[id] = edges_[0]
ids_[id+1] = edges_[1]
if(((tmpID-2)/2) == 2):
ids_[id+2] = edges_[2]
id += 3
else:
id += 2
strg = 'calc edges'+str(i)
windowBRICK().pb(cntV,1,strg)
windowBRICK().pb(cntV,1,False)
cntIDS = id
tmpSTR = sel+'.e['+str(int(ids_[0]))+']'
cmds.select(tmpSTR)
for i in range(cntIDS):
tmpSTR = sel+'.e['+str(int(ids_[i]))+']'
cmds.select(tmpSTR,add = True)
strg = 'getting edges'+str(tmpSTR)
windowBRICK().pb(cntIDS,1,strg)
windowBRICK().pb(cntIDS,1,False)
bitte helft mir nach ozeaninien.
Keine Kommentare:
Kommentar veröffentlichen