Friday, November 18, 2011

About "Breaking Dawn" and other vampire movies

I'm going to write a book and a movie about a bunch of pale, morose, teenage-boy vampires at a middle school in Colorado. I'm gonna call it "Breaking Wind." I'll be a millionaire by this time next year.

Sunday, November 13, 2011

Slow and Steady Wins the Race

Okay kiddies, time for a little bit of politics.

Mama Zyzmog and I are registered independents. We like it that way. It turns out that the Colorado voter base is almost evenly split, 1/3 each, among Dem, GOP, and independent.  We're an independent bunch out here in the West.

We've been following the Republican race for the presidential nomination because, frankly, the Democratic race is boring this year, and we don't have Stephen Harper or Silvio Berlusconi to kick around.  I've watched the evangelicals and other Christians ganging up on Mitt Romney, and I confess that I've watched with a mixture of irritation and incredulity as these people dare to say, in public, that they won't vote for him simply because he's a Mormon.

I shouldn't have been shocked when I found out that a large number– I'd say a vast majority – of Mormons are planning to vote for him simply because he is a Mormon.  Doesn't anybody use their brains anymore?  Hey, listen – I know a lot of Mormons, and there are some of them that I definitely wouldn't want for President.  But I feel exactly the same way about evangelicals.  As far as I'm concerned, a person's religious affiliation neither qualifies nor disqualifies him for the Executive Office.  I'm going to vote for a president based on his (or her) merits, character and potential for success – oops, I mean potential for leadership.

Anyway, have you all noticed this interesting phenomenon in the Republican race?

It seems like there's always a new rising star, a new challenger to the Mittster, who surpasses him in the polls and stays there for a while.  It could be a few days or, if they're lucky, a couple of weeks, and then they go diving down into the single digits.  Michelle Bachmann was the first, then Rick Perry, then Herman Cain.  And now it's Newt Gingrich's turn on the mechanical bull.  He's still up on top right now, I think, or at least sharing top billing with the Guv.

And what's Mitt's response to all of this?  Nothing!  He doesn't attack them, he doesn't do anything except follow his game plan.  What happens to his poll results?  Nothing!  No change, up or down.  He's always within a few percentage points of 21% or 22%.

My prediction is this:  Gingrich will fade over time, just like all the others.  A new challenger will rise up, and another one after that, and they will follow the same trajectory as all the others.  And maybe another one after that. One would think that the American voters would be a rational bunch, and go for the leader who shows the most consistency.  And believe me, Mitt has been nothing in this race if not consistent.  He's the natural choice, the logical choice, the only one whose numbers haven't seesawed up and down as time has passed.  But American voters have never been a rational bunch.  They'll vote for whoever's flying highest when their states hold their primaries, or when the convention is held in Tampa Bay in August.

(Not that I'm endorsing Mitt Romney or anything, but did you notice that nobody has mentioned how Mitt saved the Olympics?  In case nobody remembers, he was hired in 1999 by the Salt Lake City Olympic Games Organizing Committee to salvage what was left of the 2002 Olympics, after it had suffered at the hands of incompetent and corrupt managers. He turned it from an abject failure into an overwhelming success.  I've read recent articles analyzing his business career before then, and analyzing his political career afterwards, but I haven't read anything recently about his Olympics career. Maybe I'm not looking in the right place.)


Ed note:  Originally, this post said "Franco Berlusconi."  Maybe that's Silvio's kid brother.

Friday, November 11, 2011

In Defense of Childish Things

Growing up is highly overrated.

One of the most irritating things I have ever heard is the phrase, "Oh, grow up."  It's usually delivered in a superior or condescending tone, by someone who disapproves of someone else's behavior or attitude.  If you want to get Biblical, it was the apostle Paul who said that when he was a man, he "put away childish things."  On the other hand, it was Jesus Christ himself who said that we must all become "as little children."  I have observed over the years, and have become convinced, that people who "grow up" and dispose of the last remnants of childhood lead sad and miserable lives.

