Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Instant Measure 10

Status
Not open for further replies.
Has anyone else out there used the SW2008 version? I had tested it in assembly mode, but I have not spent any real time in Assembly mode using it...Turns out SW2008 crashes if I try to mate anything with the SmartMeasure active.

Ken
 
Wow, it really crashes, doesn't it? The line it doesn't seem to like is the one where it actually is supposed to set the callout. I can comment that line out and debug.print the content of WriteString while mating, etc, with no problem. Alternately, with the callout line un-commented, I can add mates with my mating macros but SW crashes immediately if I try to add mates through the standard UI. About the only semi-solution I can think of would be to write the string to the Status Bar. Not exactly ideal because you have to look down in the corner of the screen for the result.

-handleman, CSWP (The new, easy test)
 
Yea I primarily us the mating macros too, so it took a while to surface.

Thanks for the input. Talk to you later,
Ken
 
I modified the SW2008 version:

For Parts:
-Callout Box still pops up.
-Measurement will also be displayed in lower right of Status Bar (no time limit on that, just waits for another selection to occur).

For Assemblies:
-Measurement will only display in lower right of Status Bar.

Thanks Handleman!

Ken
 
 http://files.engineering.com/getfile.aspx?folder=a3cb3d86-752a-4c72-865a-9de8ec46c7f8&file=SmartMeasure2008.swp
Ken,
Give this one a shot. It uses Windows API DrawText to write the measurement string directly to the window at the mouse cursor location. All of the Windows API stuff is packaged in a separate module, so you can export it and use it again if you should ever want to, Excel, Word, whatever.

I had to make one small change due to the graphics redraw. When the command to write to the screen comes inside the MeasureIt sub, the text gets written to the screen before the view updates to highlight the selections. Of course, when the view updates, it overwrites the directly-written text. I had to make the macro wait for the OnIdleNotify event to actually write the text to the screen, so I turn on a global boolean flag in the MeasureIt sub and turn it back off after writing the text to the screen in the OnIdleNotify event.

-handleman, CSWP (The new, easy test)
 
 http://files.engineering.com/getfile.aspx?folder=0a36a694-3add-42fd-adfc-7f331a4d0800&file=SmartMeasure2008.swp
I was thinking about this over lunch. It's currently not all that efficient, because every time SW is idle it runs through that sub. So I changed it a bit. Now, at the end of the MeasureIt routine, the SldWorks.SldWorks object "swSessionToWriteTo" is set to the current application instance. This instance is monitored for the OnIdleNotify event, but then set = Nothing by that code so that it's not triggered again until after MeasureIt runs again. This should reduce the processor load.

-handleman, CSWP (The new, easy test)
 
 http://files.engineering.com/getfile.aspx?folder=cbdf3413-c3ed-44d8-b99b-f15db84f8ab8&file=SmartMeasure2008.swp
Status
Not open for further replies.

Part and Inventory Search

Sponsor