I need help finding a good JS library that can create a product sketch like this: Partition sketch. I am using Next.js, and are having toruble with most libraries since Next.js is using SSR and most graphical libraries run client side. I dont need to show the sketch (neccessarrily) to the user, it should just be a downloadble SVG file that are based on the users input from the webpage.
Idealy i want it to be a PDF, that can be send directly to a customer, with all the requireing information and the sketch. Is this possible?
I have tried messing around with Rhino3dm.js and P5.js, but both seem hard to implement with Next.js.
There is an p5.svg renderer you could try to essentially draw the same measurements/lines in p5, but render to SVG directly instead of canvas (completely bypassing the .3dm format). The library seems to lack updates recently, but you can start with an older version/example like this one and copy it/modify to prototype what you need.
If .3dm is even better, you shouldn't need p5.js at all: the rhino3dm js library should handle both drawing lines/curves/text (if you have the input from the user) and save to .3dm.
You can check out the SampleSketch2d live example. (source)
You can run the same example bellow as well)
In the above example the download button will be sanboxed, but running on a local webserver should be fine.
(One final note, if for some reason you need to use p5 and rhino3dm (though performance may vary), you can access p5's
drawingContext
to get the the sketch's underlying Canvas render (when not using the SVG renderer) to draw the same as the above in a sketch's canvas).