Tick Talk on EsoxRepublic.com


SW Coordinate Systems Are Nearly Useless

Posted in Uncategorized by Administrator on the July 30th, 2008

Coordinate Systems in SolidWorks have been a disappointment from the beginning. Like a freshman congressman, they have little purpose but to wait around, be present and hope for greater possibilities as they gain seniority. Unlike said congressman, coordinate systems are just not gaining any power.

SW Help’s own description of coordinate systems’ limited utility is embarassingly anemic:

You can define a coordinate system for a part or assembly. Use this coordinate system with the Measure and Mass Properties tools, and for exporting SolidWorks documents to IGES, STL, ACIS, STEP, Parasolid, VRML, and VDA.

That’s missing a whole universe of potential usefulness, especially compared to what UG, Pro/E, and even AutoCAD(!) can do with their coordinate systems (”CSYS”).

Back in my Pro/E days, I would create a user-defined CSYS to use as the main anchor for locating part geometry. That way, I could move and rotate an entire part w.r.t. the universal CSYS simply by redefining one feature. This was very useful when making models for customers that required “in-place” designs (”in-place” = line up origins of parts to locate in master assembly).

That’s what I miss the most. But, there’s plenty more. Here’s a partial wish list of what SW can’t do w/ coordinate systems that other programs can:

  • Define and update view orientations
  • Mates: SW CSYS’s are truly impotent, for they can not mate.
  • Define datum planes and axes. (Add to this that SW has no control over which side of a datum plane is the front.)
  • Sketch relations: Can not constrain sketch entities parallel/perpendicular/coincident to CSYS axes or origin. This would be especially handy in 3D sketches.
  • Move or copy geometry: it would be wonderful to be able to use a CSYS transform to define how geometry is moved or copied.

Painful Workarounds

Meanwhile, I have resorted to second-rate workarounds to get me by. Sometimes a 2D or 3D sketch can stand in for a CSYS. At least then I can make sketch references and create planes. Still, very inelegant. No workaround in sight for view orientation. A macro could do this, but I haven’t written one yet.

Speaking as the “High Priest of the Temple of Unused Potential”, I beg you, SolidWorks, please do something with this!

Early Binding Speeds API Programming

Posted in API by Administrator on the July 24th, 2008

One of the challenges when writing API code is keeping track of objects and their methods and properties. Early binding can help with that.

“Early binding” simply refers to the way that object variables are defined. Instead of defining an object variable with “Dim swApp as Object”, define it as the specific object type, i.e. “Dim swApp as SldWorks.SldWorks”.

Here is what SW gives you when you record a macro:

Dim swApp As Object
Dim Part As Object
Dim SelMgr As Object
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As Object

This is what the same code would look like adjusted for early binding:

Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim SelMgr As SelectionMgr
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim Feature As SldWorks.Feature

Ctrl+J and Intellisense

One of the handy features in the VBA editor (macro editor) is a list of available commands that pops up when typing, known as “intellisense”. Details can be found in the VBA help under “List Properties/Methods Command (Edit Menu)”. With intellisense, there is no need to commit an endless list of commands, objects, methods and properties to memory. It’s all right there.

Screenshot of Intellisense drop-down list
Screen shot of intellisense Pop-up drop-down menu. Menu pops up after typing “.” after a valid object name or “ctrl+J”

Intellisense pops up immediately when one types a period following the name of an existing object. But, there’s a catch: if the object is defined with a Dim statement using “As Object” instead of as a specific type, it is not available.

Also, intellisense is available to add commands and objects by pressing ctrl+J.

The other advantage to early binding comes when a program is run. Early binding decreases the time it takes to set an object. Not a big deal for small macros, but it could add up for larger program.

Quick-access notepad, calculator & paint for “scratchpad”

Posted in Uncategorized by Administrator on the July 22nd, 2008

When I was in the navy, one was considered out-of-uniform if one did not have a pen and notepad on his person. On my workstation, I have a few tools to use for “jotting things down” when simple copy-and-paste is not quite enough.

Quick access shortcuts

I like to use MS Notepad as an on-screen scratchpad. I find it is handy for storing quick notes and lists of numbers that I may need elsewhere during the course of my CAD modelling. To make Notepad readily available, I add a shortcut key to the Windows menu. That way, I can have my scratchpad ready with a quick “Ctrl + Alt +N”.

To add a shortcut key, go to the Windows menu and find the application of interest (i.e. MS Notepad). Instead of left-clicking to start, right-click and select “Properties”. You will see a line for the shortcut key. Here, you can enter a “Ctrl + Alt + {letter}” or “Ctrl + Shift + {letter}” for a shortcut key. Once set, the application will start when the shortcut key combination is pressed.

Quick shortcuts for screenshots

I have a key shortcut for MS Paint, which I use for editing screenshots. Use “Shift + Printscreen” to capture the screen, open MS Paint, and paste (Ctrl + v). MS Paint will allow you to select a portion of the screenshot to crop or copy. The copied protion can be pasted into email, PowerPoint, MS Word, etc.

Other handy tools

Two other tools I like to keep on “hot standby” are the Windows Calculator and the Character Map. Character Map is handy for those odd symbols, Greek letters, etc. Calculator is good for, well, calculating. BTW, if you haven’t discovered it yet, Calculator does have a scientific mode w/ trig & log functions, etc.