Dealing with transparent objects

I am working on a project which consists of a mixture of opaque objects and some glass (it is a diagram of a science experiment). I want Freestyle to draw solid black lines on all visible creases. However, the Visibility parameter does not take alpha transparency into account. If an object is behind a glass pane, Blender will not render the lines as it considers them invisible. Would it be possible to program the renderer to ignore glass objects with Python?

Can you not break down the scene into layers and composite them together post processing

I agree with Richard, and that is definitely the approach that I would take here.

You can, for example, use RenderLayers (and layer-specific lights and so-on) to separate out the various components of the scene that you need to be treated separately. One of them might be a render-layer that quite literally doesn’t see the transparent object, so that it captures “what’s behind the glass.” (Perhaps the glass is used as an alpha-mask so that this layer includes only what is behind the glass … or, a particular glass.)

Meanwhile, another render-layer captures only the things that are not occluded by any glass.

Another render-layer might capture only the glass objects themselves.

(If you like, each of these can be separately rendered.)

And now what you do with all of these things is to use compositing-nodes to combine these various “channels” of information together. I reckon this final step to be like the “mix-down” that occurs at the end of preparing a record. The finished product, which sounds “so natural,” actually most-decidedly isn’t. Rather, it’s “a thing that has been assembled.” It’s been assembled so artfully that your eyes and ears accept it, neither noticing nor particularly caring-about the functional artistry that went into its making.