×
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

Problem useing mass prop volume in a DT or Equation?
2

Problem useing mass prop volume in a DT or Equation?

Problem useing mass prop volume in a DT or Equation?

(OP)
This is my first thread so bear with me. (You know first long time listener, first time caller)  I need to use the mass properties volume in an equation, either a DT or an equation.  I need the value to solve for what I'm after.  I tried setting up a custom property and useing a design table, all I got was the text in the excel file.  I tried setting up an equation but all I get is an error.  I don't know if I'm using the wrong text or what I'm doing.  Any help would be greatly appreciated.

Thanks,
Mike

RE: Problem useing mass prop volume in a DT or Equation?

When you set up the property in the model, did the Evaluated Value field show the correct output?

cheers

RE: Problem useing mass prop volume in a DT or Equation?

(OP)
Yes, I just can't seem to get thet value to show up anyplace else.

RE: Problem useing mass prop volume in a DT or Equation?

2
If you put the expression:

Application.SldWorks.GetOpenDocument("YOURPARTNAMEHERE.SLDPRT").Extension.CreateMassProperty.Mass

in an equation, it will return the mass of all existing bodies in the active configuration of the file YOURPARTNAMEHERE.SLDPRT.  The part must be open in SolidWorks in its own window, although not necessarily the active window.  Otherwise, according to the help, the line "may not work as expected".  SW will attempt to evaluate the equation if you rebuild an assembly or drawing that references this part even if the part is not open in its own window.  If you are using the equation to drive dimensions etc. then you may get some undesirable behavior.  If you want the equation to work correctly no matter the context, you would need to replace the line above with:

Iif(False, CallByName(Application.SldWorks.GetOpenDocument("YOURPARTNAMEHERE.SLDPRT"),"Visible", vbLet, True), Application.SldWorks.GetOpenDocument("YOURPARTNAMEHERE.SLDPRT").Extension.CreateMassProperty.Mass)

This line will open and activate the document in its own window if it does not already have its own window.  If it does have its own window, the document will not be activated.

RE: Problem useing mass prop volume in a DT or Equation?

(OP)
  Thanks for the reply, unfortuanately that didn't work.  I'm thinking I must be inputing the code wrong but I'm not sure how.  In the equations I put " "V"= "Application.SldWorks.GetOpenDocument(Hose2.SLDPRT).Extension.CreateMassProperty.Mass" " and it wouldn't evaluate.  This has been the typical results for me.  If I put " "V"= "SW-Volume@Extend@Hose2.SLDPRT" " it again says it won't evaluate but I get a -1 in the value field.  Yesterday I tried what handleman told rstupplebeen about using custom props and it evaluated but when I tried to put that into an excel sheet I just got the text back not the value.

RE: Problem useing mass prop volume in a DT or Equation?

In this case, syntax is very important, and you have a bit of a quotation mark problem.  The entire expression should not be in quotation marks, but the name of your file must be in quotation marks.  So in your case, the exact text in the SolidWorks equation box should be:

"V"= Application.SldWorks.GetOpenDocument("Hose2.SLDPRT").Extension.CreateMassProperty.Mass

RE: Problem useing mass prop volume in a DT or Equation?

(OP)
handleman,
  Thanks, you're the man.  I'm still having one problem.  In Mass Properties it says 6.62 cu in. which seems right.  In the equation though I get either .108 with ".Mass" or .000108 with ".Volume".  I checked and my units are set to IPS.  Is this in a default unit like cubic meters?

Thanks again,
Mike

RE: Problem useing mass prop volume in a DT or Equation?

Yes, the return is in cubic meters.  If you multiply the .000108 result by (100^3)/(2.54^3)=61023.744 you will get your 6.62 cu in.  

RE: Problem useing mass prop volume in a DT or Equation?

(OP)
Thanks handleman.  I messed with it for a while and acutally had just arrived at that when your post showed-up.  I really appreciate the help.  I owe you a beer (at least)!!!!!

Mike

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