Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

render as engineering drawing (with title block etc.) #21

Open
3 tasks
stevegt opened this issue Nov 16, 2020 · 11 comments
Open
3 tasks

render as engineering drawing (with title block etc.) #21

stevegt opened this issue Nov 16, 2020 · 11 comments

Comments

@stevegt
Copy link
Contributor

stevegt commented Nov 16, 2020

Overview

I'm working on being able to generate 2D engineering drawings (with title block etc.) from sdfx. It looks like, in order to do this, I'd need to:

  • Be able to generate filled fonts rather than the outline fonts that TextSDF2() generates right now.
  • Generate lines or boxes for the title block, any specification tables, etc.
  • Find or implement some equivalent of the openscad projection() function to convert 3D models to 2D views or slices.

Does anyone have any ideas for how to best deal with the fonts? Looking at text.go and render.go right now, I suspect that I'd have to render in some way other than the existing marching squares (I think). It might even be better to skip that code path and render text as a <text> element in SVG or a TEXT entity for DXF.

I'm not as worried about the title block and tables -- am assuming that if I for some reason can't use boxes to build those I'll use Line{] or Line2{} directly.

Any opinions, and has anyone else had a go at this yet?

Architecture

Based on feedback below, so far I'm tentatively thinking the font bits might go in sdf/render.go, but the frame and title block, as well as any projection() function, might better fit in something like an sdf/view.go file or even a separate library. Am entirely open to suggestions.

@deadsy
Copy link
Owner

deadsy commented Nov 16, 2020

To be sure sdfx has been written as a modelling library for 2d /3d signed distance fields- it's not really a blueprint producing 2d cad program. Having said that....

Since you seem to be in the realm of DXF files, I'd probaby aim for some code that given name, page, number, date, designer, etc. produced a frame of the correct size and slapped the 2d polygon from marching squares in the middle of it. ie- a version of RenderDXF with more control parameters.

@stevegt
Copy link
Contributor Author

stevegt commented Nov 16, 2020

Yeah, I also don't need traditional engineering drawings myself -- I prefer tool chains that go from model all the way to material without the human intervention that a drawing implies. But I'm being driven to generate drawings by more traditional folks I need to interact with. It's been a persistent demand for years, one that I'd always assumed I'd eventually get around to via either openscad or python scripting of freecad -- paradoxically enough, I think sdfx is better suited. I'm not even wedded to DXF -- SVG would allow rendering in browser, etc.

I think we're thinking the same thing about rendering code path for the frame and title block. Just need to suss out the right way to handle lettering. Still experimenting.

@deadsy
Copy link
Owner

deadsy commented Nov 16, 2020

So sdfx uses the yofu/dxf package. The flow is something like 2d sdf -> 2d polygon -> dxf output file.
When you go to output the dxf file you can decorate the 2d polygon output it with the boilerplate frame using the dxf primitives.
dxf has a text entity which I assume would be the simplest way of getting some strings of text into the details box.

@stevegt
Copy link
Contributor Author

stevegt commented Nov 16, 2020

Adding this to my "todo" checklist above: Does anyone know of an existing implementation of the openscad projection() function for sdfx? I spent some time this weekend looking around in the code, closest I've found so far is the Cut3D() stuff.

@stevegt
Copy link
Contributor Author

stevegt commented Nov 17, 2020

Encouraging that yofu/dxf includes a DXF parser -- that would allow reading the boilerplate from a template file.

@deadsy
Copy link
Owner

deadsy commented Nov 17, 2020

Does anyone know of an existing implementation of the openscad projection() function for sdfx?

func Slice2D(sdf SDF3, a V3, n V3) SDF2
Slice2D returns an SDF2 created from a planar slice through an SDF3.

@gedw99
Copy link

gedw99 commented Feb 18, 2021

Hey all

I also have the same need

did this move forward in anyone’s repo.

I think I could build a gui for doing this actually in golang

  1. 3d model viewer
  2. 2d projection . Will be off the DXF in a flow that watches if a 3d model changes
  3. PDF output of sheets from the DXF viewer

This is all read only. But it should be possible to extend it to editing also I think but it would need to be talking to the 3d model golang api

@deadsy
Copy link
Owner

deadsy commented Feb 18, 2021

I don't know that anybody has done it. My suggestion was that it could be a parameter passed to the DXF render. ie - page size, title, date, version, etc. - and then just add them to the dxf output using the dxf primitives.

@gedw99
Copy link

gedw99 commented Jul 5, 2023

Hey all

I am using Deck to allow making Technical drawings

it golang and can produce a pdf and other formats.

https://github.com/ajstarks/deck

Wondering if SDF software output 2 d or 3d view in a raater or Vector Format ? Cause I can then use that with Deck .

Deck can model vector cad as 2d btw. Lines , Text, curves. It’s very stable too in general with good maintenance

@gedw99
Copy link

gedw99 commented Jul 5, 2023

I don't know that anybody has done it. My suggestion was that it could be a parameter passed to the DXF render. ie - page size, title, date, version, etc. - and then just add them to the dxf output using the dxf primitives.

Can SDF do DXF out ?

@deadsy
Copy link
Owner

deadsy commented Jul 5, 2023

sdfx can generate dxf output for 2d signed distance fields. It uses marching squares with no post consolidation of line segments so the dxf will consists of many short line segments.

func ToDXF(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants