Reply

Acessing Model! Don't Work!

[ Edited ]

 

Hello!,

 

I have the following problem in VB . NET 2008 and Solid Edge ST:

 

When I try to read the model of a Syncronous Part document after reading the  Model of a Traditional Part document, an error occurs!

 

As the Model of Traditional Part was still in memory and SE lost .... ???

 

The same happens if I reverse the order of reading ....

 

Someone has idea of what can be?

 

Note: I am correctly instantiated each variable with its specific framework, Syncronous or Traditional ...

 

Posted by: Fabio Rosa
Post date: 4/9/2009 9:47:34 AM

4 REPLIES

RE: Acessing Model! Don't Work!

[ Edited ]

 

HI,

none ot this happen to me, doing similar tasks (in C++)

Please forward the code and steps to reproduce the problem.

Regards

Massimo

 

Posted by: Massimo Magris
Post date: 4/13/2009 1:54:02 AM

RE: Acessing Model! Don't Work!

[ Edited ]

 

 This is a prt of code:

'instancia novo documento

        Dim ObjApp As SolidEdgeFramework.Application

        ObjApp = Marshal.GetActiveObject("SolidEdge.Application")

        Dim ObjDoc As SolidEdgeFramework.SolidEdgeDocument

        'alimenta com documento atual

        'ObjDoc = pApplication.ActiveDocument

        ObjDoc = ObjApp.ActiveDocument

        'seleciona conforme o tipo de documento

        Select Case ObjDoc.Type

            'se for um Part

            Case SolidEdgeFramework.DocumentTypeConstants.igPartDocument

                'cria novo objeto Part

                Dim ObjPart As SolidEdgePart.PartDocument

                'alimenta com o documento ativo

                ObjPart = ObjApp.ActiveDocument

                'para cada modelo do documento

                For Each M As SolidEdgePart.Model In ObjPart.Models

                    'cria variáveis necessárias

                    Dim Status As Integer

                    Dim Density As Double

                    Dim Accuracy As Double

                    Dim Volume As Double

                    Dim Area As Double

                    Dim Mass As Double

                    Dim CenterOfGravity As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim CenterOfVolume As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim GlobalMomentsOfInertia As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim PrincipalMomentsOfInertia As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim PrincipalAxes As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim RadiiOfGyration As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim RelativeAccuracyAchieved As Double

                    'busca os valores

                    M.GetPhysicalProperties(Status, Density, Accuracy, Volume, Area, Mass, CenterOfGravity, CenterOfVolume, GlobalMomentsOfInertia, PrincipalMomentsOfInertia, PrincipalAxes, RadiiOfGyration, RelativeAccuracyAchieved)

                    'alimenta o valor

                    For Each L As Windows.Forms.DataGridViewRow In dgvDimensões.Rows

                        If dgvDimensões(0, L.Index).Value = "Peso (Kg)" Then

                            dgvDimensões("Valor", L.Index).Value = FormatNumber(Mass, 3, TriState.UseDefault, TriState.UseDefault, TriState.UseDefault)

                        End If

                    Next

                    If Not (M Is Nothing) Then

                        Marshal.ReleaseComObject(M)

                        M = Nothing

                    End If

                Next

                If Not (ObjPart Is Nothing) Then

                    Marshal.ReleaseComObject(ObjPart)

                    ObjPart = Nothing

                End If

                'se for um Part sincronizado

            Case SolidEdgeFramework.DocumentTypeConstants.igSyncPartDocument

                Dim ObjSPart As SolidEdgePartSync.PartDocument

                ObjSPart = ObjApp.ActiveDocument

                For Each MS As SolidEdgePartSync.Model In ObjSPart.Models

                    Dim Status As Integer

                    Dim Density As Double

                    Dim Accuracy As Double

                    Dim Volume As Double

                    Dim Area As Double

                    Dim Mass As Double

                    Dim CenterOfGravity As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim CenterOfVolume As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim GlobalMomentsOfInertia As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim PrincipalMomentsOfInertia As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim PrincipalAxes As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim RadiiOfGyration As Array = Array.CreateInstance(GetType(Double), 3)

                    Dim RelativeAccuracyAchieved As Double

                    MS.GetPhysicalProperties(Status, Density, Accuracy, Volume, Area, Mass, CenterOfGravity, CenterOfVolume, GlobalMomentsOfInertia, PrincipalMomentsOfInertia, PrincipalAxes, RadiiOfGyration, RelativeAccuracyAchieved)

                    For Each L As Windows.Forms.DataGridViewRow In dgvDimensões.Rows

                        If dgvDimensões(0, L.Index).Value = "Peso (Kg)" Then

                            dgvDimensões("Valor", L.Index).Value = FormatNumber(Mass, 3, TriState.UseDefault, TriState.UseDefault, TriState.UseDefault)

                        End If

                    Next

                    If Not (MS Is Nothing) Then

                        Marshal.ReleaseComObject(MS)

                        MS = Nothing

                    End If

                Next

                If Not (ObjSPart Is Nothing) Then

                    Marshal.ReleaseComObject(ObjSPart)

                    ObjSPart = Nothing

                End If

 

Posted by: Fabio Rosa
Post date: 4/13/2009 2:13:48 PM

RE: Acessing Model! Don't Work!

[ Edited ]

 

HI Fabio,

quick look to the code, seems ok.

Dont know how to help.

If it seems a bug, you should open a IR to siemens.

Regards

Massimo

 

Posted by: Massimo Magris
Post date: 4/14/2009 8:56:49 AM

RE: Acessing Model! Don't Work!

[ Edited ]

 

OK Massimo!

 

I also thought it might be a bug ...

 

Thank you!

 

Posted by: Fabio Rosa
Post date: 4/15/2009 2:23:05 AM