예제 #1
0
		if lastVertex != vertices.get(2*b):
			# New polyline
			polyline = ArrayList()
			listOfPolylines.add(polyline)
			polyline.add(vertices.get(2*b))
		lastVertex = vertices.get(2*b+1)
		polyline.add(lastVertex)
	print "Group "+str(bId)+" contains "+str(listOfPolylines.size())+" polylines and "+str(listBeamId.size()+1)+" vertices"
	mapGroupToListOfPolylines.put(bId, listOfPolylines)

for bId in bgroupMap.keySet():
	listBeamId = bgroupMap.get(bId)
	listOfPolylines = mapGroupToListOfPolylines.get(bId)
	nrPoly = listOfPolylines.size()
	for numPoly in xrange(nrPoly):
		polyline = listOfPolylines.get(numPoly)
		listM = ArrayList()
		for v in polyline:
			listM.add(EuclidianMetric3D(size))
		#for v in polyline:
		#	print v
		print "Remesh polyline "+str(numPoly+1)+"/"+str(nrPoly)+" of group "+str(bId)+"/"+str(bgroupMap.size())+" "+str(polyline.size())+" vertices"
		result = RemeshPolyline(mesh, polyline, listM).compute()
		for i in xrange(result.size() - 1):
			mesh.addBeam(result.get(i), result.get(i+1), bId)
		print "  New polyline: "+str(result.size())+" vertices"
		#for v in result:
		#	print v

MeshWriter.writeObject3D(mesh, outDir, "")
예제 #2
0
outDir = args[1]
if options.size:
	size = options.size
else:
	size = 1.0

mtb = MeshTraitsBuilder.getDefault3D()
mtb.addNodeList()
mesh = Mesh(mtb)
MeshReader.readObject3D(mesh, xmlDir)

polylines=PolylineFactory(mesh)
mesh.resetBeams()
for entry in polylines.entrySet():
  groupId = entry.key
  for polyline in entry.value:
		listM = ArrayList()
		for v in polyline:
			listM.add(EuclidianMetric3D(size))
		#for v in polyline:
		#	print v
		print "Remesh polyline "+str(numPoly+1)+"/"+str(nrPoly)+" of group "+str(bId)+"/"+str(bgroupMap.size())+" "+str(polyline.size())+" vertices"
		result = RemeshPolyline(mesh, polyline, listM).compute()
		for i in xrange(result.size() - 1):
			mesh.addBeam(result.get(i), result.get(i+1), groupId)
		print "  New polyline: "+str(result.size())+" vertices"
		#for v in result:
		#	print v

MeshWriter.writeObject3D(mesh, outDir, "")