Imports System.Runtime.InteropServices
Public Class Form1
Private Sub SetUserDefinedAssemblyPhysicalProperties_Click(sender As Object, e As EventArgs) Handles SetUserDefinedAssemblyPhysicalProperties.Click
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objAssemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim oPhysicalProps As SolidEdgeAssembly.PhysicalProperties = Nothing
Dim dblMass As Double
Dim dblVolume As Double
Dim dblArea As Double
Dim dblCofMass(3) As Double
Dim dblCofVolume(3) As Double
Dim dblGlobalMoments(6) As Double
Dim dblPrincipalAxis1(3) As Double
Dim dblPrincipalAxis2(3) As Double
Dim dblPrincipalAxis3(3) As Double
Dim dblPrincipalMoments(3) As Double
Dim dblRadiiOfGyration(3) As Double
Dim dblOverridedMass As Double
Try
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objAssemblyDocument = objApplication.ActiveDocument
oPhysicalProps = objAssemblyDocument.PhysicalProperties
oPhysicalProps.UserDefinedPropertiesStatus = True
dblMass = 5
dblVolume = 0.0135
dblOverridedMass = 15
dblArea = 57
dblCofMass = {15, 0.5, 5}
dblCofVolume = {35, 0.05, 53}
dblGlobalMoments = {1, 4, 3, 5, 8, 7, 9}
dblPrincipalAxis1 = {3, 9, 5}
dblPrincipalAxis2 = {7, 5, 6}
dblPrincipalAxis3 = {5, 8, 5}
dblPrincipalMoments = {4, 3, 5}
dblRadiiOfGyration = {1, 5, 2}
Call oPhysicalProps.SetUserDefinedAssemblyPhysicalProperties(dblVolume, dblArea, dblMass, dblCofMass, dblCofVolume, dblGlobalMoments, dblPrincipalMoments, dblPrincipalAxis1, dblPrincipalAxis2, dblPrincipalAxis3, dblRadiiOfGyration, dblOverridedMass)
Catch ex As Exception
MsgBox(ex.ToString)
Clipboard.SetText(ex.ToString)
End Try
End Sub
End Class