Open Peque opened 4 years ago
I'd like to try my hand at this!
Great! :blush:
Perhaps it would also be nice to have the option to not include the grid at all
@Shimwell Yeah! :+1:
Does this approach sound ok to you @Peque ?
make another variable called raw_gridless_html_template
which is the same as raw_html_template but misses the parent.gridsize
and griddivisions
parts
then add an if statement to the run
function and if gridsize
and griddivisions
are not specified in the user options then make use of the raw_gridless_html_template
@Shimwell So I guess you are suggesting that, by default, no grid should be displayed (unless the user defines gridsize
).
I think I would rather leave the default behavior as-is (i.e.: show a grid).
So, how could we disable the grid? Instead of adding a new parameter, I'd say gridsize=0
should disable the grid. Maybe an if
in the main.js:init()
function to check if gridsize is greater than 0
?
That sounds better
Changing this
to this appears to work for me
if ( gsize > 0 ){
var grid = new TranslucentGrid( gsize, gdivs, 0x888888, 0xdddddd, 0.6, );
}
@Shimwell What about the references to grid
just bellow? Don't they throw an error?
Maybe put all those lines inside the if
clause? (from the var grid
declaration to the scene.add(grid)
call).
Yep you are right. I was just testing it worked with out the grid
I can make a PR for your consideration
Just to get this issue back on track I wanted to mention that Cadquery has a bounding box that can be used to find the shape size in x,y,z https://cadquery.readthedocs.io/en/latest/classreference.html?highlight=boundingbox#cadquery.Shape.BoundingBox
Right now the grid is defined with its size and number of divisions.
While this is fine and should be kept as a possibility, the default should set a grid with a size double the longest dimension of the displayed model.