AnalysisWorkbenchComponentProvider#
- class ansys.stk.core.analysis_workbench.AnalysisWorkbenchComponentProvider#
Allow accessing existing Vector Geometry Tool components.
Overview#
Test whether the specified VGT feature is supported. |
|
Import Analysis Workbench components from a file. |
Return a group of vectors. |
|
Return a group of points. |
|
Return a group of angles. |
|
Return a group of axes. |
|
Return a group of planes. |
|
Return a group of systems. |
|
Return well-known systems. |
|
Return well-known axes. |
|
Return a group of events. |
|
Return a group of event intervals. |
|
Return a group of calc scalars. |
|
Return a group of event arrays. |
|
Return a group of event interval lists. |
|
Return a group of event interval collections. |
|
Access, add new or remove existing parameter set components. |
|
Return a group of condition objects. |
|
Return a group of condition set objects. |
|
Return a group of volume grid objects. |
|
Return a group of volume objects. |
|
Return a group of volume calc objects. |
Examples#
Create a new Collection of Interval List
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# IVectorGeometryPoint centerPtSat: point component
timeCollListFactory = vgtSat.time_interval_collections.factory
timeColl = timeCollListFactory.create_lighting("LightingList", "Collection of lighting intervals")
timeColl.use_object_eclipsing_bodies = True
timeColl.location = centerPtSat
Create a new Time Interval
# STKObjectRoot root: STK Object Model Root
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# Change DateFormat dimension to epoch seconds to make the time easier to handle in
# Python
root.units_preferences.item("DateFormat").set_current_unit("EpSec")
timeIntFactory = vgtSat.time_intervals.factory
timeInterval = timeIntFactory.create_fixed("TimeInterval", "Fixed time interval")
timeInterval.set_interval(60, 120)
Create a new Time Instant
# STKObjectRoot root: STK Object Model Root
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# Change DateFormat dimension to epoch seconds to make the time easier to handle in
# Python
root.units_preferences.item("DateFormat").set_current_unit("EpSec")
timeInstFactory = vgtSat.time_instants.factory
timeEpoch = timeInstFactory.create_epoch("FixedTime", "Fixed Epoch Time")
timeEpoch.epoch = 3600
Get Times From a Defined Time Instant and create an cell array
# STKObjectRoot root: STK Object Model Root
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# Change DateFormat dimension to epoch seconds to make the time easier to handle in
# Python
root.units_preferences.item("DateFormat").set_current_unit("EpSec")
satStart = vgtSat.time_instants.item("AvailabilityStartTime")
start = satStart.find_occurrence().epoch
satStop = vgtSat.time_instants.item("AvailabilityStopTime")
stop = satStop.find_occurrence().epoch
interval = [[start], [540], [600], [stop]] # EpSec
Create a new Orbit Parameter Set
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
paraFactory = vgtSat.parameter_sets.factory
paraSetOribit = paraFactory.create("orbitSun", "Orbit", ParameterSetType.ORBIT)
paraSetOribit.orbiting_point = vgtSat.points.item("Center")
paraSetOribit.central_body = "Sun"
paraSetOribit.use_central_body_gravitational_parameter = False
paraSetOribit.gravitational_parameter = 398600 # km^3/sec^2
Create a new Attitude Parameter Set
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# IVectorGeometryToolAxes bodyAxes: axes component
# IVectorGeometryToolAxes icrfAxes: axes component
paraFactory = vgtSat.parameter_sets.factory
paraSet = paraFactory.create("attitudeICRF", "Attitude Set", ParameterSetType.ATTITUDE)
paraSet.axes = bodyAxes
paraSet.reference_axes = icrfAxes
Get a Scalar component and evaluate at a specific time
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# Scenario scenario: Scenario object
deticLatitude = vgtSat.calculation_scalars.item("GroundTrajectory.Detic.LLA.Latitude")
result = deticLatitude.evaluate(scenario.start_time)
print("The value of detic latitude is %s" % result.value)
Create a Data Element Scalar
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
calcFactory = vgtSat.calculation_scalars.factory
trueAnom = calcFactory.create("TrueAnomaly", "", CalculationScalarType.DATA_ELEMENT)
trueAnom.set_with_group("Classical Elements", "ICRF", "True Anomaly")
Create a new Vector Magnitude Scalar
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# VectorGeometryToolVectorDisplacement Sat2EarthCenter: vector component
calcFactory = vgtSat.calculation_scalars.factory
vectorMagnitudeSettings = ["VectorDisplacement", "Vector Magnitude of Displacement Vector"]
displScalar = calcFactory.create_vector_magnitude(*vectorMagnitudeSettings)
displScalar.input_vector = Sat2EarthCenter
Create a new Assembled System
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# IVectorGeometryPointFixedInSystem fixedPt: point component
# IVectorGeometryToolAxes bodyAxes: axes component
SysFactory = vgtSat.systems.factory
assemSys = SysFactory.create("FixedPtSystem", "System with origin at the new point", SystemType.ASSEMBLED)
assemSys.origin_point.set_point(fixedPt)
assemSys.reference_axes.set_axes(bodyAxes)
Create new Aligned and Constrained Axes
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# VectorGeometryToolVectorDisplacement Sat2EarthCenter: vector component
# VectorGeometryToolVectorFixedInAxes bodyYSat: vector component
AxesFactory = vgtSat.axes.factory
AlignConstain = AxesFactory.create(
"AlignConstrain",
"Aligned to displacement vector and constrained to Body Y",
AxesType.ALIGNED_AND_CONSTRAINED,
)
AlignConstain.alignment_reference_vector.set_vector(Sat2EarthCenter)
AlignConstain.alignment_direction.assign_xyz(1, 0, 0)
AlignConstain.constraint_reference_vector.set_vector(bodyYSat)
AlignConstain.constraint_direction.assign_xyz(0, 0, 1)
Create a new Between Vectors Angle
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# VectorGeometryToolVectorDisplacement Sat2EarthCenter: vector component
# VectorGeometryToolVectorFixedInAxes bodyYSat: vector component
AngFactory = vgtSat.angles.factory
betwVect = AngFactory.create("SatEarth2Y", "Displacement Vector to Sat Body Y", AngleType.BETWEEN_VECTORS)
betwVect.from_vector.set_vector(Sat2EarthCenter)
betwVect.to_vector.set_vector(bodyYSat)
Create a new Fixed at Time Instant Point
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# VectorGeometryToolSystemAssembled icrf: system component
PtFactory = vgtSat.points.factory
timeInstantPt = PtFactory.create("AtTimePt", "Point at time instant", PointType.AT_TIME_INSTANT)
timeInstantPt.source_point = vgtSat.points.item("Center")
timeInstantPt.reference_system = icrf
timeInstantPt.reference_time_instant = vgtSat.time_instants.item("AvailabilityStartTime")
Create a new Model Attachment Point
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
PtFactory = vgtSat.points.factory
modelPt = PtFactory.create("ModelPt", "Attach point defined in model", PointType.MODEL_ATTACHMENT)
modelPt.pointable_element_name = "MainSensor-000000"
Create a new Fixed in System Point
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
PtFactory = vgtSat.points.factory
fixedPt = PtFactory.create("FixedPt", "Point offset from Center", PointType.FIXED_IN_SYSTEM)
fixedPt.fixed_point.assign_cartesian(0.005, 0, 0.005)
Create a new Projection Vector
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# VectorGeometryToolVectorDisplacement Sat2EarthCenter: vector component
VectFactory = vgtSat.vectors.factory
projectionVector = VectFactory.create("Projection", "", VectorType.PROJECTION)
projectionVector.source.set_vector(Sat2EarthCenter)
horizontalPlane = vgtSat.planes.item("LocalHorizontal")
projectionVector.reference_plane.set_plane(horizontalPlane)
Create a new Custom Script Vector
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
VectFactory = vgtSat.vectors.factory
customScript = VectFactory.create("Script", "Description", VectorType.CUSTOM_SCRIPT)
# Initialization script if needed
# customScript.InitializationScriptFile = ''
trainingSamplesDir = r"C:\Program Files\AGI\STK 12\Data\Resources\stktraining\samples"
scriptFilePath = r"\Heliograph\Scripting\VectorTool\Vector\vector.vbs"
customScript.script_file = trainingSamplesDir + scriptFilePath
if customScript.is_valid is False:
print("Script component not valid!")
from os import getenv
customScriptingDir = r"C:\Users\%s\Documents\STK 12\Config\Scripting\VectorTool" % getenv("USERNAME")
print(r"Copy vbs file from " + trainingSamplesDir + scriptFilePath + r" to " + customScriptingDir)
Create a new Cross Product Vector
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# VectorGeometryToolVectorDisplacement Sat2EarthCenter: vector component
# VectorGeometryToolVectorDisplacement fixedAxesVector: vector component
VectFactory = vgtSat.vectors.factory
lineOfNodesVector = VectFactory.create_cross_product("CrossProduct", Sat2EarthCenter, fixedAxesVector)
Create a new Fixed in Axes Vector
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# IVectorGeometryToolAxes bodyAxes: axes component
VectFactory = vgtSat.vectors.factory
fixedAxesVector = VectFactory.create("FixedInAxes", "", VectorType.FIXED_IN_AXES)
fixedAxesVector.reference_axes.set_axes(bodyAxes)
fixedAxesVector.direction.assign_xyz(0, 0, 1)
Create a new Displacement Vector
# AnalysisWorkbenchComponentProvider vgtSat: Vector Geometry Tool Interface
# IVectorGeometryPoint centerPtSat: point component
# IVectorGeometryPoint centerPtEarth: point component
VectFactory = vgtSat.vectors.factory
Sat2EarthCenter = VectFactory.create_displacement_vector("Sat2EarthCenter", centerPtSat, centerPtEarth)
Get a default VGT component on vehicle
# Satellite satellite: Satellite object
vgtSat = satellite.analysis_workbench_components
# Get handle to the Center point on the satellite
centerPtSat = vgtSat.points.item("Center")
# Get handle to the Body Y Vector
bodyYSat = vgtSat.vectors.item("Body.Y")
# Get handle to the Body Axes
bodyAxes = vgtSat.axes.item("Body")
icrfAxes = vgtSat.axes.item("ICRF")
Get the Center point and Inertial System of Earth central body
# STKObjectRoot root: STK Object Model root
centerPtEarth = root.central_bodies.earth.analysis_workbench_components.points.item("Center")
icrf = root.central_bodies.earth.analysis_workbench_components.systems.item("ICRF")
Import detail#
from ansys.stk.core.analysis_workbench import AnalysisWorkbenchComponentProvider
Property detail#
- property AnalysisWorkbenchComponentProvider.vectors: VectorGeometryToolVectorGroup#
Return a group of vectors.
- property AnalysisWorkbenchComponentProvider.points: VectorGeometryToolPointGroup#
Return a group of points.
- property AnalysisWorkbenchComponentProvider.angles: VectorGeometryToolAngleGroup#
Return a group of angles.
- property AnalysisWorkbenchComponentProvider.axes: VectorGeometryToolAxesGroup#
Return a group of axes.
- property AnalysisWorkbenchComponentProvider.planes: VectorGeometryToolPlaneGroup#
Return a group of planes.
- property AnalysisWorkbenchComponentProvider.systems: VectorGeometryToolSystemGroup#
Return a group of systems.
- property AnalysisWorkbenchComponentProvider.well_known_systems: VectorGeometryToolWellKnownSystems#
Return well-known systems.
- property AnalysisWorkbenchComponentProvider.well_known_axes: VectorGeometryToolWellKnownAxes#
Return well-known axes.
- property AnalysisWorkbenchComponentProvider.time_instants: TimeToolInstantGroup#
Return a group of events.
- property AnalysisWorkbenchComponentProvider.time_intervals: TimeToolTimeIntervalGroup#
Return a group of event intervals.
- property AnalysisWorkbenchComponentProvider.calculation_scalars: CalculationToolScalarGroup#
Return a group of calc scalars.
- property AnalysisWorkbenchComponentProvider.time_arrays: TimeToolTimeArrayGroup#
Return a group of event arrays.
- property AnalysisWorkbenchComponentProvider.time_interval_lists: TimeToolTimeIntervalListGroup#
Return a group of event interval lists.
- property AnalysisWorkbenchComponentProvider.time_interval_collections: TimeToolTimeIntervalCollectionGroup#
Return a group of event interval collections.
- property AnalysisWorkbenchComponentProvider.parameter_sets: CalculationToolParameterSetGroup#
Access, add new or remove existing parameter set components.
- property AnalysisWorkbenchComponentProvider.conditions: CalculationToolConditionGroup#
Return a group of condition objects.
- property AnalysisWorkbenchComponentProvider.condition_sets: CalculationToolConditionSetGroup#
Return a group of condition set objects.
- property AnalysisWorkbenchComponentProvider.volume_grids: SpatialAnalysisToolVolumeGridGroup#
Return a group of volume grid objects.
- property AnalysisWorkbenchComponentProvider.volumes: SpatialAnalysisToolConditionGroup#
Return a group of volume objects.
- property AnalysisWorkbenchComponentProvider.spatial_calculations: SpatialAnalysisToolCalculationGroup#
Return a group of volume calc objects.
Method detail#
- AnalysisWorkbenchComponentProvider.supports(self, feature: VectorGeometryToolComponentType) bool #
Test whether the specified VGT feature is supported.
- Parameters:
feature :
VectorGeometryToolComponentType
- Returns:
- AnalysisWorkbenchComponentProvider.import_components(self, filename: str) AnalysisWorkbenchComponentCollection #
Import Analysis Workbench components from a file.
- Parameters:
filename :
str
- Returns:
AnalysisWorkbenchComponentCollection