microsoft / maker.js

📐⚙ 2D vector line drawing and shape modeling for CNC and laser cutters.
http://maker.js.org
Apache License 2.0
1.78k stars 273 forks source link

Support for dotted and dashed line/path #453

Open neel-radica opened 4 years ago

neel-radica commented 4 years ago

I believe another options for type path should be included to support exporting dashed/dotted lines as shown. Checked the API and also the code, but I don't think the options is introduced yet. In DXF, the group code is 49 Group code 49

image

danmarshall commented 4 years ago

Hi @neel-radica, the current approach to styles is to put them on their own layer. Will a dashed layer be suitable for your scenario? Or is it important that these dashed lines are on the same layer as other entities?

neel-radica commented 4 years ago

Hi @danmarshall assuming that I use layer, it seems like there is only 2 options available, color & fontSize. I'm trying to add a new options to support dash lines but facing some difficulties. Maybe will submit a pull request if possible.

danmarshall commented 4 years ago

Yes, currently there is no dashed line. My question is would the above proposal work for you?

danmarshall commented 4 years ago

I suggest that we add it to layerOptions. If we do this, it means that dashed lines will be a separate layer. Is this solution ok?

neel-radica commented 4 years ago

Hi @danmarshall sorry for the late reply. Absolutely, that is just what we need. However, I'm curious about how the implementation will be. I have changed a bit of the source code to be able to accept a layerOptions for dashes, however I end up doing a lot of //@ts-ignore cause dxf-parse doesnt have interface to support dashes yet. Probably, it's better to leave it at your hands. If needed, I could submit a pull request just for your reference, just say the word. Thanks a lot

ascweb commented 3 years ago

I suggest that we add it to layerOptions. If we do this, it means that dashed lines will be a separate layer. Is this solution ok?

Hi @danmarshall do you have any update about line thickness, opacity, and dashed style? Thanks a lot!

danmarshall commented 3 years ago

@ascweb - for DXF, we'll need to add an additional LineType - currently there is only a style named CONTINUOUS

For PDF, we'll need to implement the .dash method in PDFKit

ascweb commented 3 years ago

Hi @danmarshall sorry for the late reply. Absolutely, that is just what we need. However, I'm curious about how the implementation will be. I have changed a bit of the source code to be able to accept a layerOptions for dashes, however I end up doing a lot of //@ts-ignore cause dxf-parse doesnt have interface to support dashes yet. Probably, it's better to leave it at your hands. If needed, I could submit a pull request just for your reference, just say the word. Thanks a lot

@neel-radica did you get a good solution for dot/dashed lines?