dxf-viewer icon indicating copy to clipboard operation
dxf-viewer copied to clipboard

How to compute scale? The dxf is vector illustration, how to compute scale in dxf-viewer ?

Open thinkyoyo opened this issue 1 year ago • 2 comments

The dxf is vector illustration, how to compute scale in dxf-viewer when we change the viewer size?

thinkyoyo avatar Jan 15 '24 02:01 thinkyoyo

This is defined by three.js OrthographicCamera which can be obtained by viewer.GetCamera(). Three.js world space is DXF model space with some offset applied, scale is not changed, so you can use something like (camera.right - camera.left) / canvasWidth to get model units per pixel.

vagran avatar Jan 15 '24 08:01 vagran

This is defined by three.js OrthographicCamera which can be obtained by viewer.GetCamera(). Three.js world space is DXF model space with some offset applied, scale is not changed, so you can use something like (camera.right - camera.left) / canvasWidth to get model units per pixel.

Please accept my best thanks. I will try use viewer.GetCamera() in my project. It would be great to provide this method by dxf-viewer. Thanks again for your reply

thinkyoyo avatar Jan 15 '24 11:01 thinkyoyo