×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Macro to do surface area calculation
3

Macro to do surface area calculation

Macro to do surface area calculation

(OP)
I am working on a casting that will be a housing for some components and also have some heatsinkging ribs on the outer perimeter.

I am looking for a way to calculate the surface area of just the outer portion of the casting.  I know that I can select the faces and use one of the measure commands in Solidworks but I would like to define a "selection set" and have Solidworks retain it for surface area calculations.

I am assuming that using a macro is the best way to do this.  If anyone has been through this before or has some advice, please let me know.

RE: Macro to do surface area calculation

What about a surface offset of 0 (surface copy) and measure that?

Stefan Hamminga
EngIT Solutions
CSWP/Mechanical designer
Searching Eng-Tips forums

RE: Macro to do surface area calculation

(OP)
I have tried to do a surface area calculation on a surface, it dosen't work.  If you have another way of doing it, let me know.

RE: Macro to do surface area calculation

I think Stefan is right. Make a knitted surface of the casting and get your info there.

If it won't calculate for a surface turn it into a solid.

Don't know of any Macros to solve for each surface.

Regards,

Scott Baugh, CSWP pc2
www.scottjbaugh.com

Quote:

"If it's not broke, Don't fix it!"
FAQ731-376: Eng-Tips.com Forum Policies

RE: Macro to do surface area calculation

This was an interesting question, and one requiring the use of SafeEntities.  It's pretty self-explanatory.  Just select your desired faces and hit "Save Cur Faces".  The macro will calculate the total area and then remember those faces as long as you don't close the form window.  You can make whatever changes you want, then hit "Recalc. Area" to see the result of those changes.  Of course, your changes could cause faces to be eliminated.  The missing faces will be retained in the saved set, but they will not affect the area calculation, and the count of missing faces is displayed.  If those faces reappear due to additional changes, they will again be included in the calculation without having to reselect them.  To highlight/select the current saved face set (and recalculate missing face count), hit "Select Cur Faces".  You can then modify the saved set by unselecting faces or selecting additional faces and then hitting "Save Cur Faces".  That will replace the old saved set with the current selections, so any missing faces will be lost from the set.

There are two constants you may want to modify.  The current precision is two decimal places, and the current units are mm^2.  To change these constants:

1. Edit the macro.

2. Right-click on frmFacesArea inside the Forms folder on the left-hand pane of the VBA editor and choose "View Code"

The constants are at the very beginning of the code.  To change precision, change the number of zeros after the decimal in "#.00"

RE: Macro to do surface area calculation

Thanks for the macro handleman, but I seem to have a problem. It will launch but as soon as I click in the work area it disappears & will not relaunch. Could it be my 64 bit 2007 SP 0?

Weevoe

RE: Macro to do surface area calculation

I suppose that's possible, although it's not an issue I've heard before.  Anyone else able to test on the same SW version?

RE: Macro to do surface area calculation

FYI. I tried it again today & found it on the desktop. It seems to go there every time I click in the workspace. I did look under open windows yesterday but I must have missed it. I had about 6 SW files open & 6 different programs running. I don't really care as long as I can find it, so thanks again handleman.

weevoe

RE: Macro to do surface area calculation

2
There's a faster way to get a collection of small surfaces without selecting.

Use Copy to copy the entire body.  Then use "Delete Face" to remove one or more face from the solid without patching.  This turns the solid body ito a surface body.  Use "Delete Body" to get rid of extra surface bodies if you wish.

In the case of getting the exterior faces of the casting, you only need to remove the faces that define the border between outside and inside.  As long as the border faces stay the same, the resulting surface body will update with the solid.

I used to use this method to maintain surface bodies used to calculate enclosed volumes.

batHonesty may be the best policy, but insanity is a better defense.bat
http://www.EsoxRepublic.com-SolidWorks API VB programming help

RE: Macro to do surface area calculation


Thanks for the information TheTick. I will use it on my next casting project which reguires volume & surface area to be maintained.

weevoe

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources