Option Explicit
'---------------------------------------------------------------------------
'COPYRIGHT DASSAULT SYSTEMES 2011
' ****************************************************************************
'
' Purpose: To create an SFD system and features in it.
'
' Assumptions: No document need to be active
'
' Author:
' Languages: VBScript
' Version: V5R21
' Locales: English
' CATIA Level: V5R21
'
' ****************************************************************************
Sub CATMain()
'Create a Product Document
Dim NewProdDoc As ProductDocument
Set NewProdDoc = CATIA.Documents.Add("Product")
'Get the Product from Product Document
Dim RootPrd As Product
Set RootPrd = NewProdDoc.Product
'Select the Product Document and Add Product to this selection
Dim SelectionObj As Selection
Set SelectionObj = NewProdDoc.Selection
SelectionObj.Add RootPrd
'Create a SFD product by Finding it it selection
Dim SfdProductObj As SfdProduct
Set SfdProductObj = SelectionObj.FindObject("CATIASfdProduct")
'Create a SFD System
Dim sfdpart As Part
Set sfdpart = SfdProductObj.CreateFunctionalSystem
'Retrieve the Factory from the SFD System part
Dim FactoryObj As SfmFactory
Set FactoryObj = sfdpart.GetCustomerFactory("SfmFactory")
'Retrieve the Manager from the Factory
Dim ManagerObj As SfmManager
Set ManagerObj = FactoryObj.GetManager
'Add Hull Using Manager
ManagerObj.AddHull
'Define Shell Plate Support
Dim ShellSupport As AnyObject
Set ShellSupport = sfdpart.FindObjectByName("Hull1234")
Dim ShellSupportRef As Reference
Set ShellSupportRef = sfdpart.CreateReferenceFromObject(ShellSupport)
Dim ShellSuperplate1 As SfmSuperPlate
Set ShellSuperplate1 = FactoryObj.AddSuperPlate("ShellPanel", ShellSupportRef, Nothing)
'Define Limit
Dim ShellPlateLimit As AnyObject
Set ShellPlateLimit = sfdpart.FindObjectByName("LONG.0")
Dim ShellPlateLimitRef As Reference
Set ShellPlateLimitRef = sfdpart.CreateReferenceFromObject(ShellPlateLimit)
'Define Orientation of Third Limit
Dim ShellPlateOrnt As Long
ShellPlateOrnt = 5
ShellSuperplate1.AddLimit ShellPlateLimitRef, ShellPlateOrnt
ShellSuperplate1.Run
sfdpart.Update
End Sub