Apply Explode Configuration in ERA environement

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

I'll like to apply explode configuration in ERA environement.

 

Following code isn't working, display state of occurrences is ok but the assembly is not explode (an error occur) :

 

  Public Sub ApplyASSYDisplayConf( _
ByVal SourceName As String, _
ByVal Explode As Boolean, _
ByRef RDResult As Integer, _
ByRef RDMsgResult As String)
        RDResult = 1 'NOTIFY
        RDMsgResult = "ApplyASSYDisplayConf -- Succès"

        'Analyse des paramètres
        If SourceName = "" Then
            RDResult = 3 'FAIL
            RDMsgResult = "ApplyASSYDisplayConf -- Le nom de la configuration source ne peut être vide."
            Return
        End If

        Dim objApplication As SolidEdgeFramework.Application = Nothing

        Try
            objApplication = CType(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
        Catch ex As Exception
            RDResult = 3 'FAIL
            RDMsgResult = "ApplyASSYDisplayConf -- Impossible d'accéder à Solid Edge"
            If Not (objApplication Is Nothing) Then
                Marshal.ReleaseComObject(objApplication)
                objApplication = Nothing
            End If
            Return
        End Try
        Dim Test As Boolean = False
        Try
            Dim Exist As Boolean = False
            If objApplication.ActiveDocumentType = DocumentTypeConstants.igAssemblyDocument Then

                If Explode = True Then
                    objApplication.StartCommand(10415)
                Else
                    objApplication.StartCommand(10231)
                End If

                Dim Configurations As SolidEdgeAssembly.Configurations = objApplication.ActiveDocument.Configurations
                Dim Configuration As SolidEdgeAssembly.Configuration = Nothing
                Dim ObjAsm As SolidEdgeAssembly.AssemblyDocument = objApplication.ActiveDocument

                For Each Conf As SolidEdgeAssembly.Configuration In Configurations
                    If Conf.Name = SourceName Then
                        Configuration = Conf
                        Configuration.Apply()
                        Exist = True
                    End If
                Next

                Configurations = Nothing
                Configuration = Nothing
                If Exist = False Then
                    RDResult = 3 'FAIL
                    RDMsgResult = "ApplyASSYDisplayConf -- Impossible de trouver la configuration d'affichage nommée '" & SourceName & "'"
                End If
            End If
        Catch ex As Exception
            RDResult = 3 'FAIL
            RDMsgResult = "ApplyASSYDisplayConf -- Impossible d'effectuer l'action"
            If Not (objApplication Is Nothing) Then
                Marshal.ReleaseComObject(objApplication)
                objApplication = Nothing
            End If
            Return
        End Try


        If Not (objApplication Is Nothing) Then
            Marshal.ReleaseComObject(objApplication)
            objApplication = Nothing
        End If
    End Sub

 


Romuald BERTIN
7 REPLIES

Re: Apply Explode Configuration in ERA environement

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

I don't know where your problem is, as I could run successfully the following code in a simple test (even with your code).

Dim objDoc As AssemblyDocument = objApplication.ActiveDocument
objApplication.StartCommand(10415) ' Open ERA environment
objApplication.DoIdle()
Dim objCfg As Configuration = objDoc.Configurations.Item(SourceName)
objCfg.Apply()

 

Re: Apply Explode Configuration in ERA environement

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Thanks for your informations MartinBernhard.

 

I think there is some sort of issues with ST6, the code works fine in ST5 but not in ST6 on my workstation.

 

Are you using Solid Edge ST6 ?


Romuald BERTIN

Re: Apply Explode Configuration in ERA environement

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

As I did not had issues during a simple test with only 3 parts on a newer version of ST, you should file an IR!

Re: Apply Explode Configuration in ERA environement

Solution Partner Genius Solution Partner Genius
Solution Partner Genius
I logged this issue to the GTAC :
IR 1970283

Romuald BERTIN

Re: Apply Explode Configuration in ERA environement

Valued Contributor
Valued Contributor

Was this ever resolved for you and if so how? I am running into the same problem and i need to be able to automatically update the configuration on the exploded view via code. If there is a solution please let me know

 

Thanks,

Andrew

Re: Apply Explode Configuration in ERA environement

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Here is the result of the IR :

 

The problem where you cannot apply Explode assembly display configuration using API in ST6 has been investigated and the following has been found.
Sample code provided by customer works well with ST6MP3 and ST5MP9.
The code provided might throw an exception if the specified configuration is not available in the Assembly file. Hence requesting the user to check if the specified configuration is available in assmbly file or not before applying it.
This problem is closed as cannot duplicate

Romuald BERTIN

Re: Apply Explode Configuration in ERA environement

Solution Partner Genius Solution Partner Genius
Solution Partner Genius
I still have the same problem with ST7.
Does anyone find an answer ?

Romuald BERTIN