Tick Talk on EsoxRepublic.com


Shapeshifting Through SW Dimension API

Posted in API by Administrator on the October 21st, 2008

One of the sticky things about working with SolidWorks API is the fragmented object structure. Often, it takes more than one object type to deal with a single object. The most common example is the ModelDoc/PartDoc/AssemblyDoc/DrawingDoc objects. All SW files are ModelDocs, but many API functions are only available in the type-specific objects, and accessing those functions may require setting a second PartDoc or AssemblyDoc or DrawingDoc object after the ModelDoc object is already set.

A less common but more convoluted set of objects is the ones that deal with dimensions. There are as many as four different objects that deal with a SolidWorks dimension:

  • Dimension: Properties and methods for the dimension parameter, such as name, value, driven state
  • Tolerance: A sub-object of Dimension, used to access tolerance info
  • Display Dimension: Dimesnions can be displayed in more than one place, DisplayDimension is a single display instance.
  • Annotation: DisplayDimension is a sub-object of the Annotation object. You would need the Annotation object to access layers and leaders.
Dimension object chart
Hierarchy of dimension-related objects.

Selecting Dimensions

When Accessing selected dimensions, the SW SelectionMgr object passes selected dimensions as DisplayDimension object. This means that it is necessary to pass the DisplayDimension object to a Dimension object to change its value. It would be necessary to pass the DisplayDimension to an Annotation object to change its layer. To change a tolerance, one may need to access the Tolerance object (though there are some unlisted Dimension object API’s that access tolerance data).

The example code below shows how to take a DisplayDimension from the SelectionMgr, pass it to a Dimension object, and then change the dimension value.

Set swApp = Application.SldWorks
Dim swApp As SldWorks.SldWorks
Dim ActDoc As SldWorks.ModelDoc2
Dim SelMgr As SldWorks.SelectionMgr
Dim DispDim As SldWorks.DisplayDimension
Dim DimToEdit As SldWorks.Dimension

Set ActDoc = swApp.ActiveDoc
Set SelMgr = ActDoc.SelectionManager

‘get selected DisplayDimension object
Set DispDim = SelMgr.GetSelectedObject6(1)
‘pass selection to a Dimension object
Set DimToEdit = DispDim.GetDimension
change value of Dimension object
DimToEdit.SetUserValueIn2 ActDoc, CDbl(2.78), swSetValue_UseCurrentSetting

OT: Football pool

Once again, I’m in a football pool. Once again, I was off to an abysmal start, 4-5 right per week. Until last week, that is. I changed my pick strategy. For the last two weeks, I have picked the team whose home city has the highest crime rate. Got 10 right last week and 7 this week (our winner only had 9). I’ll go with this strategy for a while longer and see how it pans out.

Reliable Sources of News re: Economic Crisis

Posted in Uncategorized by Administrator on the October 10th, 2008

I have been following the current economic crisis long before it became news. I average two to three hours per week reading in-depth about the conditions that have brought this crisis to bear. After the last big crash, I took stock of my news sources to see who actually saw it coming. I promised myself I would pay heed when these same sources sounded the alarm again.

My sources did not fail me. I pulled my long term money from the stock market in November. Since then. I have made modest profits taking short term contrarian positions, while my coworkers’ 401k’s nose down, adding years to their projected retirement dates.

Where to go

My favorite dependable sources for news and information:

John Mauldin: John writes two blogs on Investor Insight: Outside the Box and Thoughts from the Frontline. These are not light reading. These are articles to print, study, and highlight. There is much to learn here

Bill Fleckenstein: I actually discovered “Fleck” just recently. A friend of mine who had exercised similar foresight told me this is where he got his “heads-up”. I’ve read many of his articles, his record speaks for itself. Fleck writes a free weekly blog on MSN money in addition to his subscription service.

Stratfor.com: I was fortunate to get in with Stratfor ten years ago while they had more free stuff available. I still get alerts and news via email from them. I don’t know how to get on their list, but if you can… SCORE! It was Stratfor that introduced me to John Mauldin.

Schaeffer Research: If you’re looking for a good base to start learning about contrarian investing, this is a good place to start. They’re pretty aggressive about trying to sell their wares. Ignore that and dig into the content. Even in tough times, it is possible to make money.

Soundbites and News Reveal Nothing

By now, only complete idiots believe the mainstream news media provides fair, balanced, accurate coverage. Also worth bypassing are left- and right-wing partisan commentators. Most of the talking heads are too lame to understand the nature of the current climate, anyhow. The situation is too complicated for blurbs. To understand requires study.

The Crisis Hits Main Street in the Midwest

For those who believe this is only the problem of in-over-their-head mortgage holders and Wall Street fat cats, think again. 401K’s are getting sapped. Insurance and pension funds, too. What’s more important, the credit crunch is hurting business.

I heard from one business owner that he is losing orders because his customers can not get credit. They are good customers in a growth industry. As inventory piles up, so will the ranks of the unemployed.

Another business (one that I have a personal financial stake in) is having similar problems. They manufacture capital production equipment. Customers are pushing timelines back while they search for financing

The best two paragraphs I have read

Below is an excerpt from a Stratfor email I received recently. It is the best synopsis I have read.

As interest rates declined in recent years, investors — particularly conservative ones — sought to increase their return without giving up safety and liquidity. They wanted something for nothing, and the market obliged. They were given instruments ultimately based on mortgages on private homes. They therefore had a very real asset base — a house — and therefore had collateral. The value of homes historically had risen, and therefore the value of the assets appeared secured. Financial instruments of increasing complexity eventually were devised, which were bought by conservative investors. In due course, these instruments were bought by less conservative investors, who used them as collateral for borrowing money. They used this money to buy other instruments in a pyramiding scheme that rested on one premise: the existence of houses whose value remained stable or grew.

Unfortunately, housing prices declined. A period of uncertainty about the value of the paper based on home mortgages followed. People claimed to be confused as to what the real value of the paper was. In fact, they were not so much confused as deceptive. They didn’t want to reveal that the value of the paper had declined dramatically. At a certain point, the facts could no longer be hidden, and vast amounts of value evaporated — taking with them not only the vast pyramids of those who first created the instruments and then borrowed heavily against them, but also the more conservative investors trying to put their money in a secure space while squeezing out a few extra points of interest. The decline in housing prices triggered massive losses of money in the financial markets, as well as reluctance to lend based on uncertainty of values. The result was a liquidity crisis, which simply meant that a lot of people had gone broke and that those who still had money weren’t lending it — certainly not to financial institutions.