I like to keep hitting my head against the wall

September 2nd, 2008


You know the old joke: “I like to keep hitting my head against the wall because it feels so good when I stop.”?

I think I figured out why I like programming.

First, will all of you SolidWorks Enterprise PDM admins join me in protest of the function “IEdmEnumeratorVariable8:GetVar”? Why do I have to have write permissions of the file just to read the variable?! …but more on that later.

I just wrote a cute little routine that checks out a file, does some file manipulation, then checks the file back in. Easy and sweet. Worked great when I tested it on its own but I was getting many problems when I included it into my add-in.

Hours go by. Testing it outside works, testing it in the intended environment [within an add-in] no work-ie.

Any guesses? It is an obvious answer once you hear it.

Yeah, My add-in also did some small variable checks when the file got checked out [EdmCmd_PostLock] -these checks used the soon to be boycotted “GetVar” function. Thus my original routine was checking out the file, which was then calling the checkout hooks which were trying to checkout the file. Two separate routines trying to get write access to the same file. You don’t need to be an Engineering Data Specialist to know that is a bad thing.

Chant with me: “No more GetVar! With GetVar you won’t go far! No more GetVar”!

Please excuse me while I leave to get some ice for the bump on my head.

(Once I found the problem, the fix was easy. I had several options. I chose to change GetVar to GetVarFromDb.)

Jeff Sweeney

CSWE Engineering Data Specialist 3DVision Technologies

Loading Facebook Comments ...

One Response to “I like to keep hitting my head against the wall”

  1. RaiulBaztepo says:

    Hello!
    Very Interesting post! Thank you for such interesting resource!
    PS: Sorry for my bad english, I’v just started to learn this language 😉
    See you!
    Your, Raiul Baztepo

Leave a Reply

Follow
Get every new post delivered to your inbox
Join other followers
Powered By WPFruits.com
Bear