Custom Mass from

Valued Contributor
Valued Contributor

Hi All,


To aid our office I'm writing a small program that will assist the user with entering the correct File Properties.

for example; it calculates the outer dimensions of the given part or sheet model and writes them to the custom field called 'Dimension'.


There is one thing however that just keeps failing;

On the form there is a textbox (called tMass) were a user can enter a Custom Mass. So if if a value has been entered this it will be flushed to the part and override the actual mass/density.


Using my current code, nothing happens, no error just nothing!

    Public Sub SetCustomMass(InputText As TextBox)
        Dim objApplication As SolidEdgeFramework.Application = Nothing
        Dim objDoc As SolidEdgePart.PartDocument
        Dim mPropertySets As SolidEdgeFramework.PropertySets
        Dim mProperties As SolidEdgeFramework.Properties
        Dim mProperty As SolidEdgeFramework.Property
        Dim models As SolidEdgePart.Models = Nothing
        Dim model As SolidEdgePart.Model = Nothing

        Dim density As Double = 0
        Dim accuracy As Double = 0.05
        Dim volume As Double = 0
        Dim area As Double = 0
        Dim mass As Double = 0
        Dim cetnerOfGravity As Array = Array.CreateInstance(GetType(Double), 3)
        Dim centerOfVolumne As Array = Array.CreateInstance(GetType(Double), 3)
        Dim globalMomentsOfInteria As Array = Array.CreateInstance(GetType(Double), 6) ' Ixx, Iyy, Izz, Ixy, Ixz and Iyz
        Dim principalMomentsOfInteria As Array = Array.CreateInstance(GetType(Double), 3) ' Ixx, Iyy and Izz
        Dim principalAxes As Array = Array.CreateInstance(GetType(Double), 9) ' 3 axes x 3 coords
        Dim radiiOfGyration As Array = Array.CreateInstance(GetType(Double), 9) ' 3 axes x 3 coords
        Dim relativeAccuracyAchieved As Double = 0
        Dim status As Integer = 0

        objApplication = Marshal.GetActiveObject("SolidEdge.Application")
        objDoc = objApplication.ActiveDocument

        mPropertySets = objDoc.Properties

        models = objDoc.Models
        model = models.Item(1)

        model.ComputePhysicalProperties(Density:=density, Accuracy:=accuracy, Volume:=volume, Area:=area, Mass:=CDbl(InputText.Text), CenterOfGravity:=cetnerOfGravity, CenterOfVolume:=centerOfVolumne, GlobalMomentsOfInteria:=globalMomentsOfInteria, PrincipalMomentsOfInteria:=principalMomentsOfInteria, PrincipalAxes:=principalAxes, RadiiOfGyration:=radiiOfGyration, RelativeAccuracyAchieved:=relativeAccuracyAchieved, Status:=status)
    End Sub


What am I doing wrong?!


With Kind Regards,




Maarten Elings | Mechanical Engineer

Re: Custom Mass from




I'm afraid you're trying to set a value to an output variable. In computePhysicalProperties method only density and accurancy are enter arguments.


Insted, you have to use PutUserPhysicalProperties method. This method is present in PartDocument and SheetMetalDocument. Take a look in Spy for SolidEdge "Type Browser" tab.


Dim objapp As SolidEdgeFramework.Application
Dim objdoc As SolidEdgePart.PartDocument

objapp = Marshal.GetActiveObject("SolidEdge.Application")
objdoc = objapp.ActiveDocument

Dim area As Double = 1.0 'are m^2
Dim volume As Double = 2.0 'are m^3
Dim mass As Double = 101.0 'are kg
Dim centerofgravity As Array = {1.0, 1.0, 1.0} 'are m (x,y,z)
Dim centerofvolume As Array = {1.0, 1.0, 1.0} 'are m (x,y,z)
Dim globalInertia As Array = {1.0, 1.0, 1.0} 'are kg*m^2 in (x,y,z)
Dim principalInertia As Array = {1.0, 1.0, 1.0} 'are kg*m^2 in (x,y,z)
Dim axes As Array = {1.0, 1.0, 1.0} 'are m (x,y,z)
Dim radio As Array = {1.0, 1.0, 1.0} 'are m (x,y,z)

objdoc.PutUserPhysicalProperties(volume, area, mass, centerofgravity, centerofvolume, globalInertia, principalInertia, axes, radio)


Hope it helps.


Best Regards from Spain



Héctor Pelayo Izquierdo
Engineering Department, JAE Ingeniería y Desarrollos, S.L.
Solid Edge ST9 MP5 | NX 9
Development: VB.NET

Re: Custom Mass from

Valued Contributor
Valued Contributor
Dear Hector,

Thank you so much or your reply and solution!
I have never used SESpy (i use that enormous help file thats in SE's SDK folder) but will take a look at it asap!
Maarten Elings | Mechanical Engineer