OpenJSCAD.org icon indicating copy to clipboard operation
OpenJSCAD.org copied to clipboard

[Feature Request] Wire frame mode

Open ikeji opened this issue 3 years ago • 4 comments

I want to have Wire frame view in OpenJSCAD.

For example, when I have cube with hole. With current view, it's difficult to see how deep the hole.

Here is screenshots from FreeCAD.

Normal View 20210723120238

Wire frame View 20210723120300

ikeji avatar Jul 23 '21 03:07 ikeji

@ikeji the sample in your screenshot is actually not wireframe but outline. Wireframe would show all vertices.

This would be a nice feature to have, but may be a long time until available.

I have two alternatives that could help you with the visualisation.

subtractX transparency

paste this function into your script

function subtractX(first, ...rest){  
  return [  ...rest, colors.colorize([1,0,0,0.5],first) ]
}

for example if you take this test script

const jscad = require('@jscad/modeling')
const { connectors, geometry, geometries, maths, primitives, text, utils, booleans, expansions, extrusions, hulls, measurements, transforms, colors } = jscad
const { cylinder, cuboid, cube, sphere, circle, star,cylinderElliptic,  polyhedron, roundedRectangle, rectangle } = primitives
const { translate, scale } = transforms
const { union, subtract, intersect } = booleans

function subtractX(first,...rest){
  return [  ...rest, colors.colorize([1,0,0,0.5],first) ]
}

function main(){
  return subtract(
    cube({size:20}),
    translate([0,0,6], cylinder({height:8,radius:5}))
  )
}

module.exports = {main}

image

then all you need to preview the boolean operaton, change one letter :)

  return subtractX(

image

also, just showing geometries of a boolean operation is faster than the boolean operation itself

cut with a large cube to see the inside

const jscad = require('@jscad/modeling')
const { connectors, geometry, geometries, maths, primitives, text, utils, booleans, expansions, extrusions, hulls, measurements, transforms, colors } = jscad
const { cylinder, cuboid, cube, sphere, circle, star,cylinderElliptic,  polyhedron, roundedRectangle, rectangle } = primitives
const { translate, scale } = transforms
const { union, subtract, intersect } = booleans

function main(){
  return subtract(
    cube({size:20}),
    translate([0,0,6], cylinder({height:8,radius:5})),
    translate([0,-10,0], cube({size:20})), // cut with cube to see inside
  )
}

module.exports = {main}

image

hrgdavor avatar Jul 23 '21 21:07 hrgdavor

I do think a vertex rendering mode could be helpfull too.

You could just extract the vertices becaus jscad supports rendering them

Sam-Apostel avatar Nov 01 '21 11:11 Sam-Apostel

I do think a vertex rendering mode could be helpfull too.

You could just extract the vertices becaus jscad supports rendering them

I think that you mean… the viewer supports lines between points. But sadly, only 2D lines. It definitely could be possible.

z3dev avatar Nov 01 '21 11:11 z3dev

I do think a vertex rendering mode could be helpfull too.

You could just extract the vertices becaus jscad supports rendering them

We are not against it :) ... we will get to it eventually :) so I posted workarounds ... also contributions are welcome :)

hrgdavor avatar Nov 01 '21 18:11 hrgdavor