Analysis Modeler

Creating Assembled Solution


This use case shows you how to create an assembled solution. Here use of Edit/Search... capability through VB is also demonstrated.

This macro opens an analysis assembly document and creates two assembled solutions. In the first assembled solution a V4 imported solution is added and in the second a static case is added. Both of these solutions are selected using the Edit/Search... capability. Assembled solution ( also called displacement assembly) is created in assembled analysis. This solution is concatenation of several solutions computed in the sub-analysis. This scenario is available only in Generative Assembly Structural Analysis (GAS) product.

 

 

CAAAniPreProAsmbldSol is launched in CATIA [1].No open document is needed.

CAAAniPreProAsmbldSol.catvbs is located in the CAAScdAniUseCases module. Execute macro (Windows only).

 

CAAAniPreProAsmbldSol includes the following steps:

  1. Prolog
  2. Extracting the analysis documents and analysis models
  3. Adding the assembled solution set
  4. Searching through the selection and applying the selected objects
  5. Epilog

Prolog

...
' ----------------------------------------------------------- 
' Optional: allows to find the sample wherever it's installed
sDocPath=CATIA.SystemService.Environ("CATDocView")
sSep=CATIA.SystemService.Environ("ADL_ODT_SLASH")

If (Not CATIA.FileSystem.FolderExists(sDocPath)) Then
Err.Raise 9999,,"No Doc Path Defined"
End If
' ----------------------------------------------------------- 
' Open the Analysis document 
Set analysisDocument1 = CATIA.Documents.Open(sDocPath & sSep & "online" & sSep & "CAAScdAniUseCases" &
						 sSep & "samples" & sSep & "Assembled_Loads_Slutions.CATAnalysis")
...

Open the Analysis document. The Analysis document is retrieved in the documentation installation path, this path has already been stored in the sDocPath variable. In the collection of documents, two documents can be retrieved; the Analysis document and the Part document.

Extracting the analysis documents and analysis models

...
'Retrieve the Analysis Manageer from tha analysis document
Set analysisManager1 = analysisDocument1.Analysis

'Retrieve the product document from the linked document
Set analysisLinkedDocuments1 = analysisManager1.LinkedDocuments
Set productDocument1 = analysisLinkedDocuments1.Item(1)

'From product document retrieve products
Set product1 = productDocument1.Product
Set products1 = product1.Products
Set product2 = products1.Item("Analysis1.1")

'Retrieve the analysis models and the first model
Set analysisModels1 = analysisManager1.AnalysisModels
Set analysisModel1 = analysisModels1.Item(1)

...

According to the general Analysis Document structure, this macro uses some standard procedures to navigate or retrieve the required objects. First, from the Document, we find the Analysis Manager Object, and  Analysis Models. From analysis models we retrieve the Analysis Cases.

Adding the assembled load set

...  
'Retrieve the analysis cases from analysis model
 Set analysisCases1 = analysisModel1.AnalysisCases
 
'Retrieve the second object that is Solution Case.1 
'from the list of analysis cases
Set analysisCase1 = analysisCases1.Item(2)
 
'Retrieve the analysis case
Set analysisSets1 = analysisCase1.AnalysisSets
 
'Add two Assembled solution sets
Set analysisSet1 = analysisSets1.Add("ElfAssembledSet", catAnalysisSetOut)
Set analysisSet2 = analysisSets1.Add("ElfAssembledSet", catAnalysisSetOut)
 
'Retrieve the basic component from the analysis set
Set basicComponents1 = analysisSet1.BasicComponents
Set basicComponent1 = basicComponents1.GetItem("ElfAssemblyPtr.1")
 
'Retrieve the basic component from the analysis set
Set basicComponents2 = analysisSet2.BasicComponents
Set basicComponent2 = basicComponents2.GetItem("ElfAssemblyPtr.1")
...

Here we retrieve the solution case, in which we want to add the assembled load. First the list of cases is retrieved from analysis model. The index of the analysis case is same as that of the position in which it appears in specification tree. Once we get the desired solution case we retrieve the set and add assembled solution to it. To add analysis sets to assembled solution

Searching through the selection and applying the selected objects

...  
'Search and select
Set selection1 = analysisDocument1.Selection
selection1.Search "Name=*DISP*,all"

'Retrieve the analysis manager object from the analysis document
Set documents1 = CATIA.Documents
Set analysisDocument2 = documents1.Item("Analysis1.CATAnalysis")
Set analysisManager2 = analysisDocument2.Analysis


'Go through the selections and find out the the analysis set
'create a reference from the analysis set and add it to the basic component
For i =1 To selection1.Count
          Set element = selection1.Item(i)
           IF (element.Type = "AnalysisSet" ) Then 'DO NOTHING
              Set Reference = analysisManager2.CreateReferenceFromObject(element.Value)
              basicComponent1.AddSupportFromProduct product2, Reference
         END IF
       
Next

'Search and select
selection1.Clear
selection1.Search "Name=*Static Case*,all"

'Remove the last static case, since this is at the same
'level in the analysis assembly
selection1.Remove2(selection1.Count)

'Go through the selections and find out the the analysis set
'create a reference from the analysis set and add it to the basic component
For i =1 To selection1.Count
          Set element = selection1.Item(i)
           IF (element.Type = "AnalysisSet" ) Then 'DO NOTHING
               Set Reference = analysisManager2.CreateReferenceFromObject(element.Value)
               basicComponent2.AddSupportFromProduct product2, Reference
         END IF
       
Next

'update the two analysis sets
analysisSet1.Update
analysisSet2.Update

...

The selection interface allows the user to search objects by providing a search string. This is equivalent of selecting objects interactively through edit search. Here it is important to understand that all the objects which match the search criterion will be selected, this may include objects which do not qualify to be set as support to assembled solutions. Hence we add only the element of type analysis set. First we search for the V4 imported mesh and set as support to the assembled solution and again we search for the static case solution which is set as support to the second assembled solution.

Epilog

...
End Sub
...

[Top]


In Short

This use case has shown how to create assembled solution and how to select object using the selection interface.

[Top]


References

[1] Replaying a Macro
[Top]

Copyright © 2001, Dassault Systèmes. All rights reserved.