speos caa v5 based automation - optis...
TRANSCRIPT
SPEOS CAA V5 Based Automation
Table of Contents
What is Automation .................................................................................................. 4 Automation in SPEOS CAA V5 Based .............................................................................. 5 APIs ...................................................................................................................... 6
SPEOS CAA V5 Based .......................................................................................... 6 Object Hierarchy....................................................................................... 6 Obsolete Interfaces ................................................................................... 6 Interfaces ............................................................................................... 7 Methods................................................................................................. 16 Properties .............................................................................................. 20
SPEOS Core .................................................................................................... 30 Using SPEOS Core Automation ...................................................................... 30 Methods................................................................................................. 31
Page 4 of 32 SPEOS CAA V5 Based Automation User Guide
What is Automation
General Description
With Automation, you can communicate with any Windows applications.
Automation can replace the old specific macro way method for writing script.
With automation you can:
Write script using any language compatible with Automation (VB Script, C++...),
Directly access results data without knowing specific format (like XMP file),
Write your own HTML reports that automatically analyze the results,
Write your own optimization code...
Technical Description
Automation is based on COM (Component Object Model).
This is a standard way to describe the interface exposed by a Windows application to other Windows applications.
The interface is described using the IDL (Interface Description Language).
This interface is used to give the description of all data and functions (and their parameters) that can be called from
another application.
The exposed data are called Properties.
The exposed functions are called Methods.
Development Tools
If you want to use Automation, you need to decide which language to use depending on your needs.
For basic needs the VB Script or VBA language is the easiest to understand and to use for a non-developer.
You can use VB Script in HTML file.
You can use FrontPage for editing the HTML file.
VB Script or VBA is also included in a lot of software.
When you write a macro with this software, the VB Script language is used.
So it is very easy to write macro that mix CAD VB Script or VBA instructions and Virtual Photometric Lab VB Script
instructions : using your own merit function you have your own optimization tool.
For more complex needs, you must use C++, which is a more difficult language to learn for non developers.
If you want to have advices, code fraction and API functions' examples, you can view these APIs
(http://www.solidworks.com/api).
Automation in SPEOS CAA V5 Based Page 5 of 32
Automation in SPEOS CAA V5 Based
What You Can Do with Automation in SPEOS CAA V5 Based
You can launch simulations, get the results and load them.
SPEOS CAA V5 Based Automation includes functions giving access to data.
This section of the SPEOS CAA V5 Based Automation help includes:
The description of all the SPEOS CAA V5 Based Automation APIs (see page 6).
The description of all the SPEOS CAA V5 Based Standalone Automation APIs (see page 30).
What SPEOS CAA V5 Based APIs Can Achieve
Changing sources' configuration (for example flux, type of spectrum...) for luminaire sources.
Launching illuminance and luminance simulations (Direct and Inverse simulations).
SPEOS CAA V5 Based and SPEOS Core Automation APIs can be used with OPTIS Labs Automation to analyze the
results (you can view OPTIS Labs Automation Index page or OPTIS Labs Automation).
Basic Tasks
Getting a SPEOS CAA V5 Based Object
This method gets the object related to the Simulation. int GetItem ();
1. From Microsoft Visual Basic, select Insert, Object resolution.
-Or -
From the Macros Editor, select Edit, Insert object resolution.
2. Select the simulation in the specification tree, and the following code is created.
'---- Begin resolution script for object: simu
Dim productDocument1 As productDocument
Set productDocument1 = CATIA.ActiveDocument
Dim product1 As product
Set product1 = productDocument1.product
Dim speosNodeRoot1 As speosNodeRoot
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").SpeosCAA()
Dim speosNodeSimulation1 As speosNodeSimulation
Set speosNodeSimulation1 = speosNodeRoot1.Item("Simulations")
Dim simuDirect1 As SimuDirect
Set simuDirect1 = speosNodeSimulation1.Item("Simu")
'---- End resolution script
Updating a SPEOS CAA V5 Based Object
This method updates the object related to the Simulation. Boolean Update (); Returns a Boolean that can be used to
check if the simulation runs correctly.
Dim bUpdate As Boolean bUpdate = Simu.Update
Page 6 of 32 SPEOS CAA V5 Based Automation User Guide
APIs
SPEOS CAA V5 Based
Object Hierarchy
IUnknown
+---IDispatch
+---CATBaseUnknown
+---CATBaseDispatch
+---AnyObject
+---OPTSpeosCAAProduct (see page 11) (SpeosCAAProduct (see page 11))*
+---OPTSpeosFeature (see page 11) (SpeosFeature (see page 11))*
+---OPTSimu (see page 7) (Simu (see page 7))*
+---OPTSimuDirect (see page 7) (SimuDirect (see page 7))*
+---OPTSimuInteractive (see page 8) (SimuInteractive (see page 8))*
+---OPTSimuInverse (see page 8) (SimuInverse (see page 8))*
+---Collection
+---OPTSpeosNode (see page 12) (SpeosNode (see page 12))*
+---OPTSpeosNodeMeasure (see page 12) (SpeosNodeMeasure (see page 12))*
+---OPTSpeosNodeOpticalProperties (see page 13) (SpeosNodeOpticalProperties (see
page 13))*
+---OPTSpeosNodeRoot (see page 13) (SpeosNodeRoot (see page 13))*
+---OPTSpeosNodeSensor (see page 14) (SpeosNodeSensor (see page 14))*
+---OPTSpeosNodeSimulation (see page 15) (SpeosNodeSimulation (see page 15))*
+---OPTSpeosNodeSource (see page 15) (SpeosNodeSource (see page 15))*
+---OPTSourceBase (see page 9)
+---OPTSourceLuminaire (see page 10)
+---OPTSpeosNodeWindshield (see page 16) (SpeosNodeWindshield (see page 16))*
()* Obsolete Interfaces available before version 6.0
Obsolete Interfaces
SpeosCAAProduct has been replaced by OPTSpeosCAAProduct (see page 11)
SpeosFeature has been replaced by OPTSpeosFeature (see page 11)
Simu has been replaced by OPTSimu (see page 7)
SimuDirect has been replaced by OPTSimuDirect (see page 7)
SimuInteractive has been replaced by OPTSimuInteractive (see page 8)
SimuInverse has been replaced by OPSimuInverse (see page 8)
SpeosNode has been replaced by OPTSpeosNode (see page 12)
SpeosNodeMeasure has been replaced by OPTSpeosNodeMeasure (see page 12)
APIs Page 7 of 32
SpeosNodeOpticalProperties has been replaced by OPTSpeosNodeOpticalProperties (see page 13)
SpeosNodeRoot has been replaced by OPTSpeosNodeRoot (see page 13)
SpeosNodeSensor has been replaced by OPTSpeosNodeSensor (see page 14)
SpeosNodeSimulation has been replaced by OPTSpeosNodeSimulation (see page 15)
SpeosNodeSource has been replaced by OPTSpeosNodeSource (see page 15)
SpeosNodeWindshield has been replaced by OPTSpeosNodeWindshield (see page 16)
Interfaces
OPTSimu Interface
SpeosFeature (see page 11)
+---OPTSimu (Simu)
Description
With the Simulation Interface, you can manage a simulation. It is part of CATIA V5 OPTSimuInterfaces Object Library.
Property Index
Application (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Update (see page 19)
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTSpeosNodeSimulation
Dim simu1 As OPTSimu
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simu1 = speosNodeSimulation1.Item("Inverse simulation.1")
simu1.Update
OPTSimDirect Interface
SpeosFeature (see page 11)
+---OPTSimu (see page 7) (Simu)
+---OPTSimuDirect (SimuDirect)
Description
With the OPTSimuDirect Interface, you can manage a direct simulation. It is part of CATIA V5 OPTSimuInterfaces
Object Library.
Property Index
Application (see page 20)
Name (see page 21)
Page 8 of 32 SPEOS CAA V5 Based Automation User Guide
Parent (see page 23)
Method Index
GetItem (see page 17)
Update (see page 19)
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTSpeosNodeSimulation
Dim simu1 As OPTSimuDirect
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simu1 = speosNodeSimulation1.Item("Direct simulation.1")
simu1.Update
OPTSimuInteractive Interface
SpeosFeature (see page 11)
+---OPTSimu (see page 7) (Simu)
+---OPTSimuInteractive (SimuInteractive)
Description
With the OPTSimuInteractive Interface, you can manage an interactive simulation. It is part of CATIA V5
OPTSimuInterfaces Object Library.
Property Index
Application (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Update (see page 19)
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTSpeosNodeSimulation
Dim simu1 As OPTSimuInteractive
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simu1 = speosNodeSimulation1.Item("Interactive simulation.1")
simu1.Update
OPTSimuInverse Interface
SpeosFeature (see page 11)
+---OPTSimu (see page 7) (Simu)
APIs Page 9 of 32
SpeosFeature (see page 11)
+---OPTSimuInverse (SimuInverse)
Description
With the OPTSimuInverse Interface, you can manage a inverse simulation. It is part of CATIA V5 OPTSimuInterfaces
Object Library.
Property Index
Application (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Update (see page 19)
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTSpeosNodeSimulation
Dim simu1 As OPTSimuInverse
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simu1 = speosNodeSimulation1.Item("Inverse simulation.1")
simu1.Update
OPTSourceBase Interface
OPTSpeosNode (see page 12) (SpeosNode)
+---OPTSpeosNodeSource (see page 15) (SpeosNodeSource)
+---OPTSourceBase
Description
With the OPTSourceBase Interface, you can manage basic sources (except luminary sources). It is part of CATIA V5
OPTSourceInterfaces Object Library.
Property Index
Application (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Update (see page 19)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Page 10 of 32 SPEOS CAA V5 Based Automation User Guide
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceBase1 As OPTSourceBase
Set documents1 = CATIA.Documents
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceBase1 = speosNodeSource1.Item("MySource")
OPTSourceLuminaire Interface
OPTSpeosNode (see page 12) (SpeosNode)
+---OPTSpeosNodeSource (see page 15) (SpeosNodeSource)
+---OPTSourceLuminaire
Description
With the OPTSourceLuminaire Interface, you can manage luminary sources. It is part of CATIA V5
OPTSourceInterfaces Object Library.
Property Index
Application (see page 20)
IntensityFile (see page 20)
Name (see page 21)
Origin (see page 22)
Parent (see page 23)
RayNumber (see page 23)
SpectrumBlackBody (see page 24)
SpectrumFile (see page 25)
SpectrumType (see page 25)
XDirection (see page 26)
XReverse (see page 27)
YDirection (see page 28)
YReverse (see page 29)
Method Index
GetItem (see page 17)
Update (see page 19)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminaire1 As OPTSourceLuminaire
Set documents1 = CATIA.Documents
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
APIs Page 11 of 32
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminaire1 = speosNodeSource1.AddNewLuminaireSource()
OPTSpeosCAAProduct Interface
AnyObject
+---OPTSpeosCAAProduct (SpeosCAAProduct)
Description
With the OPTSpeosCAAProduct Interface, you can manage the SPEOS CAA V5 Based node. It is part of CATIA V5
OPTSpeosInterfaces Object Library.
Property Index
Application (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
SpeosCAA (see page 19)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNodeRoot1 = speosCAAProduct1.SpeosCAA
OPTSpeosFeature Interface
AnyObject
+---OPTSpeosFeature (SpeosFeature)
Description
The OPTSpeosFeature Interface is part of CATIA V5 OPTSpeosInterfaces Object Library.
Property Index
Application (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Update (see page 19)
Page 12 of 32 SPEOS CAA V5 Based Automation User Guide
OPTSpeosNode Interface
Collection
+---OPTSpeosNode (SpeosNode)
Description
The OPTSpeosNode Interface is part of CATIA V5 OPTSpeosInterfaces Object Library.
Property Index
Application (see page 20)
Count (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Item (see page 18)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode As OPTSpeosNode
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
OPTSpeosNodeMeasure Interface
OPTSpeosNode (see page 12) (SpeosNode)
+---OPTSpeosNodeMeasure (SpeosNodeMeasure)
Description
With the OPTSpeosNodeMeasure Interface, you can manage the measure node. It is part of CATIA V5
OPTSpeosInterfaces Object Library.
Property Index
Application (see page 20)
Count (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Item (see page 18)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim speosCAAProduct1 As OPTSpeosCAAProduct
APIs Page 13 of 32
Dim speosNode1 As OPTSpeosNode
Dim speosNodeMeasure1 As OPTSpeosNodeMeasure
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeMeasure1 = speosNode1.Item("Measures")
OPTSpeosNodeOpticalProperties Interface
OPTSpeosNode (see page 12) (SpeosNode)
+---OPTSpeosNodeOpticalProperties (SpeosNodeOpticalProperties)
Description
WIth the OPTSpeosNodeOpticalProperties Interface, you can manage the optical properties node. It is part of CATIA
V5 OPTSpeosInterfaces Object Library.
Property Index
Application (see page 20)
Count (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Item (see page 18)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeOpticalProperties1 As OPTSpeosNodeOpticalProperties
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeOpticalProperties1 = speosNode1.Item("Optical Properties")
OPTSpeosNodeRoot Interface
OPTSpeosNode (see page 12) (SpeosNode)
+---OPTSpeosNodeRoot (SpeosNodeRoot)
Description
The OPTSpeosNodeRoot Interface is part of CATIA V5 OPTSpeosInterfaces Object Library.
Property Index
Application (see page 20)
Page 14 of 32 SPEOS CAA V5 Based Automation User Guide
Count (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Item (see page 18)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNodeRoot1 = speosCAAProduct1.SpeosCAA
OPTSpeosNodeSensor Interface
OPTSpeosNode (see page 12) (SpeosNode)
+---OPTSpeosNodeSensor (SpeosNodeSensor)
Description
WIth the OPTSpeosNodeSensor Interface, you can manage the Sensor node. It is part of CATIA V5
OPTSpeosInterfaces Object Library.
Property Index
Application (see page 20)
Count (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Item (see page 18)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSensor1 As OPTSpeosNodeSensor
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSensor1 = speosNode1.Item("Sensors")
APIs Page 15 of 32
OPTSpeosNodeSimulation Interface
OPTSpeosNode (see page 12) (SpeosNode)
+---OPTSpeosNodeSimulation (SpeosNodeSimulation)
Description
With the OPTSpeosNodeSimulation Interface, you can manage the simulation node. It is part of CATIA V5
OPTSpeosInterfaces Object Library.
Property Index
Application (see page 20)
Count (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Item (see page 18)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTSpeosNodeSimulation
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
OPTSpeosNodeSource Interface
OPTSpeosNode (see page 12) (SpeosNode)
+---OPTSpeosNodeSource (SpeosNodeSource)
Description
With the OPTSpeosNodeSource Interface, you can manage the source node. It is part of CATIA V5
OPTSourceInterfaces Object Library.
Property Index
Application (see page 20)
Count (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
AddNewLuminaireSource (see page 16)
GetItem (see page 17)
Item (see page 18)
Page 16 of 32 SPEOS CAA V5 Based Automation User Guide
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSource1 As OPTSpeosNodeSource
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSource1 = speosNode1.Item("Sources")
OPTSpeosNodeWindshield Interface
OPTSpeosNode (see page 12) (SpeosNode)
+---OPTSpeosNodeWindshield (SpeosNodeWindshield)
Description
With the OPTSpeosNodeWindshield Interface, you can manage the windshield node. It is part of CATIA V5
OPTSpeosInterfaces Object Library.
Property Index
Application (see page 20)
Count (see page 20)
Name (see page 21)
Parent (see page 23)
Method Index
GetItem (see page 17)
Item (see page 18)
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeWindshield1 As OPTSpeosNodeWindshield
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeWindshield1 = speosNode1.Item("Windshield Analysis")
Methods
AddNewLuminary
Description
It adds a new luminaire type source to the Speos source node.
APIs Page 17 of 32
Syntax
Method AddNewLuminaireSource( ) As OPTSourceLuminaire
Example
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminaire1 As OPTSourceLuminaire
Set documents1 = CATIA.Documents
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminaire1 = speosNodeSource1.AddNewLuminaireSource()
Export
Description
It exports the object.
Syntax
Function Export(ibstrDirectoryName As String) As Boolean
ibstrDirectoryName: directory name including complete path
Returned value: True if succeeded
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTspeosNodeSimulation
Dim simuDirect1 As OPTSimuDirect
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simuDirect1 = speosNodeSimulation1.Item("Direct simulation.1")
simuDirect1.Export("C:\MySimulationFolder\MyExportedSimulation")
GetItem
Description
It returns an object from its name. Role: To retrieve an object when only its name is available.
Syntax
Func GetItem(CATBSTR IDName) As CATBaseDispatch
IDName: the searched object name
Returned value: the searched object
Isolate
Description
It isolates the object.
Syntax
Function Isolate() As Boolean
Page 18 of 32 SPEOS CAA V5 Based Automation User Guide
Returned value: True if succeeded
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTspeosNodeSimulation
Dim simuDirect1 As OPTSimuDirect
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simuDirect1 = speosNodeSimulation1.Item("Direct simulation.1")
simuDirect1.Isolate
IsolateAndExport
Description
It isolates and exports the object.
Syntax
Function IsolateAndExport() As Boolean
Returned value: True if succeeded
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTspeosNodeSimulation
Dim simuDirect1 As OPTSimuDirect
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simuDirect1 = speosNodeSimulation1.Item("Direct simulation.1")
simuDirect1.IsolateAndExport
Item
Description
it returns an object from its index or its name.
Syntax
Function Item ( iIndex As Variant) As CATBaseDispatch
iIndex: index or name of the object
Returned value: object with the corresponding index or name
NetworkUpdate
Description
It does a network update of the object.
Syntax
Function NetworkUpdate() As Boolean
Returned value: True if succeeded
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
APIs Page 19 of 32
Dim speosNodeSimulation1 As OPTspeosNodeSimulation
Dim simuDirect1 As OPTSimuDirect
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simuDirect1 = speosNodeSimulation1.Item("Direct simulation.1")
simuDirect1.NetworkUpdate
SpeosCAA
Description
It returns a SpeosNode Interface object on the root SPEOS CAA V5 Based node.
Syntax
Function SpeosCAA() As SpeosNode
Returned value: SpeosNode Interface object on the root SPEOS CAA V5 Based node
Example
Dim speosCAAProduct1 As SpeosCAAProduct
Dim speosNode1 As SpeosNode
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Update
Description
It updates the object.
Syntax
Function Update() As Boolean
Returned value: 0 if succeeded
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTspeosNodeSimulation
Dim simuDirect1 As OPTSimuDirect
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simuDirect1 = speosNodeSimulation1.Item("Direct simulation.1")
simuDirect1.Update
SetNotUpToDate
Description
It updates a simulation with an invalidated status and returns 0 if it succeeds.
Syntax
Function SetNotUpToDate() As Boolean
Returned value: 0 if succeeded
Example
Dim speosCAAProduct1 As OPTSpeosCAAProduct
Dim speosNode1 As OPTSpeosNode
Dim speosNodeSimulation1 As OPTspeosNodeSimulation
Page 20 of 32 SPEOS CAA V5 Based Automation User Guide
Dim simuDirect1 As OPTSimuDirect
Set speosCAAProduct1 = product1.GetItem("OPTVBExtension")
Set speosNode1 = speosCAAProduct1.SpeosCAA
Set speosNodeSimulation1 = speosNode1.Item("Simulations")
Set simuDirect1 = speosNodeSimulation1.Item("Direct simulation.1")
simuDirect1.SetNotUpToDate
simuDirect1.Update
Properties
Application
Description
It returns the application. The application is the root object of the object structure and can be retrieved from any
object in this object structure using the Application property. The root object, also called top-level object, is the
object located at the top of the application's object structure. It is used by clients to retrieve and navigate across all
the application's subordinate objects. If the client runs in-process, it retrieves the object at the top of the object
structure. If the client runs out-process, it should call the GetApplication method to retrieve the object at the top of
the object structure, which is the only object accessible from outside. The Application property is thus the way to
jump from any object up to the root of the object structure, allowing then to navigate downwards. For in-process
scripting, the application is always referred to as CATIA. Note that the Application property of the Application object
returns the Application object itself.
Syntax
Property Application( ) As CATIAApplication (Read Only)
Returned value: the application object
Example
This example retrieves in CurrentApplication the application object, root of the object structure, from a given object
of this structure: a document refered to using the MyDoc variable.
Dim CurrentApplication As Application
Set CurrentApplication = MyDoc.Application
Count
Description
It returns the number of objects in the collection. This is handy to scan all the objects in a collection.
Syntax
Property Count( ) As long (Read Only)
Returned value: number of objects in the collection.
Example
This example retrieves in ObjectNumber the number of objects currently gathered in MyCollection.
ObjectNumber = MyCollection.Count
IntensityFile
Description
It sets the intensity file of a luminary source.
Syntax
Property IntensityFile( ) As String
Example
APIs Page 21 of 32
This example creates and defines a luminary source.
Sub CATMain()
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
SourceLuminary1.Update
End Sub
Name
Description
It returns or sets the name of the object. The name is a character string automatically assigned to any object to
handle it easier. Even if the Name property allows you to reassign an object name, this is not advised. Many objects,
such as the application and the collections, have names that you must not change, and it's safer to use Name as a
read only property. When an object is part of a collection, the object name can often be used in place of the object
rank to retrieve or remove the object, providing the Item and Remove methods of the collection feature an
argument with the Variant type. A name must start with a letter. It can include numbers, but it can't include spaces.
If the object has no name set, the default name returned is the object type. For example, the Name property of a
Viewer3D object with no name set returns Viewer3D.
Syntax
Property Name( ) As CATBSTR
Returned value: object name
Page 22 of 32 SPEOS CAA V5 Based Automation User Guide
Example
This example retrieves in MyObjectName the name of the MyObject object.
MyObjectName = MyObject.Name
Origin
Description
It sets the origin of a luminary source.
Syntax
Property Origin( ) As Reference
Example
This example creates and defines a luminary source.
Sub CATMain()
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
SourceLuminary1.Update
End Sub
APIs Page 23 of 32
Parent
Description
It returns the parent object. The parent object of a given object is the object just above in the object structure,
usually the object that created this object and that aggregates it. In the case of an object part of a collection, the
parent object is not the collection object itself, but the object that aggregates the collection object. The Parent
property is the way to step upwards in the object structure. Note that the Parent property of the Application object
returns the Application object itself.
Syntax
Property Parent( ) As CATBaseDispatch (Read Only)
Returned value: parent object
Example
This example retrieves in ParentObject the parent object of the GivenObject object.
Dim ParentObject As AnyObject
Set ParentObject = GivenObject.Parent
RayNumber
Description
It sets the number of rays of a luminary source.
Syntax
Property RayNumber( ) As Long
Example
This example creates and defines a luminary source.
Sub CATMain()
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
Page 24 of 32 SPEOS CAA V5 Based Automation User Guide
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
SourceLuminary1.Update
End Sub
SpectrumBlackBody
Description
It sets the temperature of a blackbody type spectrum of a luminary source.
Syntax
Property SpectrumBlackbody( ) As Double
Example
This example creates and defines a luminary source.
Sub CATMain()
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
APIs Page 25 of 32
SourceLuminary1.Update
End Sub
SpectrumFile
Description
It sets the spectrum file of library type spectrum of a luminary source.
Syntax
Property SpectrumFile( ) As String
Example
This example creates and defines a luminary source.
Sub CATMain()
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
SourceLuminary1.Update
End Sub
SpectrumType
Description
It sets the type of spectrum of a luminary source.
Page 26 of 32 SPEOS CAA V5 Based Automation User Guide
Syntax
Property SpectrumType( ) As OPTSourceSpectrumType2
See also: OPTSourceSpectrumType2
Example
This example creates and defines a luminary source.
Sub CATMain()
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
SourceLuminary1.Update
End Sub
XDirection
Description
It sets the X direction of a luminary source.
Syntax
Property XDirection( ) As Reference
Example
This example creates and defines a luminary source.
Sub CATMain()
APIs Page 27 of 32
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
SourceLuminary1.Update
End Sub
XReverse
Description
It sets the X orientation of a luminary source in the reverse direction.
Syntax
Property XReverse( ) As Boolean
Example
This example creates and defines a luminary source.
Sub CATMain()
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Page 28 of 32 SPEOS CAA V5 Based Automation User Guide
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
SourceLuminary1.Update
End Sub
YDirection
Description
It sets the Y direction of a luminary source.
Syntax
Property YDirection( ) As Reference
Example
This example creates and defines a luminary source.
Sub CATMain()
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
APIs Page 29 of 32
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
SourceLuminary1.Update
End Sub
YReverse
Description
It sets the Y orientation of a luminary source in the reverse direction.
Syntax
Property YReverse( ) As Boolean
Example
This example creates and defines a luminary source.
Sub CATMain()
Dim productDocument1 As ProductDocument
Dim product1 As Product
Dim documents1 As Documents
Dim partDocument1 As PartDocument
Dim part1 As Part
Dim Point1 As HybridShapePointCoord
Dim Line1 As HybridShapeLinePtPt
Dim Line2 As HybridShapeLinePtPt
Dim speosNodeRoot1 As OPTSpeosNodeRoot
Dim speosNodeSource1 As OPTSpeosNodeSource
Dim SourceLuminary1 As OPTSourceLuminary
Set documents1 = CATIA.Documents
Set partDocument1 = documents1.Item("source.CATPart")
Set part1 = partDocument1.Part
Set productDocument1 = CATIA.ActiveDocument
Set product1 = productDocument1.Product
Set Point1 = part1.FindObjectByName("Point.1")
Set Line1 = part1.FindObjectByName("Line.1")
Page 30 of 32 SPEOS CAA V5 Based Automation User Guide
Set Line2 = part1.FindObjectByName("Line.2")
Set speosNodeRoot1 = product1.GetItem("OPTVBExtension").speosCaa()
Set speosNodeSource1 = speosNodeRoot1.Item("Sources")
Set SourceLuminary1 = speosNodeSource1.AddNewLuminaireSource()
SourceLuminary1.Name = "MyNewSource"
SourceLuminary1.IntensityFile = "C:\MyIES.ies"
SourceLuminary1.RayNumber = 1000
SourceLuminary1.SpectrumType = optBlackbody
SourceLuminary1.SpectrumBlackBody = 6000
SourceLuminary1.Origin = Point1
SourceLuminary1.XDirection = Line1
SourceLuminary1.YDirection = Line2
SourceLuminary1.Update
End Sub
SPEOS Core
Using SPEOS Core Automation
General Description
With automation in SPEOS Core, you can launch simulations (.sv5 files), get the results and load them.
All examples are given using VB Script language but any other language compatible with Automation can be used.
Using SPEOS Automation APIs
How to Call SPEOS
Before any call to the SPEOS Core methods, you should use the following instruction:
Dim SPEOSCAA As Object
Set SPEOSCAA = CreateObject("SV5.document")
This instruction automatically runs SPEOS Core (creates an instance of the application).
The other uses of SPEOS Core should refer to the variable SPEOSCAA which has been initialized with this instance.
You could notice that there is no reference to the path where SPEOS Core is on the disk.
As it is an automation application, it has been registered in the Windows registry and Windows understands which
application you want to instantiate just with SV5.document.
How to Call a Method
Calling a method is very simple: just write SPEOSCAA followed by a . then by the name of the method and
parameters between "(" and ")", each separated by ",".
For example for running an irradiance simulation just write the following instructions:
Dim MyVar
MyVar = SPEOSCAA.RunSimulation(0, commandline)
The RunSimulation method takes two parameters: the first one is the simulation index (here, 0) and the second is a
command line. The variable MyVar holds the result of the method (success or failure in this case).
All the available methods match something existing in the graphic user interface of SPEOS Core.
Syntax Description
All the available methods are described below using the following syntax: [number] return_type
Method_Name(parameter 1, parameter 2,...) ; with:
[number]: Ordinal number of the method (not to be used in most cases).
return_type: type of the return value (BOOL for Boolean value, short for integer value, double for floating point
value, BSTR for string...).
APIs Page 31 of 32
Method_Name: name of the method.
Parameter n: A keyword for the type of the parameter followed by the parameter name.
Methods
OpenFile (see page 31)
RunSimulation (see page 32)
ShowWindow (see page 32)
Methods
OpenFile
Description
It opens a .sv5 file and returns 0 if succeeded.
Syntax
object.OpenFile(bstrFileName As String, bstrCommandLine As String) As Integer
object: SV5.Document object
bstrFileName: .sv5 filename, including the path
bstrCommandLine: command line
Returned value: 0 if no error.
Example
Dim SpeosCAA As Object
Page 32 of 32 SPEOS CAA V5 Based Automation User Guide
Set SpeosCAA = CreateObject("sv5.document")
Filename = "C:\MyPath\test.sv5"
commandline = ""
retval = SpeosCAA.OpenFile(Filename, commandline)
RunSimulation
Description
It runs a simulation and returns 0 if succeeded.
Syntax
object.RunSimulation(nSimulationIndex As Integer, bstrCommandLine As String) As Integer
object: SV5.Document object
nSimulationIndex: Simulation index, 0 by default
bstrCommandLine: command line
Returned value: 0 if no error.
Example
Dim SpeosCAA As Object
Set SpeosCAA = CreateObject("sv5.document")
Filename = "C:\MyPath\test.sv5"
commandline = ""
retval = SpeosCAA.OpenFile(Filename, commandline)
retval = SpeosCAA.RunSimulation(0, commandline)
ShowWindow
Description
It displays the SPEOS Core window.
Syntax
object.ShowWindow(nShowWindow As Integer) As Integer
object: SV5.Document object
nShowWindow : 1 to show the window, 0 to hide it
Returned value: 0 if no error.
Example
Dim SpeosCAA As Object
Set SpeosCAA = CreateObject("sv5.document")
retval = SpeosCAA.ShowWindow(1)