' COPYRIGHT DASSAULT SYSTEMES 2000 ' *********************************************************************** ' Purpose: Creates Assembled Loads sets ' adds one V4 imported Loads and ' and one static case solution in the AA context ' Update the Loads ' Assumptions: ' Author: bmw ' Languages: VBScript ' Locales: English ' CATIA Level: V5R16 ' *********************************************************************** Sub CATMain() ' ----------------------------------------------------------- ' Optional: allows to find the sample wherever it's installed sDocPath=CATIA.SystemService.Environ("CATDocView") If (Not CATIA.FileSystem.FolderExists(sDocPath)) Then Err.Raise 9999,,"No Doc Path Defined" End If ' ----------------------------------------------------------- ' Open the CATAnalysis Document sFilePath = CATIA.FileSystem.ConcatenatePaths(sDocPath, "online\CAAScdAniUseCases\samples\Assembled_Loads_Solutions.CATAnalysis") Set analysisDocument1 = CATIA.Documents.Open(sFilePath) '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) 'Retrieve the analysis cases from analysis model Set analysisCases1 = analysisModel1.AnalysisCases 'Retrieve the second object that is Static Case.1 'from the list of analysis cases Set analysisCase1 = analysisCases1.Item(1) 'Retrieve the analysis sets and load set Set analysisSets1 = analysisCase1.AnalysisSets Set analysisSet1 = analysisSets1.Item("Loads.1", catAnalysisSetSearchAll) 'Retrieve the analysis entities from the load set Set analysisEntities1 = analysisSet1.AnalysisEntities 'Add assembled loads to the list Set analysisEntity1 = analysisEntities1.Add("SAMLoadAssembly") 'Retrieve the basic component from analysis entity Set basicComponents1 = analysisEntity1.BasicComponents Set basicComponent1 = basicComponents1.GetItem("SAMLoadP.1") 'Search and select Set selection1 = analysisDocument1.Selection selection1.Search "Name=*Load*,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 analysisSet = selection1.FindObject("CATIAAnalysisSet") Set entity = analysisSet.AnalysisEntities.Item(1) IF ( entity.Type = "SAMLoadAssembly") Then 'DO NOTHING ELSE Set Reference =analysisManager2.CreateReferenceFromObject(analysisSet) basicComponent1.AddSupportFromProduct product2, Reference END IF Next 'Update the analysis set analysisSet1.Update End Sub