Tick Talk on EsoxRepublic.com


Comparing files’ internal ID’s

Posted in Internal ID by Administrator on the May 22nd, 2008

Originally posted on the SW website API forum, forums.solidworks.com
Compare file internal ID’s

There is no way in SW API to get a document’s internal ID (”IID”). SW doesn’t make that data publicly available, apparently because it would be too convenient for programmers who need that information. Still, there is a way to divine some useful information about a file’s internal ID.

SW recognizes two files as having the same IID if
1.) they were created at the exact same second
2.) they were created by the same installation of SW

Very difficult to ascertain #2, but #1 comes easy.

To answer the question, “Do these two files have the same internal ID?”, one need only check the creation date. But, not just any creation date. There are many ways to check creation date, and most will not work for this purpose. The creation date of interest is the one generated the instant a user clicked the final “OK” when creating a new file in SW. What’s the right way? Use DSOfile.dll. The property “SummaryProperties.DateCreated” records the moment SW brought this file into being. It does not change when a SW file is moved, renamed, or copied. It is the “mitochondrial DNA” date stamp, passed down intact through generations of saves, moves, and copies.

What’s the wrong way? Nearly any other creation date property or method. SW’s custom property “SW-Created Date” can change due to a Save As operation. Windows API methods creation dates can change depending on how and where a file is moved or copied.

How reliable is the DSOfile create date for determining if two files share an IID? The inverse of the probability that two files of interest were created by two separate people at the exact same second. Good enough.

Things API teaches about SW

Posted in API, Internal ID by Administrator on the May 21st, 2008

Part 1 of ?

One of the things I like about learning the API of SW is that it gives great insight into what is going on deep inside SW. The insight is not limited to just the SW application, either. I believe that the API also reveals some of the goings-on at the SW development offices.

Internal confusion about Internal ID

It’s a subject that has come up many times, in many places. API programmers working with SW drawings and assemblies need access to the internal ID (”IID”) of SW files. Without fail, they fail to find an answer. The answer I got from SW API support was in two parts:

  1. “SW API does not give access to IID information.”
  2. “You shouldn’t need it. If you needed it we would have given it to you.”

But we do need it. It comes up quite often, for many reasons. It is needed when swapping references. It is needed when attempting to repair lost references. It is needed when (re)organizing a non-PDM-using company’s SW file pile.

Access to IID data is a basic (if not primal) requirement for managing references. Yet, SW has done nothing to open it up to public API users. SW won’t even acknowledge its importance. Version after version is released without any tools for even comparing file IID’s. This clearly is a case where SW is 180° out of phase with the want and needs of the API user.

A partial solution exists

Recently, I posted a partial solution to the IID problem in forum.solidworks.com. Once I track it down, I will repost it here. There is a method to retrieve creation date information of a file which provides a means of reliably comparing SW file IID’s.

Coming soon

  1. A solution for comparing file IID’s
  2. Lost in lofts at SW