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!

Macro to do surface area calculation 3

Status
Not open for further replies.

bsj0526

Mechanical
Jan 5, 2008
40
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.
 
Replies continue below

Recommended for you

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.
 
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]
"If it's not broke, Don't fix it!"
faq731-376
 
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"

 
 http://files.engineering.com/getfile.aspx?folder=664f8283-1bf6-4963-95f7-324c991424b7&file=FacesArea.swp
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
 
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?
 
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
 
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.

[bat]Honesty may be the best policy, but insanity is a better defense.[bat]
-SolidWorks API VB programming help
 

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

weevoe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor