gdsestimating / three-dxf

A dxf viewer for the browser using three.js
MIT License
542 stars 171 forks source link

Z-index issue #23

Open DmitryS1990 opened 6 years ago

DmitryS1990 commented 6 years ago

When creating dxf file we can use "mirror" command. It does not change the shape of entity, but change z-extrusion direction, which is not taken to the account in your library when image is drawn. In my work I make center of ellipce to be the [0,0], then command "curve" look like this: var curve = new THREE.EllipseCurve( 0, 0, xrad, yrad, alpha, beta, false, rotation ); The trick is to use: ctx.scale(1, Math.sign(z_extrussion)); while generating image for user, where z_extrussion is our 230 line value. All we have to do in the end is to move canvas zero position back to it's prewious position. Thank you for reading :-)

bzuillsmith commented 2 years ago

I don't really know how to test this or what the use-case is because the library has mostly been geared toward 2D drafting views. I'll probably close this issue soon unless someone wants to do a pull request with tests.