I am trying to instantiate component form the catalog
Dim catia As Object
Set catia = GetObject(, "CATIA.Application")
' Open the main document containing the product
Dim mainDoc As Document
Set mainDoc = catia.ActiveDocument
' Define the compartment ID to get from the catalog
Dim compartmentID As String
compartmentID = "FICT-EQ-00002"
' Get the PspAppFactory interface
Dim pspFactory As pspAppFactory
Set pspFactory = mainDoc.product.pspAppFactory
' Instantiate the compartment into the current product
Dim compartment As PspGroup
Set compartment = mainDoc.GetCompartment(mainProduct, compartmentID)
Facing error in this line .
Set pspFactory = mainDoc.product.pspAppFactory
any suggestion would be highly appreciable
I am trying to instantiate component form the catalog
Dim catia As Object
Set catia = GetObject(, "CATIA.Application")
' Open the main document containing the product
Dim mainDoc As Document
Set mainDoc = catia.ActiveDocument
' Define the compartment ID to get from the catalog
Dim compartmentID As String
compartmentID = "FICT-EQ-00002"
' Get the PspAppFactory interface
Dim pspFactory As pspAppFactory
Set pspFactory = mainDoc.product.pspAppFactory
' Instantiate the compartment into the current product
Dim compartment As PspGroup
Set compartment = mainDoc.GetCompartment(mainProduct, compartmentID)
Facing error in this line .
Set pspFactory = mainDoc.product.pspAppFactory
any suggestion would be highly appreciable
Share Improve this question asked Feb 6 at 9:10 charan tejcharan tej 11 Answer
Reset to default 0According to the documentation (I haven't tested it), getting the factory needs several steps (example for piping, see also the CatPspIDLApplicationID
enumeration in the documentation):
Dim objPspWorkbench As PspWorkbench
Dim objPspApplication As PspApplication
Dim objPspAppFactory As PspAppFactory
Dim objProductRoot As Product
Set objProductRoot = CATIA.ActiveDocument.Product
Set objPspWorkbench = objProductRoot.GetTechnologicalObject("PspWorkbench")
Set objPspPipApplication = objPspWorkbench.GetApplication(catPspIDLCATPiping)
Set objPspPipAppFactory = objPspWorkbench.GetInterface("CATIAPspAppFactory",objPspPipApplication)
You may also have a look onto the samples in the documentation for a proper error handling.