Producing 2D images

I have to producde 2D images in memory of a 3D component in my model, without altering the moidel. Preferably i create an array of lines or points that connect to make the 2D shape i need.

I have to produce a 2D image from each side of a components bounding box (Front, back, left, right, top, bottom and vertical center cut)

I have 2 solutions :

  1. Produce a plane on the cut to make the view. Project all points to the plane, do some sorting and organizing and produce a bunch of lines from the resulting points
  2. Make a face in the position and direction i need, intersect the face with the component, take all edges in the new group and produce an image.

I got both solutions working, but both have their downsides.

Is there a good way to do something like this in memory, without altering the model?

You can simply use standard views (front, left, right, etc) with the camera in parallel projection, not perspective. Done.

2D vector geometry or 2D raster image ?

You can set up Scene pages for each of these views, “Section” view included.

Also set up a scene page explicitly for modeling called “Work” or “Model” etc. This is the scene you’d use to do modeling and pan and orbit, etc. It doesn’t matter how the camera is left if this is the only scene that you model in and change the camera.

In Model Info > Animation … switch off “Enable scene transitions” (faster switching between the views.)

Now whatever code you use, you can leverage these preset scene page camera views.

What are the downsides?

Not if you want to replicate SketchUp’s render pipeline yourself.

(Btw, this is using the Ruby API, right?)