For the people who end up here. I typically use trimesh
to handle and visualize meshes and since trimesh does not support WRL/VRML...
import trimesh
def read_wrl(file_path):
with open(file_path, 'r') as f:
s = f.read()
s2 = re.sub(r'\n|\r|,', ' ', s)
s3 = re.sub('\s+', ' ', s2)
l1 = re.search(r'point \[(.*?)\]', s3).group(1).strip().split()
points = np.float32(l1).reshape((-1,3))
l2 = re.search(r'coordIndex \[(.*?)\]', s3).group(1).strip().split()
coordIndexs = np.int32(l2).reshape((-1,4))
mesh = trimesh.Trimesh(vertices=points, faces=coordIndexs[:,:3])
return mesh