<jupyter_start><jupyter_text>to delete extra faces(more than 4 edges) if subdivided with catmulclark or other weird subdivision that connects the mesh with the ground<jupyter_code>delete_faces =[]

for fkey in mesh.faces():
    if len(mesh.face_vertices(fkey)) > 4:
        delete_faces.append(fkey)

for fkey in delete_faces:       
    mesh.delete_face(fkey)
    mesh.remove_unused_vertices()<jupyter_output><empty_output><jupyter_text>scale up the form if needed<jupyter_code>scaled_mesh = mesh.copy()

box_points = mesh_bounding_box_xy(scaled_mesh)
base_mesh = scaled_mesh.from_points(box_points)
centroid = base_mesh.centroid()
#print (centroid)
frame = Frame(centroid,Vector(1,0,0),Vector(0,1,0))

S = Scale.from_factors([100, 100, 100], frame)
scaled_mesh.transform(S)<jupyter_output><empty_output><jupyter_text>Visualise and export Initial Mesh<jupyter_code>mesh.to_json(FILE_O1)
scaled_mesh.to_json(FILE_O2)

print(mesh)
from pythreejs import *
import numpy as np
from IPython.display import display

mesh = scaled_mesh.copy()

vertices = []
for face in mesh.faces():
    for v in mesh.face_vertices(face):
        xyz = mesh.vertex_attributes(v, "xyz")
        vertices.append(xyz)

# print(vertices)
vertices = BufferAttribute(
    array = np.array(vertices,dtype=np.float32),
    normalized = False)

# print(vertices)

geometry = BufferGeometry(
    attributes={'position': vertices})

print(geometry)
geometry.exec_three_obj_method('computeVertexNormals')

mesh_3j = Mesh(geometry=geometry,
           material=MeshLambertMaterial(color='red'),
           position=[0,0,0])
print(geometry)
print(type(mesh_3j))
c = PerspectiveCamera(position=[0, 5, 5], up=[0, 1, 0],
                      children=[DirectionalLight(color='white', position=[3, 5, 1], intensity=0.5)])

scene=Scene(children=[mesh_3j,c, AmbientLight(color='#777777')])


renderer = Renderer(camera=c, 
                    scene=scene,
                    width=800,
                    height=800,
                    controls=[OrbitControls(controlling=c)])
display(renderer)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12086330935251799, 'fraction_numerical': 0.023980815347721823, 'mean_word_length': 4.577540106951871, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '6352', 'license': 'MIT', 'n_tokens_mistral': 744, 'n_tokens_neox': 704, 'n_words': 131, 'path': '3_Materialization/Tutorial7/Materialisation_Test.ipynb', 'repo_name': 'BlockResearchGroup/CSD2_2022', 'size': '2085'}