Material list

Hi all,


I need to read the density of a material in SE V17, but I can't!


Who can help me?


My code is:


Option Explicit


Private Sub Form_Load()

Dim objApp As SolidEdgeFramework.Application

Dim objMaterialTable As SolidEdgeFramework.MatTable


Dim NumMat As Long

Dim listOfMat As Variant

Dim PROP As String

Dim J As Integer


On Error GoTo Errore

Set objApp = GetObject(, "solidedge.application")

objApp.Visible = True

Set objMaterialTable = objApp.GetMaterialTable


Call objMaterialTable.GetMaterialList(NumMat, listOfMat)


For J = 0 To NumMat - 1

Debug.Print J & " " & listOfMat(J)

Next J


Call objMaterialTable.GetMatPropValue(listOfMat(48), seModulusElasticity, PROP)

Debug.Print PROP



Set objMaterialTable = Nothing

Set objApp = Nothing


Exit Sub


Call MsgBox(Err.Description, vbOKOnly + vbInformation, "ERRORE")



End Sub


Posted by: Delki Trolese
Post date: 11/13/2005 10:08:43 PM


RE: Material list

Hi Delki,


The density is a variable on SE part/sheetmetal




I think you could read the density of each part on the asm





Posted by: pepe perez
Post date: 11/13/2005 10:36:44 PM

RE: Material list

Hi Borja


I can read the density in phisical property AFTER I put in the material.


I'writing a macro to process a lot of files to put in them the material and the density, and update the mass of any files PAR/PSM and ASM.


So I need to read the density from the materila.mtl


Best regards

Delki Trolese



Posted by: Delki Trolese
Post date: 11/13/2005 11:36:59 PM

RE: Material list

I haven't worked with the material table, but I do have a program that reads the density and updates the physical properties. Here is a snippet of reading the density:


objPartDoc = theEdge.ActiveDocument

objModels = objPartDoc.Models

If objModels.Count >= 1 Then

objModel = objModels.Item(1)

objPartDoc.GetGlobalParameter(SolidEdgePart.PartGlobalConstants.sePartGlobalDensity, dblDensity)

If dblDensity = 0.0# Then

MsgBox("The density is currently set to 0. Please verify the material and density.", MsgBoxStyle.OKOnly)

If Not (objModel Is Nothing) Then


End If

End If

End If


Here is updating physical properties for a part file:


objModel.ComputePhysicalProperties(dblDensity, 0.999, oVolume, oArea, oMass, oCenterOfGravity, oCenterOfVolume, oGlobalMoments, oPrincipalMoments, oPrincipalAxis1, oRadiiOfGyration, 0.001, oUpdateStatus)


I'll attach a subroutine I wrote in an addin.


Good luck,




Here is updating physical properties for an assembly file:




Posted by: Michael Frayser
Post date: 11/14/2005 8:02:48 AM