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
Thanks,
Mike






RE: Problem useing mass prop volume in a DT or Equation?
RE: Problem useing mass prop volume in a DT or Equation?
RE: Problem useing mass prop volume in a DT or Equation?
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?
RE: Problem useing mass prop volume in a DT or Equation?
"V"= Application.SldWorks.GetOpenDocument("Hose2.SLDPRT").Extension.CreateMassProperty.Mass
RE: Problem useing mass prop volume in a DT or Equation?
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?
RE: Problem useing mass prop volume in a DT or Equation?
Mike