You know, there's a difference between "childish," with its connotations of immaturity and naïvété, and "childlike," with its connotations of simplicity and lack of guile.  Here are five childlike attitudes that we all should retain throughout our lives, even after we "grow up."

1. A sense of wonder
This is what motivates the child, who picks up a red maple leaf in the fall.  He examines the shape of the leaf, the intricate vein pattern, the splashes of color in a leaf that used to be a solid green, and he remembers the way it floated down from the tree.  He wonders "how ...?" and "why ...?" and once in a while, without a question mark, he wonders "oh, wow."  He experiences the same wonder at the blue sky, dinosaurs, mountain heights and ocean depths.  Wonder and discovery drive people to become doctors and scientists.  Wonder is also the source of our natural appreciation of beautiful things.  It's what makes us gasp at a sunrise, stare at a pretty girl, and get choked up when listening to a particular piece of music.  Wonder is what keeps us learning for our entire lives, and, as my friend Kent Galloway once said, "The day I stop learning is the day it's time to die."

2. A sense of delight
This is where "fun" comes from.  It's what makes food taste good.  It's what makes us laugh.  It's why people still drive old Ford Mustangs.  Playing hard and working hard, doing things with your body, are a delight.  A healthy sense of humor stems from this sense of delight, as do pleasure, and enjoyment of the more refined things in life.  But children seem to find delight in the simplest, most mundane things – sometimes even in tedious things.  If you can't look back on what you did during the day, and think of one thing that makes you say "Whew! That was fun!" then you are living your life wrong.

3. The ability to love unconditionally
Unconditional love is what allows us to get along with our fellowmen. It makes it easier to negotiate heavy traffic. It is what binds together families and true friends. It is the deep, hidden, never-mentioned, root of all successful business transactions. It's also the true source of selfless service and charitable giving.  If we give to charity grudgingly, or out of a sense of obligation, it doesn't come from our heart and it doesn't count.  Real giving, giving from the heart, is what really matters.  It uplifts both the one giving the love and the one receiving it.  Conditional love, or love that comes with a price tag, is demeaning and insulting to both the giver and the receiver.

4. Imagination
Sometimes it seems like the goal of civilized society is to squelch our imagination.  It gets squelched by parents, modern public education, peer groups, television, bureaucracy and meaningless rules.  A rare few manage to survive this lifelong beatdown of their imagination. These are the ones we end up honoring for their vision and their creativity.  These are the great musicians, painters and sculptors, but they are not just found in the arts.  Walt Disney was one.  So was Steve Jobs.

5. A yearning for God
Too many of us lose this innate yearning, or have it philosophised out of us by others.  And yet it remains deep within us, constantly bubbling to the surface, where we have to work hard to choke it down again, because ignoring it only works for so long.  It's when we acknowledge this yearning, and nurture it, that we begin to develop and grow for real, in a way that transcends all the worldly knowledge we may have acquired over the years.  All that "adult" learning keeps us firmly grounded – planted on the earth – but when we give in to the yearning for the divine, when we begin to seek for a purpose or an existence beyond mortality, then we are no longer chained to the earth, and we leave those "oh, grow up" grown-ups far behind.  The people in our lives whom we admire the most, and whom we would do well to emulate, are those who have satisfied this yearning (well, to a degree beyond our own, anyway) and remain on earth to tell us about it.


Without these attitudes, these childlike attributes, life isn't worth living. The times in my life when I have felt sad or lost are the times when I have forgotten these qualities, set them aside, or had them forcibly taken from me.  The times when people have gotten frustrated or upset with me are often the times when I've had, um, an overabundance of these qualities, according to those who were passing judgment on me.  I think that true wisdom comes from knowing how to keep these attributes alive and relevant in your life, while keeping them a secret from those who would judge.


© 2011 Ray Depew. You read it here first. Feel free to copy it, but make sure you give proper credit. If you see it somewhere else without my name on it, please let me know.

