Removing vertices inside mesh

Is there a way to remove vertices inside the mesh with a script or similar? Below is a simple example, is there a way to remove the inner cube without manually selecting the vertices and removing them?

Also notice how the inner cube is attached to the outer cube with several faces.

Attachments


There are no scripts that I am aware of that will remove vertices that are inside objects. What is the goal of your question?

I was planning on building something neat with the lego brick models I made. To make it easier for myself I was going to just duplicate the full bricks as is to the build but that would have caused a lot of faces to be inside the build making it messy.