Jump to content

exporting 2D plans & elevations - how best to go about this


Recommended Posts

Hello,

At some point soon I would like to be able to create 2D views of my scene as viewed from an orthographic camera which I will then output as a vector line drawing in, say, DXF using maker.js or as a PDF using some library or other.

Generally, can anyone suggest how best to go about this please - I just cannot think of where to start.

For anyone familiar with CAD, this is like Make2D in Rhino or FLATSHOT in AutoCAD.

I guess this is computationally expensive as Rhino can take a while to do this, but that generates from NURBs, not meshes.

Hope this isn't too vague a question.

Thank you.

Link to comment
Share on other sites

Thank you @Sebavan - I was thinking of extracting each individual visible vertex of a mesh and using that somehow.

I could render as lines, then get the server to run Potrace  to vectorise it, but I will lose accuracy and so this is not really an option. It needs to be millimetre perfect.

I will have a think.

Link to comment
Share on other sites

4 hours ago, babbleon said:

is there a way to check if one particular vertex of a mesh is visible from a camera?

There is an interface called ICullable, which has 2 methods for checking if it's in a frustum:
https://github.com/BabylonJS/Babylon.js/blob/147b793e34a64889b32ab2148834fea3ba92db69/src/Culling/babylon.boundingInfo.ts#L25

Here is a PG that I made using meshes, so not a vertex.  I just want to make sure this is not what you are looking for:
https://playground.babylonjs.com/#050P3M

Camera also has planes that you can use and also camera.isInFrustum() methods that take ICullable.  Although completely inFrustum doesn't make sense for a Vector3, so could be same implementation for both, so I think you can work from those planes and view projection matrix.  There must be a built-in method somebody can give you, but otherwise hopefully that is enough to get you going.  I'm really busy right now or would dig into some math for ya!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...