Lee Ann Womack puts this whole thing into her beautiful song, "I Hope You Dance."



Wednesday, November 9, 2011

DraftSight and scripting

Generally, AutoCAD scripts (and hence DraftSight scripts, by association) have a bad reputation as a slow and clumsy alternative to LISP.  Okay, fine.  That's generally the case with any script language vs. a compiled or bytecode alternative.  The price is right; I'll live with it.

If you want to learn how to write DS scripts, the best place to learn is learn from the materials available for ACAD.  Search the Web for "Autocad script" or "Autocad script tutorial".  Almost all of what is written for ACAD applies to DS.

Remember that a lot of the commands that invoke a dialog box (like "LAYER") have a command-line-only, alternative version that begins with a hyphen or dash (like "-LAYER"), for use in scripts.  (Also for use by command-line geeks who don't like dialog boxes.  And Linux heads!  And Cygwin junkies!)

Since I haven't had a lot of practice with ACAD scripts myself, I expect to be doing a lot of fumbling around for the next little while.  One of my first tasks will be to find out how to pass arguments to a script, and how to have a script open a custom pop-up window, to prompt the user for a needed value.

Apparently, there's also a tiny macro language, called Diesel, with which ACAD users can modify the Status line and do other little tweaks.  It's been reported that Diesel macros work inside DS also.  One thing at a time, my friends.  I'm working on scripting this week.  But if you know something about Diesel, give it a shot and let me know what you find out.

By the way, the official AutoCAD user forums contain a few discussions about DraftSight.  

Some users were wondering about the legality of DS, considering that it's
so close to ACAD in functionality and features.  A little research into the Open Design Alliance and the IntelliCAD Technology Consortium would answer their questions - besides, I don't think that Dassault Systèmes would have put all that horsepower behind DraftSight if they didn't have all their ducks in a row, legally speaking.

Other users were dismissing DS as the latest in a long train of ACAD clones, none of which have been as good as real ACAD.  Well, they're absolutely right, without dispute.  It
is the latest, and it isn't quite as good as the real thing.  There's no question that AutoCAD deserves its place at the top of the heap.  If we could afford it, we would all use it, without a doubt.  But we can't, and so we look for compatible, lower priced alternatives, which will do most of what ACAD can do and all of what we need to get done.

I don't think that Autodesk or their customers have anything to fear from DS.  The ACAD installed base will continue to grow, contributing nicely to ACAD's bottom line, and although we all look forward to the DS installed base growing even faster, it will never overtake or replace ACAD.  I don't think that Dassault Systèmes intends it to do so, either.

Friday, November 4, 2011

DraftSight 3D: How to

This is more of a quick reference guide than a tutorial.  If you follow the instructions given here, you'll be able to experiment with 3D in DraftSight and discover new stuff.  When you discover something that might be useful here, please send me a comment.  I won't post it as a comment, but if it's useful I will add it to the main text of this article - I'll add your name or ID at the bottom of the article.

What can you do with a DraftSight 3D CAD model?
Unfortunately, right now you can't do much besides play with it inside DraftSight.  Somebody please enlighten me.
When you save it as a DWG file, it saves all the 3D data.  You can confirm that by exiting and restarting DraftSight, and then reloading the DWG file.
But the 3D doesn't import into Creo Elements/Direct Modeling Express.
I don't know about MilkShape or UVMapper yet.
The free version of DraftSight doesn't let you export the file in a different format.
???

What is the CCR?
You'll see the initials "CCR" in a lot of the DraftSight documentation.  CCR stands for Cartesian coordinate reference.  It's the little X-Y widget in the lower left corner of the Model view when you first start up DraftSight.  There's actually a Z axis on it as well as the X and Y axes, but you won't see it until you start "rolling the view."  The CCR will help you maintain your orientation when you're viewing objects in 3D.

How to view in 3D
Viewing things in 3D is easy.  You can even view a 2D drawing in 3D!  That's kind of funky and not really useful, but it's fun to do once or twice.
1. From the main menu, select View --> Constrained Orbit.
  - OR -
  From the command line, type ROLLVIEW and press Enter.
  The mouse cursor changes to a circle thingy.
2. Hover the mouse over an object in your drawing.  Hold down the left mouse button.  The mouse cursor changes to two 3D circle thingies.
3. With the left mouse button still down, move the mouse.  You'll get the hang of it.
4. To return the mouse function to normal, press Esc, press Enter, or right-click the mouse.  This doesn't return the 3D view to normal.

How to return the 3D view to normal
Here's the really quick way:  At the command line, type -V O T. That's short for -Views, Orthographic, Top.  The dash is important:  without the dash, you get the dialog box.

(UPDATE, 9 Feb 2012: Here's an even quicker way, pointed out by an alert reader: type PLAN and press Enter. It worked in AutoCAD, and it works in DS too.)

Here's the conventional way:
1. Either type V (short for VIEWS) and press Enter, or select View --> Named Views from the main menu.
2. In the dialog box, select View Type --> Defaults.  Select Top view, and click OK.

By "normal" I mean:
- You get a 2D view, showing the XY plane.  The CCR shows X and Y axes only.
- A Zoom Fit is automatically executed, so everything shows in the drawing area.
- This doesn't put the CCR at (0,0,0), but it does put it in the lower left corner of the drawing area.

How to create wireframe shapes
1. From the command line, type 3D and press Enter.
2. You can select from 9 different shapes:
Box - specify Length (+X or RIGHT), Width(+Y or UP), Height (+Z or into screen), and rotation about Z-axis (this is rotation in the 2D plane, with 0 being +X and numbers increasing towards +Y.  You can also make a cube and a square box using the C shortcut after Length or Width.
Cone
Dish
Dome
Mesh - specify four corners of a rubber sheet, and how many segments you want between the corners.  M and N are difficult concepts to explain, but they'll make sense when you see them.
Pyramid
Sphere
Torus
Wedge

How to extrude 3D shapes from a 2D cross section
1. Create the 2D shape.  It doesn't have to be on the Z=0 plane, but it all has to have the same Z value (that is, parallel to the Z=0 plane.
2. From the command line, type EXTRUDE and press Enter.
3. Click the 2D shape.
4. Either enter a numeric number (positive or negative) for the extrusion height in the Z direction,
  - OR -
  If you are viewing the shape obliquely (from ROLLVIEW or something), you can just move the mouse to the extrusion height you want, and left-click to set it.

How to rotate and stretch 3D shapes in 3 dimensions
???

How to create primitives
These are all in the Draw-->Mesh submenu.
2D Solid - Also the SOLID command.
This creates a shape with faces, not just a wireframe.
If you're using the mouse, you specify 3 corners of a triangle, or 4 corners of a quadrilateral - but if your specifying a quadrilateral, don't go in a circular motion.  You have to go in a zigzag.  If you go in a circular motion, you get the dreaded butterfly effect.  After you specify 3 corners and press enter, it draws a triangle.  After you specify 4 corners, it draws a quad.  The last 2 points now become the 1st and 2nd points of the next side, and you can specify new 3rd and 4th points.  In this way, you can create a long polygon of quads all stitched together.
3D Face - Also the FACE command.
I'm not clear on the difference between this and 2D Solid.  They both seem to do the same thing for me.
3D Mesh - also the MESH command. 
I explained this earlier.
Revolved - also the REVOLVEDMESH command.< This creates a solid of rotation.  Draw a 2D shape you want to use as your revolved surface, and draw a straight line (or pick a straight feature, like the edge of a box) to use as the axis of rotation.  The elements don't have to be on the Z=0 plane, or any other plane; nor do they have to be coplanar.  Unfortunately, I don't know the Setup option to give you more than 6 segments in the rotated solid.<
Tabulated - also the TABULATEDMESH command.
This is like EXTRUDE, only its direction and distance of extrusion is not dependent on the Z axis. 
1. Create a 2D shape on a horizontal (Z = constant) plane. 
2. Draw a line the direction (3D) and distance you want to go. 
3. Execute the command from the menu or the command line.
4. "entity for path curve" is the 2D shape you want to extrude.
5. "Entity for direction vector" is the line defining distance and direction.
Edge - also the EDGEMESH command.
This command takes four "open" entities (line, arc, polyline, spline, etc.) and draws a rubber-sheet mesh between them all.  Their ends have to be touching, to make 4 vertices.
Ruled - also the RULEDMESH command.
This command takes two entities and joins them to make a solid with the two entities as faces.
1. If one entity is a point and the other a closed element (rectangle, circle, polygon) then you end up with a cone or a prism.
2. If one entity is a point and the other an open element (line, spline, curve), you end up with a fan.
3. If both are open elements, you end up with the rubber sheet mesh.
4. If both are closed elements, you end up with a cool 3D adapter thingy like the vent hood above the grill at a Mongolian Barbecue restaurant.

How to create 2D shapes with some thickness to them, and on a different plane
The ZPLANE command lets you add thickness to your 2D objects.  It also lets you draw on a different Z plane than the default Z=0 plane.
1. From the command line, type ZPLANE and press Enter.
2. Type the value for the new Z plane, then press Enter.
3. Type the thickness for the objects you're about to draw, then press Enter.

How to join primitives to make 3D objects
???

How to join 3D shapes and objects to make more complicated objects
???

How to color faces, and how to hide unseen surfaces
The Hatch/Fill function can be used to select and color faces.  I suggest just using the "fill" capability.  Unfortunately, selecting the face to color doesn't work reliably for me.  I guess I haven't discovered the trick yet.
1.  Click on the Hatch/Fill icon in the menu on the left side of the drawing area
- OR -
Select Draw --> Hatch/Fill from the main menu
- OR -
On the command line, type HATCH and press Enter.
2. In the dialog box that comes up:  in the Type box, select Fill.  In the Colors box, select a color.  You can also change the Style and Orientation.  Don't hit OK yet - it's probably greyed out anyway.
3. In the Boundary settings box, click Specify Points.  The Hatch dialog temporarily disappears, so you can choose a face to color.  Click on any area inside the face, then press Esc or Enter. (WARNING:  THIS DOESN'T ALWAYS WORK!)
3a. While the Hatch dialog is temporarily absent, you can also turn or manipulate the 3D object to find the face you want to color, by selecting View-->Constrained Orbit from the main menu.  When you have finished manipulating the 3D object, press Enter or Esc to return to the view that lets you select a face.
4. After you have selected a face and returned to the Hatch dialog, click OK.

If you know of a more reliable way to select the face to color, please comment on this article. I won't post your comment, but I will edit the article and put your name or ID in the acknowledgements.

How to change the lighting so the 3D item is easier to see
???

Acknowledgements
Thanks to these people who have helped to expand my knowledge of DraftSight's 3D capability, and to make this guide more complete:
Anonymous, for telling me about PLAN.

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.

Dear Congressman: The Whole World is Watching, and They Know You're Going to Fail

I sat down this morning to write an article about the next budgetary challenge facing the Congress of the United States.  Once again, they have the chance to prove how fiscally irresponsible, and politically hopeless, they are.  The Supercommittee's first deadline, November 23, is only three weeks away, but five days before that, the Congress has to pass the 2012 budget.  You and I both know how that's going to turn out, right?

Anyway, I was going to give you an analysis of the situation, when I ran across an article online.  The article appeared on yahoo.com, and it was written by Jay Newton-Small, of Time.com.  Jay says exactly what I was going to say - even with my voice, right down to the "You gotta love" near the end.  It's as if I discovered a kindred spirit.  If I get the author's approval, I'll reprint the whole article here.  For now, here's the link to the article.

As Congress Squabbles, Another Shutdown Looms

Read and enjoy.

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.