Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Instant Measure 10

Status
Not open for further replies.

handleman

Automotive
Jan 7, 2005
3,411
0
0
US
I've always liked the way SW shows certain distance information in the status bar when you select certain entities without having to activate the "measure" tool. However, I use SW stretched across both monitors, so I often have to look to the opposite monitor to get my distance information. Also, it won't do certain things, such as center distance between two cylinders, etc.

With SW2008, we were given API access to the Measure tool and a way to put a popup message on the screen. With those, I've written a little macro that stays active and will auto-measure every time you select two (and only two) entities in a part or assembly. It puts the results in a little box that appears just below the mouse cursor.

While it's still not as powerful as the actual measure tool, I'm guessing this will eliminate about 90% of my uses of it. I can't really see any lag from it, although I haven't tested it on any really big assemblies yet.

-handleman, CSWP (The new, easy test)
 
Hi handleman
Cool sounding macro, however when I download the file all I get is the following:

Dim Listener As New MyListeningClass
Sub main()

Listener.Connect2SW

End Sub

More?

Gerald W
 
Did you try running it?

All the actual code is in the Class module called "MyListeningClass"

-handleman, CSWP (The new, easy test)
 
Agreed cool macro it might replace the measuring I do with the measure tool also.

But...

I ran it but didn't see any popup by my cursor. I very well might be doing something wrong... maybe a screen shot of what it looks like in action?

Thanks

Grant
Applications Engineer
SW2009 X64 SP 1.0
Dell Precision T5400
Nvidia Quadro FX 5600
Xeon 2.5GHz Quad Core, 4GB RAM
XP Pro X64 SP2.0
 
All the measure results are reported by SolidWorks in system units, which are meters and radians. The code changes the units to mm and degrees.

At the very top of the code in the MyListeningClass class module is a constant called "SF". It's currently 1000 to convert m to mm. If you'll change it to 100/2.54 it will convert m to in.



-handleman, CSWP (The new, easy test)
 
It has to be changed to 1000/25.4 to convert to inches.

Is there a way to change the number of decimals shown? Is there a way to adjust the time the box is shown?
 
Here's an updated version. It includes a few more constants at the top for ease of setup. To change the number of decimals, just add or remove "#" symbols from the DISTFMT or ANGFMT constants.

As far as the length of time displayed, there seems to be a 5 second limit, at least on my system. You can change MESSAGETIME to something less than 5, but anything more than 5 will just show the message for 5 seconds.

I've also fixed a little bug where coplanar surfaces report a normal distance of -1000. Now, coplanar surfaces will report a normal distance of 0 as you might expect.

-handleman, CSWP (The new, easy test)
 
 http://files.engineering.com/getfile.aspx?folder=e952f97b-209c-467d-83dd-5c290a06c910&file=SmartMeasure.swp
I tried running this in 2009 SP2.1 and it worked but never popped up the tool-tip style box beneath the cursor. It did show up in the bottom left of the status bar. It also is only showing mm measurements.

In one case I select a vertical line and a point, since these do not come up as parallel, but the normal distance and the distance are the same, no results were shown.

Attached are edits that address these issues. I also added the ability to set a fixed decimal size and display a "*" after the numeric value if it's been rounded off. Next edits should probably use the SW unit functions to allow any of the units in the doc options to be used correctly.
 
 http://files.engineering.com/getfile.aspx?folder=587db508-435e-41f1-8013-610b75cf2fe9&file=SmartMeasure.swp
It's fine with x64 just wasn't hitting the ctrl key while second clicking...

is there a way to have it "load" when solidworks is started sort of like an add in?

Grant
Applications Engineer
SW2009 X64 SP 1.0
Dell Precision T5400
Nvidia Quadro FX 5600
Xeon 2.5GHz Quad Core, 4GB RAM
XP Pro X64 SP2.0
 
Do make it launch the macro with SW, you need to create a new shortcut to SolidWorks and add "/m" and then the macro path, like:

"C:\Program Files\SolidWorks 2009\SolidWorks\SLDWORKS.exe" /m "c:\swmacrostuff\smartmeasure.swp"

-handleman, CSWP (The new, easy test)
 
Possible warning:

On my system I am experiencing some sort of conflict between SW and my display driver's multiple monitor management functions. I'm running a Quadro FX1700 with approved driver. When I have SW set to "enable window spanning across displays" and I launch SW with a shortcut that specifies a macro (any macro, even one that doesn't do anything), any file I open comes up with nothing visible in the graphics area or the feature tree. The window and title bar are still there, but the window contents don't update properly.

If I launch SW without the macro specified, everything works properly. Alternately, if I keep SW on a single screen and launch with macro, everything works.

-handleman, CSWP (The new, easy test)
 
Yes I've had plenty of problems running SW across two monitors on many different versions. I've personally never seen the need, I like having other stuff on my second monitor anyhow. I know that was terribly helpful. =P
 
Here's a VSTA .Net DLL version. It should be lighter weight than the text macro version. I've incorporated Dissymmetry's changes (using an ellipsis rather than an asterisk to indicate rounding).

I modified it to show more information as well:

Gives diameter for single-pick of cylinder or circular edge.
Gives length for edge or sketch segment.
For a partial cylinder or arc gives diameter and radius.

I think this has all you need to run the macro.

-handleman, CSWP (The new, easy test)
 
 http://files.engineering.com/getfile.aspx?folder=72d2b852-5d26-461d-a0ad-bd096dc0018a&file=SmartMeasure.zip
Handleman, how do you run the .DLL files? There are 5 of them, do you double-click the "SmartMeasure.dll" or what?

Flores
 
You can't just double-click it from Windows Explorer. You have to run it by going to Tools->Macro->Run and browsing to it. You may have to change the file type filter to "SW VSTA Macros (*.dll)" to get it to show up. Let me know if that doesn't work.

-handleman, CSWP (The new, easy test)
 
Status
Not open for further replies.
Back
Top