Programming language for CAD
October 31, 2014 3:41 PM   Subscribe

I'd like to find a programming language that compiles to line drawings.

Dot is a graph-description language. POVRay includes a scene-description language.

Is there an equivalent for 2D CAD? I want to take a plan that's been drawn on paper and turn it into a PDF, but I don't want to use Adobe Illustrator more than I have to.

The closest I can think of is Logo, but I'm hoping there's something better out there.
posted by Leon to Computers & Internet (12 answers total) 9 users marked this as a favorite
Maybe PGF/TikZ?
posted by supercres at 3:43 PM on October 31, 2014

Oh, better in the same vein: Asymptote
posted by supercres at 3:45 PM on October 31, 2014

Best answer: PostScript. A lot of command-line tools (GhostScript, ImageMagick, etc.) already convert this to other formats, so it will probably be the most flexible, if "arcane" option.
posted by a lungful of dragon at 3:54 PM on October 31, 2014 [2 favorites]

Another option that is a bit more modern is SVG. One advantage of this format is that you can share it pretty easily online, sharing links to an SVG document with people who use modern, standards-compliant web browsers (basically, these days, this is just about any browser other than IE and Firefox).
posted by a lungful of dragon at 4:00 PM on October 31, 2014 [1 favorite]

Could you use the 2d drawing API of whatever language you are most comfortable with? Create a standard graphic using whatever format and then import it into Illustrator and use tracing to convert it to vectors and tweak your final PDF output. I think the challenge is going to be figuring out how to encode the plan's measurements into a format your program can execute, or what your dotfile would look like, in other words. Depending on how complex the plans are you might have to represent a wide range of shapes.

Another option might be to re-create it in one of the free/open source 2d drafting tools and export it from there into Illustrator and trace that instead.

However, I think the first thing I'd try is to take a picture of the plans using the highest quality camera I could get a hold of to see if I can produce an image of them that's high enough quality to jump straight to the Illustrator tracing step with.
posted by feloniousmonk at 4:13 PM on October 31, 2014

Here's what I mean by tracing.
posted by feloniousmonk at 4:15 PM on October 31, 2014

Best answer: OpenSCAD is a 3d modeler that does kind of what you want (and wow I wish I'd known about it when I designed my workshop). Maybe you can just use its isometric views?

And, yeah, I've used Perl to generate SVG before...
posted by straw at 4:15 PM on October 31, 2014 [1 favorite]

A language called Processing was discussed here previously as good for this type of thing, but I have never used it.
posted by rockindata at 5:50 PM on October 31, 2014

Processing is good (Processing.js moreso, as it does it in the browser with no Java fiddling), but PostScript is the one to use — a really expressive language.

SVG is just data.
posted by scruss at 9:20 PM on October 31, 2014

you can do *everything* via the autocad api in autolisp. The COM api is open if you know any COM-friendly Windows language.
posted by j_curiouser at 12:26 AM on November 1, 2014

you can disregard my comment - i thought you were looking for an actual programming language.
posted by j_curiouser at 12:38 AM on November 1, 2014

Response by poster: Thanks, guys. Off to do lots of research now.
posted by Leon at 3:24 AM on November 1, 2014

« Older RCA to HDMI   |   What does this graffiti mean, if anything? Newer »
This thread is closed to new comments.