Showing posts with label 2D. Show all posts
Showing posts with label 2D. Show all posts

Thursday, August 15, 2019

Arduino Project One: Revived - and another detour into 3D printing

The last installment in the story of my Arduino-controlled garage door opener was in November 2017, almost two years ago. The project stalled, not for any reasons of its own, but because of the distractions of everyday life. Now I can finally get back to it.

I may have changed the hardware, switching from an Arduino to a Raspberry Pi. I have good reasons for that, which I'll tell you in a later post. Today, I want to revisit the subject of 3D modeling software.

You will recall that in my previous article about 3D CAD, I mentioned SolidWorks, Tinkercad, SketchUp, Wings 3D, and Microsoft 3D Builder. I haven't tried SolidWorks, because it costs money and I'm cheap. I tried the other four alternatives, and all of them had serious shortcomings. Tinkercad and 3D Builder were so inadequate that I couldn't even take them seriously. Wings 3D is very powerful, but it has a painful and steep learning curve, and all I want to do is design and 3D-print a small enclosure for my project. SketchUp has the power I need, but some of the features I really want to access are hidden behind a paywall.

So, back to the (ahem) drawing board I went. This time, I found just what I was looking for.

(Yet another detour: I've gotten so used to the Linux command line, that I do a lot of graphics work directly in text files. I mean, I write web pages in raw HTML/Javascript/MarkDown/other stuff. I write formatted and typesetted technical documents in LaTeX. For business and technical graphics, I use GraphViz. I use the command-line version of ImageMagick to manipulate existing images. 

And back in the Good Old Days, I used to use the DOS version of WordPerfect with "Reveal Codes" turned on, and I would edit the codes manually. Also back in the good old days, before WISYWIG editors, and before I learned LaTeX, I used to use troff and Interleaf LISP to create typesetted documents. Oh yeah, and I used to write raw HPGL and Logo to do vector graphics - you know, line drawings. Stone knives and bearskins. Old man's voice: "And we liked it! *ptui*")

All of that, just to say that I'm very comfortable with manipulating text-based input to produce graphical output. So I happened across a beautiful little 3D CAD program called OpenSCAD

An OpenSCAD screenshot
Another OpenSCAD screenshot, showing the three panes

OpenSCAD doesn't look like much. It has a window with three panes. On the left is the Editor, where you write the text that defines your part: "Put a cube here. Put a cylinder there. Drill a hole in the cylinder." In the center is the Viewer, where you can see your creation from different angles and at different distances. On the right is the Customizer, a neat little thing you can use to modify your design on the fly without having to rewrite the text in the Editor window.

Creating a model in OpenSCAD is like writing a program. If you've used modern scripting languages like Python or JavaScript, it will feel familiar to you. Pressing F5 or F6 to draw your design is like compiling a program. If you've used compiled languages like C or C++, this will also feel familiar to you. And if you get the programming wrong, OpenSCAD will give you an error message and point you to the line where the error was detected. If you've ever done any programming in your life, I'm certain that this will feel familiar to you.

One of the things that I like best about OpenSCAD is that you can minimize the Editor and Customizer panes, leaving just the Viewer pane, and do your editing in your own favorite editor, in a separate window. Being a Vim fan, I open a terminal window and bang away in Vim. Every time I save the file, OpenSCAD detects that the file has changed, and it computes and displays the new object.

OpenSCAD in use. That's my GVIM editor on the left.
(I'll tell you about the hardware in the enclosure in a later post.)
OpenSCAD can export shapes in a variety of file formats, the most important of which is STL (short for stereolithography, a fancy word for "3D printing"), the format preferred by 3D printing services. Cura LE, from Lulzbot, takes an STL file and converts it into the "slices" required by a 3D printer.

Cura LE (Lulzbot Edition)

Now, here's a new player in the game: FreeCAD. One OpenSCAD user reported that OpenSCAD can occasionally mess up an STL file, and the model will not render properly in Cura. He suggests using FreeCAD as an intermediary between OpenSCAD and Cura.

FreeCAD is a relative newcomer to the 3D design world. It's actually been around since 2002, but it didn't become a serious contender until Release 0.14, in 2014. Even today, at Release 0.18, its makers warn that it's still not ready for prime time, but it's a very good parametric 3D modeling package.

FreeCAD screenshot


(Very technical aside: FreeCAD uses the parametric 3D design paradigm, while OpenSCAD uses the constructive solid geometry (CSG) paradigm. I barely know what those words mean, but I do know that my brain wraps more easily around CSG than parametric design. You may feel differently, and if you do, then you should skip OpenSCAD and use FreeCAD directly. I'm serious.)

So my design path now goes like this:
1. Design the thing using OpenSCAD.
2. Import the SCAD file into FreeCAD, and export it as an STL file.
3. Open the STL file in Cura LE and prepare it for printing.

It works for me. And the price is right. 

If I weren't so cheap, I could spend real money and get one piece of software that does it all for me. But if I had that much money, I'd also buy my own 3D printer. And a OneWheel.

Postscript: Are you wishing I had included a weblink for something that I mentioned? Like SketchUp? Or ImageMagick? Some of these items have links in my previous post on this subject. For the others, you'll have to do a Web search. I'm sorry. I got tired of typing.


To read the other postings about this project, click here and scroll to the end.

DraftSight is no longer free

Remember when I wrote that article about DraftSight, and I was excited because it was an AutoCAD clone, but it was free? And remember when I wrote some follow-up articles uncovering all of DraftSight's hidden 3D design features, even though Dassault Systèmes told the world that it was just 2D drafting software? Well, DraftSight has grown up.

DraftSight 2018 is the last free version of DraftSight. Starting with DraftSight 2019, all future versions will cost money. Not only that, but all pre-2019 versions of DraftSight will stop working, or "cease to run", as the announcement says, after December 31, 2018.

Click here for the official announcement. (In case that link stops working, here's what it looked like in October 2018.)
DraftSight announcement


Dassault Systèmes are, of course, perfectly justified in charging money for DS. DS is professional-quality software, that's for sure. It was written by hired engineers in a for-profit company, and they deserve to make a profit on it. Not only that, but DS 2019 now officially includes a full complement of 3D design tools; it's billed as "a 2D drafting and 3D design experience."

And, considering the prices of comparable software, DS 2019 may still be a bargain, compared to the competition:

  • $100/yr for the Standard version, 2D only, for hobbyists, students and teachers.
  • $200/yr for the Professional version, still 2D only.
  • $500/yr for the Premium version, which includes the 3D tools.
Are there free alternatives? Well, sure, all of the AutoCAD clones that existed before DraftSight are still there. But the state of the art has progressed since DraftSight was first released in 2011. Now, designers are doing 3D CAD and then converting their creations into data files for 3D printing, CNC milling, and other automated manufacturing processes. But there's still a need for the 2D drawings, and so the higher-quality 3D CAD packages (the ones that cost money) can also generate the 2D drawings from the 3D models.

Next, I'm going to tell you about the new CAD solution that I'm going to use.

Friday, November 4, 2011

DraftSight and 3D - it's all in there

Yesterday, I wrote that DraftSight's 3D capability was limited to primitives:  triangles, rectangles, and polygons.  Boy, was I wrong.

UPDATE:  I just wrote a really quick "how to" guide for DraftSight and 3D.  Click here.

For the 3D-disinclined, let me use three real-world objects to help you understand 3D CAD.

First, imagine a wire birdcage, the kind your grandmother uses for her parakeet or canary.  A birdcage is made of a bunch of wires, crossing and intertwining.  They define a region of space - the inside of the bird cage.  CAD programs define a solid object by imagining the surface of it as a bird cage - a bunch of wires crossing each other or connecting with each other.  CAD programs just store all the wire crossings, or vertices (singular vertex, plural vertices), and the wires, or edges, that go from one vertex to another.  You've probably heard of wireframe models or drawings.

Second, imagine a fishnet - a giant fishnet, being dragged through the ocean.  The water and the caught fish pull that net into a certain shape, and that shape can be manipulated by the boat, the current, and the fish (hello, Nemo!).  Another word for "net" is "mesh."  CAD programs also use the terms net and mesh to describe the wireframe drawings.

Finally, think of a Tiffany lamp.  A Tiffany lamp is like a three-dimensional stained glass window.  The lamp maker makes the wire frame first, and then fastens the glass pieces into the frame.  In 3D CAD, the glass pieces are called faces.

3D CAD is a little more complicated than Tiffanly lamps, though, because each face has an "in" side and an "out" side.  Designers have to make sure they get all faces facing (sorry) the right way.

Snooping around, and with a hint from the Internet, I found a couple of tantalizing command-line commands in DraftSight:  EXTRUDE and 3D.  They're definitely worth exploring.  Moreover, the main menu, under Draw --> Mesh, gives an entire list of 3D capabilities.

Conclusion:  Yes. DraftSight has it all in there - vertices, edges, faces, wireframes, meshes, nets - a 2D program with built-in 3D capability.  Now we just have to figure out how to use it all.

Tuesday, November 1, 2011

DraftSight: Scripting and 3D

No, this isn't about how to use scripting to do 3D CAD, although at the end of this article, I point you to the DraftSight help files for some hints on how to do just that.

In my first review of DraftSight, I mentioned that the free version of DS doesn't support LISP macros.  Well, it still doesn't.  I'm not complaining; that was a sound business decision.  Buying the SDK also buys you LISP macro support, and the SDK is not prohibitively expensive.

But if you're willing to get by without the speed of LISP, you can create and run scripts in DraftSight.

For example, suppose you want to draw a circle centered at (5,5) with radius 10.  (I borrowed this example from another online DraftSight help file.)  One way to do this is to type on the command line:

CIRCLE 5,5 10

Another way is to type on the command line:

CIRCLE
5,5
10

(Note the spaces in the first command entry, and the new lines in the second command entry.  The commands are identical in their execution.)

You can use Notepad, Vim, or your favorite text editor to create a script file to do the work for you.  Simply copy and paste either of the above commands into the editor, and save it as "circle55.scr" . (SCR for "script file".)

Now, at the command line, type the command LOADSCRIPT and press Enter.  A "Select File" dialog pops up.  Select your "circle55.scr" file, click Open, and watch the magic.

You can use a script file to automate a sequence of drawing commands that you perform regularly.  Here's an easy way to create that script file:

  1. Perform the command steps that you want to store.
  2. Type CommandHistory to open the separate command history window.
  3. Right-click and select Copy History.
  4. Open an editor program such as Microsoft® Notepad.
  5. Paste the command steps into the editor program.
  6. Save the file as an .scr file.

 (I stole that text from DraftSight's own help file, under Customizing-->Running Scripts-->Running a Script File.)

Now, one of my hobbies and passions is 3D graphics.  I thought DraftSight was just a 2D CAD program, but I kept seeing hints in the documentation to a Z-axis pointer on the Cartesian Coordinate Reference (CCR), that widget that shows up in the lower left of the drawing window.  In addition, the cursor location given in the Status bar is always a 3D coordinate.  It just so happens that DraftSight's help pages include two tantalizing sections, labeled "3D Viewing and Presentation" and "Creating and Modifying 3D Entities."

After I worked through those 2 sections, I can say that yes, DraftSight can draw in 3D.  HOWEVER, the free-as-downloaded version only does 3D primitives:  triangles, rectangles, and polygons of a size that I haven't discovered yet.  Two problems arise from working with primitives:  you often get the "butterfly" shape that the help pages warn you about; and if you create some triangles clockwise and others counterclockwise, their normals point in opposite directions, your solids come out goofy, and the lighting and surface rendering don't work as you expect them to work.

If you want to do complex 3D shapes, you will have to do one of the following things:
  1. A lot of typing.
  2. Buy the additional 3D capability (if it's available - I haven't hunted that far yet).
  3. Buy the SDK and write some 3D macros in LISP.
  4. Write script files instead of LISP macros.
Also note that the free version of DraftSight only saves DWG and DXF files, so you may end up doing some beautiful 3D work and have no way to export it to STL or another 3D format.

Conclusion: It's nice to know that some programming - er, scripting - capability is built into the free version.  And, with respect to 3D, it's also nice to know that I had to direct my explorations into something as complicated as 3D modeling before I found any serious limitations in DraftSight - and even those limitations are just temporary bumps in the road.

CORRECTION, NOVEMBER 4:  It's all in there. DraftSight does indeed have high-level 3D capability.  See this post.

UPDATE, NOVEMBER 9:  For more information on using scripts in DraftSight, see this post.

Tuesday, July 19, 2011

DraftSight: A Painless Upgrade, and a Touch of Class

Dassault Systèmes just published a notice about a DraftSight upgrade, and I performed the upgrade with some trepidation. Often, upgrades of free software are not clean or painless. To my delight, this upgrade was both clean and painless.

I did notice this one nice touch: The DS installer detected some programs I had running that used files it would need to interact with during the upgrade. It listed the programs and invited me to close them before continuing.

Some installers give you the "It is recommended that you close all running programs before you continue" warning, which is appreciated but sometimes a real annoyance. Other installers, really poorly-written ones, simply clobber the overlapping files without warning, irreversibly screwing up your computer. I've never encountered an installer with the philosophy of this DraftSight installer. I like it.

This is a major upgrade, by the way. The version numbering syntax changed with this upgrade. My old version was 11.3.1131. The new version is V1R1.2 (Version 1, Release 1.2).

Friday, July 1, 2011

DraftSight: a good deal for students and teachers

If you're a student or an educator, DraftSight has some special deals for you. These deals give you access to some goodies that the rest of us have to pay for.

Autodesk also offers some great student-and-educator deals on AutoCAD and other software. Over the years, Autodesk has built or acquired an impressive collection of high quality tools.

Either way, you can't go wrong.

Thursday, June 30, 2011

DraftSight part 2 - really good CAD software, for free


I'm sure advertisers hate me. I ignore commercials on TV. I skip over ads in magazines and newspapers, except to snort with disgust at the really objectionable ones. I change the radio station when the commercial breaks get too long or too stupid. And I actually close web pages (and they go on my personal blacklist!) when the ad content starts taking over the page.

And I never, ever, click through on an adlink, which is kind of funny since I have AdSense enabled on my blog.

That is, I never clicked through on an adlink until today.

I was searching for electronic parts on the web, when I saw an ad banner that said something like "DraftSense - a 2D AutoCAD alternative for free," or something like that. AutoCAD is one of the big three CAD systems today. In fact, AutoCAD may be the king of the mountain. AutoCAD is a great program, and I've used and enjoyed it in previous lives. It wasn't the first CAD program, nor was it the first CAD program to dominate the market, but it has become the standard against which all other CAD programs are judged, and its DWG and DXF formats have become an industry standard.

And it's expensive. Oh, it's worth every penny, if you can afford it. Prices start at $1,180 for AutoCAD LT 2012, the lightweight version.

About ten years ago, give or take a few, an alliance of developers set out to make a free alternative to AutoCAD. Their efforts spun off several alternative packages, four of which are documented in an article at Desktop Engineering. The latest alternative is a package called DraftSight, sold by Dassault Systèmes through their Solidworks subsidiary. The beta version was released last summer. The official Windows version was released in February 2011. The official OS X and Linux versions were released in March 2011.

(Before DS acquired them in 1997, Solidworks had their own AutoCAD alternative, called "DWGEditor" and later renamed "2D Editor". DraftSight can be perceived as a direct competitor to 2D Editor, although Solidworks says that they'll keep selling both packages "for the time being.")

(Dassault Systèmes also has a heavyweight 3D CAD package called CATIA, created in 1977 to make airplanes. You knew the name "Dassault" sounded familiar, didn't you?)

There's a lot to like about DraftSight. First, it's free. Like the air you breathe. (We'll cover the exceptions to that "free" part in a little bit.)

Second, it's available for Windows, Mac OS X, and Linux. Version limitations are specified on the downloads page.

Third, it has a very familiar user interface. If you've used AutoCAD, AutoCAD LT, or ARES, you should feel right at home when you start it up.

Fourth, it is indeed full-featured. The list of features includes ... well, go have a look. It still has the command line for those who want it. It's infinitely customizable: aliases, menus, keyboard shortcuts, mouse shortcuts, toolbars - it's got it all. It reads and writes files in DWG and DXF formats (all versions from R12 through 2010 - maybe through 2012 by now), and it exports files in PDF format. And it supports add-ons.

Dassault Systèmes created a user community for DraftSight, with access to all sorts of helps, including video tutorials. They also created a 186-page "Getting Started" guide. Ouch.

Reviewers love DraftSight, and so do most users . One reviewer said DraftSight is equivalent to AutoCAD LT, and that he prefers it over Solidworks 2D. (One user said he'd keep using Visio because it's "simpler." Eh.)

DraftSight is small and fast. It's only 47 MB to download, and after installation it only takes 160 MB of disk space. It starts up fast, and it loads drawings fast.

Here are the exceptions to "free":

First of all, only the standalone license is free. That is, if you want to install it on a server and run it on multiple workstations on a network, you'll have to buy a network license. This is all spelled out in the end-user license agreement (EULA), which you really should read before buying or installing any software. The network license also includes telephone support and other goodies, though, so if you're a business it may be worth your while.

Second, there's no LISP capability in the free version. Like AutoCAD, DraftSight lets you write macros and custom programs using a dialect of LISP. In order to use LISP, you'll need to buy the API (application programming interface) package.

Third, all of the add-ons - well, let's say most of the good ones - cost money. That's not a bad thing, just an acknowledgement of reality.

Fourth, "free" is not synonymous with "open source." You can't get the source code. Dassault Systèmes owns it, and they're not letting go of it. That's okay; if you really want to mess with the software, you can buy the API instead.

Why the exceptions shouldn't bother you:

Dassault Systèmes can offer DraftSight for free because they make all their money on these extras. Oh, don't worry; DraftSight is immensely useful and powerful all by itself, without costing you a nickel. Most individual and sole-proprietor users won't need any of that extra stuff. But it's all there if you want it.

So, Zyzmog, do you like it?

I've only played with it a little bit. I'll post updates here as I gain more experience with it. But from what I've seen so far, I like it.

To download DraftSight, click on this link.

UPDATE: As of December 31, 2019, DraftSight is no longer free. Read about it here.

DraftSight - really good CAD software, for free

I'm a bit late to the party on this one. Better late than never, I guess.

If you've been looking for a free or low-cost alternative to AutoCAD, you can stop looking. DraftSight, a new 2D CAD program that natively (that means without breathing hard) reads and writes DWG and DXF files, is now available for free from Dassault Systèmes Solidworks.

It's available for Windows, Mac OS X and Linux operating systems. And it truly is free. With some asterisks.

Here are the important asterisks.
* DraftSight is comparable to AutoCAD LT, the lightweight version of AutoCAD.
* Only the standalone license is free. That means each computer has to have its own copy. If you want to run it from a network server, you'll have to purchase a network license.
* No LISP support in the free version. If you want LISP capability, or support for all your AutoLISP macros, you'll have to purchase the API.
* It's free, but not open source. Eh. I can live with it.

Those are all the asterisks I can think of. DraftSight has gotten great reviews on the Web. I just downloaded it and tried out some rudimentary functions, and I like it so far. If I end up not liking it, I'll edit this entry and tell you what's not to like.

Download it here. Read about it here. I'll tell you more about it in my next entry.