//pulls data providers for the aircraft in ICRF frame public static List <Array> GetAttitudeData(IAgStkObject obj, double startTime, double timeStep) { List <Array> attitudeData = new List <Array>(); IAgScenario scenario = CommonData.StkRoot.CurrentScenario as IAgScenario; IAgDrDataSetCollection datasets = null; if (CommonData.objectClass == "Aircraft") { IAgDataProviderGroup attitudeDP1 = obj.DataProviders["Body Axes Orientation:YPR 321"] as IAgDataProviderGroup; IAgDataPrvTimeVar attitudeDP2 = attitudeDP1.Group["ICRF"] as IAgDataPrvTimeVar; IAgDrResult result = attitudeDP2.Exec(startTime, scenario.StopTime, timeStep); datasets = result.DataSets; } else if (CommonData.objectClass == "Satellite") { IAgDataProviderGroup attitudeDP1 = obj.DataProviders["Attitude YPR"] as IAgDataProviderGroup; IAgDataPrvTimeVar attitudeDP2 = attitudeDP1.Group["Seq YPR"] as IAgDataPrvTimeVar; IAgDrResult result = attitudeDP2.Exec(startTime, scenario.StopTime, timeStep); datasets = result.DataSets; } for (int i = 0; i < datasets.Count; i++) { attitudeData.Add(datasets[i].GetValues()); } return(attitudeData); }
private void PopulatePossibleArtics() { string objectPath = CommonData.objectClass + "/" + CommonData.simpleName; IAgStkObject obj = CommonData.StkRoot.GetObjectFromPath(objectPath); Array names = ArticFunctions.GetArticulations(obj); foreach (var item in names) { if (item.ToString().Contains("Time")) { } else { PossibleArtics.Items.Add(item); } } if (CommonData.selectedArtic != -1) { try { int index = PossibleArtics.FindString(CommonData.sectionList[CommonData.selectedArtic].objectName + "-" + CommonData.sectionList[CommonData.selectedArtic].articName); PossibleArtics.SelectedIndex = index; } catch (Exception) { } } }
private void ProxGeometry_CheckedChanged(object sender, EventArgs e) { IAgSatellite sat = CommonData.StkRoot.GetObjectFromPath("Satellite/" + CommonData.TargetName) as IAgSatellite; IAgStkObject satObj = sat as IAgStkObject; if (ProxGeometry.Checked) { if (CommonData.RunList[0].IsSpherical) { sat.VO.Proximity.Ellipsoid.IsVisible = true; IAgCrdnAxes axes = satObj.Vgt.Axes["RIC"]; sat.VO.Proximity.Ellipsoid.ReferenceFrame = axes; sat.VO.Proximity.Ellipsoid.XSemiAxisLength = CommonData.RunList[0].UserMinRange; sat.VO.Proximity.Ellipsoid.YSemiAxisLength = CommonData.RunList[0].UserMinRange; sat.VO.Proximity.Ellipsoid.ZSemiAxisLength = CommonData.RunList[0].UserMinRange; } else { sat.VO.Proximity.ControlBox.IsVisible = true; IAgCrdnAxes axes = satObj.Vgt.Axes["RIC"]; sat.VO.Proximity.ControlBox.ReferenceFrame = axes; sat.VO.Proximity.ControlBox.XAxisLength = CommonData.RunList[0].UserMinR; sat.VO.Proximity.ControlBox.YAxisLength = CommonData.RunList[0].UserMinI; sat.VO.Proximity.ControlBox.ZAxisLength = CommonData.RunList[0].UserMinC; } } else { sat.VO.Proximity.Ellipsoid.IsVisible = false; sat.VO.Proximity.ControlBox.IsVisible = false; } }
public static IAgCrdnVector GetVectorBetweenObjects(IAgStkObject parentObject, IAgStkObject fromObject, IAgStkObject toObject, string vectorName = "", bool addDisplay = false) { IAgCrdnVectorFactory vectorFactory = parentObject.Vgt.Vectors.Factory; string newVectorName; if (String.IsNullOrEmpty(vectorName)) { newVectorName = "To_" + toObject.InstanceName; } else { newVectorName = vectorName; } IAgCrdnVectorDisplacement displacementVector; if (fromObject.Vgt.Vectors.Contains(newVectorName)) { displacementVector = fromObject.Vgt.Vectors[newVectorName] as IAgCrdnVectorDisplacement; } else { displacementVector = vectorFactory.CreateDisplacementVector(newVectorName, fromObject.Vgt.Points["Center"], toObject.Vgt.Points["Center"]); } if (addDisplay) { StkAssistant.DisplayVector((displacementVector as IAgCrdn).Name, parentObject, System.Drawing.Color.Yellow); } return(displacementVector as IAgCrdnVector); }
public List <string> GetAvailableDataProviders(string stkObjectPath) { List <string> dataProviders = new List <string>(); if (stkObjectPath.StartsWith("Access: ")) { string[] objects = stkObjectPath.Substring(8).Split(','); IAgStkObject stkObject1 = root.GetObjectFromPath((string)objects.GetValue(0)); IAgStkAccess access = stkObject1.GetAccess((string)objects.GetValue(1)); for (int i = 0; i < access.DataProviders.Count; ++i) { dataProviders.Add(access.DataProviders[i].Name); } } else { IAgStkObject stkObject = root.GetObjectFromPath(stkObjectPath); for (int i = 0; i < stkObject.DataProviders.Count; ++i) { dataProviders.Add(stkObject.DataProviders[i].Name); } } return(dataProviders); }
public void OnDisplayMenu(string MenuTitle, AgEUiPluginMenuBarKind MenuBarKind, IAgUiPluginMenuBuilder2 MenuBuilder) { string enabled = "Enable"; //Insert a Menu Item if (m_updater != null) { enabled = "Disable"; } if (MenuTitle.Contains("Scenario")) { MenuBuilder.InsertMenuItem(1, "Enable Model Size Update", enabled + " Model Size Update", enabled + " Model Size Update", null); } if (MenuBarKind == AgEUiPluginMenuBarKind.eUiPluginMenuBarContextMenu) { //the STK Object Root AgStkObjectRoot root = (AgStkObjectRoot)m_pSite.Application.Personality2; //the current Selected Object IAgStkObject oSelectedObject = root.GetObjectFromPath(m_pSite.Selection[0].Path); //Only show menu items for the Scenario or Satellite object if (oSelectedObject.ClassName.Equals("Scenario")) { MenuBuilder.InsertMenuItem(5, "Enable Model Size Update", enabled + " Model Size Update", enabled + " Model Size Update", null); } } }
private void RemovePlanes() { List <ObjectData> data = SmartViewFunctions.GetObjectData(); foreach (ObjectData item in data) { if (item.ClassName == "Satellite") { IAgStkObject sat = CommonData.StkRoot.GetObjectFromPath(item.SimplePath); IAgSatellite sat1 = CommonData.StkRoot.GetObjectFromPath(item.SimplePath) as IAgSatellite; try { sat.Vgt.Planes.Remove("ProximityPlane"); } catch (Exception) { } try { sat1.VO.Proximity.GeoBox.IsVisible = false; } catch (Exception) { } try { sat1.VO.Proximity.Ellipsoid.IsVisible = false; } catch (Exception) { } } } }
public static IAgStkObject AttachFacilityRadar(IAgStkObject parent, string radarName, RadarParams rParams) { IAgStkObject sensorObj = CreatorFunctions.GetCreateSensor(parent, radarName); IAgSensor sensor = sensorObj as IAgSensor; sensor.Graphics.IsObjectGraphicsVisible = false; IAgSnSimpleConicPattern pattern = sensor.Pattern as IAgSnSimpleConicPattern; pattern.ConeAngle = Double.Parse(rParams.HalfAngle); IAgSnPtFixed pointing = sensor.Pointing as IAgSnPtFixed; pointing.Orientation.AssignAzEl(Double.Parse(rParams.Az), Double.Parse(rParams.El), AGI.STKUtil.AgEAzElAboutBoresight.eAzElAboutBoresightRotate); IAgAccessConstraintCollection constraints = sensor.AccessConstraints; IAgAccessCnstrMinMax elConstraint; IAgAccessCnstrMinMax azConstraint; IAgAccessCnstrMinMax rangeConstraint; IAgAccessCnstrAngle solarExConstraint; elConstraint = CreatorFunctions.GetElCnst(constraints); CreatorFunctions.SetCnstMinMax(elConstraint, Double.Parse(rParams.MinEl), Double.Parse(rParams.MaxEl)); azConstraint = CreatorFunctions.GetAzCnst(constraints); CreatorFunctions.SetCnstMinMax(azConstraint, Double.Parse(rParams.MinAz), Double.Parse(rParams.MaxAz)); rangeConstraint = CreatorFunctions.GetRangeCnst(constraints); CreatorFunctions.SetCnstMinMax(rangeConstraint, Double.Parse(rParams.MinRange), Double.Parse(rParams.MaxRange)); solarExConstraint = CreatorFunctions.GetSunExCnst(constraints); solarExConstraint.Angle = rParams.SolarExAngle; SetRadarGraphics(sensor); return(sensorObj); }
public SensorViewClass(AgStkObjectRoot root, IAgStkObject selectedSensor) { _root = root; _sensor = (IAgSensor)selectedSensor; _pluginInstallDir = Path.Combine(@CommonData.InstallDir, "Plugin Files\\SensorBoresightPlugin"); }
public SensorViewClass(AgStkObjectRoot root, IAgStkObject selectedSensor) { _root = root; _sensor = (IAgSensor)selectedSensor; _pluginInstallDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); }
private void button_CreateAzimuthDifferenceDataDisplay_Click(object sender, EventArgs e) { // May need to create track comparison event interval first to then use as a time constraint in the data display IAgStkObject aircraftOwnship = CommonData.StkRoot.GetObjectFromPath("Aircraft/F35"); IAgStkObject measuredObject = CommonData.StkRoot.GetObjectFromPath(measuredObjName); if (aircraftOwnship.Vgt.EventIntervals.Contains(String.Format("TC_{0}_ComparisonInterval", trackName))) { return; // do nothing } else { IAgCrdnEventInterval eventInterval = aircraftOwnship.Vgt.EventIntervals.Factory.CreateEventIntervalFromIntervalList(String.Format("TC_{0}_ComparisonInterval", trackName), "Single time interval created from reference interval list."); IAgCrdnEventIntervalFromIntervalList eventIntervalFromList = eventInterval as IAgCrdnEventIntervalFromIntervalList; eventIntervalFromList.ReferenceIntervals = measuredObject.Vgt.EventIntervalLists["AvailabilityIntervals"]; eventIntervalFromList.IntervalSelection = AgECrdnIntervalSelection.eCrdnIntervalSelectionSpan; } try { string cmd = String.Format(@"TE_DataDisplay * Add Name ""Azimuth_Difference_TC_{0}"" AnalysisObject ""F35"" Numeric DataElement ""TC_{0}_AzimuthDifference, Azimuth Distance, deg, On"" Color ""Yellow"" Location ""1, 10, 10"" Digits ""3"" Width ""Auto"" TimeConstraint ""TC_{0}_ComparisonInterval""", trackName); CommonData.StkRoot.ExecuteCommand(cmd); CommandList.cmdList.Add(cmd); } catch (Exception exception) { MessageBox.Show("Error:" + exception); return; } }
public static IAgStkObject AttachFacilityOptical(IAgStkObject parent, string radarName, OpticalParams rParams) { IAgStkObject sensorObj = CreatorFunctions.GetCreateSensor(parent, radarName); IAgSensor sensor = sensorObj as IAgSensor; sensor.Graphics.IsObjectGraphicsVisible = false; IAgSnSimpleConicPattern pattern = sensor.Pattern as IAgSnSimpleConicPattern; pattern.ConeAngle = Double.Parse(rParams.HalfAngle); IAgAccessConstraintCollection constraints = sensor.AccessConstraints; IAgAccessCnstrMinMax elConstraint; IAgAccessCnstrMinMax azConstraint; IAgAccessCnstrMinMax rangeConstraint; IAgAccessCnstrMinMax sunElConstraint; IAgAccessCnstrAngle lunExConstraint; elConstraint = CreatorFunctions.GetElCnst(constraints); CreatorFunctions.SetCnstMinMax(elConstraint, Double.Parse(rParams.MinEl), Double.Parse(rParams.MaxEl)); azConstraint = CreatorFunctions.GetAzCnst(constraints); CreatorFunctions.SetCnstMinMax(azConstraint, Double.Parse(rParams.MinAz), Double.Parse(rParams.MaxAz)); sunElConstraint = CreatorFunctions.GetSunElCnst(constraints); CreatorFunctions.SetCnstMinMax(sunElConstraint, -90, Double.Parse(rParams.SunElAngle)); rangeConstraint = CreatorFunctions.GetRangeCnst(constraints); CreatorFunctions.SetCnstMinMax(rangeConstraint, Double.Parse(rParams.MinRange), Double.Parse(rParams.MaxRange)); lunExConstraint = CreatorFunctions.GetLunExCnst(constraints); lunExConstraint.Angle = rParams.LunarExAngle; SetOpticalGraphics(sensor); return(sensorObj); }
public void OnDisplayMenu(string MenuTitle, AgEUiPluginMenuBarKind MenuBarKind, IAgUiPluginMenuBuilder2 MenuBuilder) { if (MenuTitle.Contains("FigureOfMerit")) { //Insert a Menu Item MenuBuilder.InsertMenuItem(1, "ReportGridStats", "Generate Grid Stats Report", "Generate Grid Stats Report", null); MenuBuilder.InsertMenuItem(1, "UpdateStaticContours", "Auto Update Static Contours", "FOM Graphics Auto Update", null); MenuBuilder.InsertMenuItem(1, "UpdateAnimationContours", "Auto Update Animation Contours", "FOM Graphics Auto Update", null); } if (MenuBarKind == AgEUiPluginMenuBarKind.eUiPluginMenuBarContextMenu) { //the STK Object Root AgStkObjectRoot root = (AgStkObjectRoot)m_pSite.Application.Personality2; //the current Selected Object IAgStkObject oSelectedObject = root.GetObjectFromPath(m_pSite.Selection[0].Path); //Only show menu items for the Scenario or Satellite object if (oSelectedObject.ClassName.Equals("FigureOfMerit")) { MenuBuilder.InsertMenuItem(5, "ReportGridStats", "Report Grid Stats", "Report Grid Stats", null); MenuBuilder.InsertMenuItem(5, "UpdateStaticContours", "Auto Update Static Contours", "FOM Graphics Auto Update", null); MenuBuilder.InsertMenuItem(5, "UpdateAnimationContours", "Auto Update Animation Contours", "FOM Graphics Auto Update", null); } } }
public static List <double> GetFomLimits(string oaName, string time) { List <double> limits = new List <double>(); double maxDouble = -99999; double minDouble = -99999; double stdDev = -99999; try { string name = "CoverageDefinition/" + oaName + "/FigureOfMerit/" + oaName + "_FOM"; IAgStkObject fom = CommonData.StkRoot.GetObjectFromPath(name); IAgDataPrvTimeVar fomDp = fom.DataProviders["Overall Value by Time"] as IAgDataPrvTimeVar; IAgDrResult result = fomDp.ExecSingle(time); Array minLimit = result.DataSets.GetDataSetByName("Minimum").GetValues(); minDouble = Double.Parse(minLimit.GetValue(0).ToString()); Array maxLimit = result.DataSets.GetDataSetByName("Maximum").GetValues(); maxDouble = Double.Parse(maxLimit.GetValue(0).ToString()); Array std = result.DataSets.GetDataSetByName("Standard Deviation").GetValues(); stdDev = Double.Parse(std.GetValue(0).ToString()); } catch (Exception) { } limits.Add(Math.Round(minDouble, 3)); limits.Add(Math.Round(maxDouble, 3)); limits.Add(Math.Round(stdDev, 2)); return(limits); }
public void InitProjnFile(IAgUiPluginEmbeddedControlSite Site) { SetSite(Site); try { IAgStkObject Scenario = m_root.CurrentScenario; IAgExecCmdResult result = m_root.ExecuteCommand("GetDirectory / Scenario"); string m_scenarioPath = string.Empty; if (result.IsSucceeded) { m_scenarioPath = result[0]; } // ADD SCENARIO PATH TO BINDING FILE CLASS projInfoFile = new bindingsFile(m_scenarioPath); } catch { MessageBox.Show("STK Instance does not exist or is lost! \n Make sure STK is open and the scenario is loaded "); //Environment.Exit(0); } try { projInfoFile.readInfofile(); m_root.UnitPreferences.ResetUnits(); WPFLoginLoadSavedInfo(projInfoFile); } catch { } }
public string getPropagator(IAgStkObject object0) { IAgSatellite sat = object0 as IAgSatellite; return(sat.PropagatorType.ToString()); //return ("0"); }
public static IAgVORefCrdnAngle DisplayAngle(string angleName, IAgStkObject stkObject, Color vectorColor) { IAgAircraft _aircraft = stkObject as IAgAircraft; IAgCrdn _angleVGT = stkObject.Vgt.Angles[angleName] as IAgCrdn; IAgVORefCrdnCollection refCrdns = GetRefCrdns(stkObject); //_aircraft.VO.Vector.RefCrdns; List <string> displayVectors = new List <string>(); foreach (IAgVORefCrdn item in refCrdns) { displayVectors.Add(item.Name); } IAgVORefCrdnAngle _angleVO; if (displayVectors.Contains(_angleVGT.QualifiedPath)) { _angleVO = refCrdns.GetCrdnByName( AgEGeometricElemType.eAngleElem, _angleVGT.QualifiedPath) as IAgVORefCrdnAngle; } else { _angleVO = refCrdns.Add( AgEGeometricElemType.eAngleElem, _angleVGT.QualifiedPath) as IAgVORefCrdnAngle; } _angleVO.AngleValueVisible = true; _angleVO.Color = vectorColor; _angleVO.LabelVisible = true; return(_angleVO); }
public List <string> GetAvailableDataProviderElements( string stkObjectPath, string DataProviderName, string GroupName) { IAgStkObject stkObject = root.GetObjectFromPath(stkObjectPath); IAgDataProviderInfo dpInfo = stkObject.DataProviders[DataProviderName]; IAgDataProvider dataProvider = stkObject.DataProviders[DataProviderName] as IAgDataProvider; if (dpInfo.IsGroup()) { IAgDataProviderGroup dpGroup = dpInfo as IAgDataProviderGroup; IAgDataProviders dpAvailable = dpGroup.Group; for (int i = 0; i < dpAvailable.Count; ++i) { if (dpAvailable[i].Name == GroupName) { dataProvider = dpAvailable[i] as IAgDataProvider; break; } } } List <string> dataElements = new List <string>(); for (int i = 0; i < dataProvider.Elements.Count; ++i) { dataElements.Add(dataProvider.Elements[i].Name); } return(dataElements); }
public static List <double> GetFomLimits(string oaName) { List <double> limits = new List <double>(); double maxDouble = -99999; double minDouble = -99999; double stdDev = -99999; try { IAgAnimation animationRoot = (IAgAnimation)CommonData.StkRoot; double currentTime = animationRoot.CurrentTime; string time = CommonData.StkRoot.ConversionUtility.ConvertDate("EpSec", "UTCG", currentTime.ToString()); string name = "CoverageDefinition/" + oaName + "/FigureOfMerit/" + oaName + "_FOM"; IAgStkObject fom = CommonData.StkRoot.GetObjectFromPath(name); IAgDataPrvFixed fomDp = fom.DataProviders["Overall Value"] as IAgDataPrvFixed; IAgDrResult result = fomDp.Exec(); Array minLimit = result.DataSets.GetDataSetByName("Minimum").GetValues(); minDouble = Double.Parse(minLimit.GetValue(0).ToString()); Array maxLimit = result.DataSets.GetDataSetByName("Maximum").GetValues(); maxDouble = Double.Parse(maxLimit.GetValue(0).ToString()); Array std = result.DataSets.GetDataSetByName("Standard Deviation").GetValues(); stdDev = Double.Parse(std.GetValue(0).ToString()); } catch (Exception) { } limits.Add(Math.Round(minDouble, 3)); limits.Add(Math.Round(maxDouble, 3)); limits.Add(Math.Round(stdDev, 2)); return(limits); }
/// <summary> /// This recursive method will populate the TreeView from a root AgStkObject /// </summary> /// <param name="obj">The parent STKObect</param> /// <param name="parent">The parent TreeNode</param> private void PopulateTreeView(IAgStkObject stkObjParent, TreeNode parentTreeNode) { TreeNode childNode = new TreeNode(stkObjParent.InstanceName); string imageName = stkObjParent.ClassType.ToString().Remove(0, 1) + ".bmp"; string imagePath = Path.Combine(m_STKIconDir, imageName); if (File.Exists(imagePath)) { if (!this.ImageList.Images.ContainsKey(imagePath)) { childNode.ImageIndex = this.ImageList.Images.Count; ImageList.Images.Add(new Bitmap(imagePath)); childNode.SelectedImageIndex = childNode.ImageIndex; } else { childNode.ImageIndex = this.ImageList.Images.IndexOfKey(imagePath); childNode.SelectedImageIndex = childNode.ImageIndex; } } childNode.Tag = stkObjParent; parentTreeNode.Nodes.Add(childNode); for (int i = 0; i < stkObjParent.Children.Count; ++i) { PopulateTreeView(stkObjParent.Children[i], childNode); } }
private IAgCrdnCondition CreateCondition(IAgStkObject stkObject, string name, IAgCrdnCalcScalar scalar, AgECrdnConditionThresholdOption operation, double value) { IAgCrdnConditionFactory factory = stkObject.Vgt.Conditions.Factory; // Check if component exists. CheckExistingVgtComponent(stkObject.Vgt.Conditions, name); IAgCrdnConditionScalarBounds condition = factory.CreateConditionScalarBounds(name, "") as IAgCrdnConditionScalarBounds; condition.Scalar = scalar; condition.Operation = operation; // Min/Max must be IAgQuantity IAgQuantity valueQuantity = CommonData.StkRoot.ConversionUtility.NewQuantity("Angle", "deg", value); if (operation == AgECrdnConditionThresholdOption.eCrdnConditionThresholdOptionAboveMin) { condition.SetMinimum(valueQuantity); } else if (operation == AgECrdnConditionThresholdOption.eCrdnConditionThresholdOptionBelowMax) { condition.SetMaximum(valueQuantity); } return(condition as IAgCrdnCondition); }
public Satellite_MassData(IAgStkObject object0) // Devise get,set methods { IAgSatellite satellite0 = object0 as IAgSatellite; IAgVeMassProperties MassProp = satellite0.MassProperties as IAgVeMassProperties; m_ultimateObject = MassProp; get_MassProps(MassProp); }
public static void VectorChangeColor(string vectorName, IAgStkObject stkObject, Color SelectedColor) { IAgAircraft _aircraft = stkObject as IAgAircraft; IAgCrdn _vectorVGT = stkObject.Vgt.Vectors[vectorName] as IAgCrdn; IAgVORefCrdnVector _vectorVO = _aircraft.VO.Vector.RefCrdns.Add(AgEGeometricElemType.eVectorElem, _vectorVGT.QualifiedPath) as IAgVORefCrdnVector; _vectorVO.Color = SelectedColor; }
private void Ephem2Text(string filePath, Array times, IAgScenario scen, IAgStkObject ephemObject, string coordSys, Array x, Array y, Array z, Array xVel, Array yVel, Array zVel) { // Print ephem data to text file if (File.Exists(filePath)) { File.Delete(filePath); } using (StreamWriter sw = File.CreateText(filePath)) { var ephemLength = times.Length; sw.WriteLine("stk.v.5.0"); sw.WriteLine("BEGIN Ephemeris"); sw.WriteLine("NumberOfEphemerisPoints " + ephemLength.ToString()); var StartTimeUTCG = CommonData.StkRoot.ConversionUtility.ConvertDate("EpSec", "UTCG", scen.StartTime.ToString()); sw.WriteLine("ScenarioEpoch " + StartTimeUTCG); if ((ephemObject.ClassName == "Missile") || (ephemObject.ClassName == "LaunchVehicle")) { sw.WriteLine("InterpolationMethod Lagrange"); sw.WriteLine("InterpolationSamplesM1 5"); } else if (ephemObject.ClassName == "Satellite") { sw.WriteLine("InterpolationSamplesM1 7"); } else { try { var ephemObjAC = ephemObject as IAgAircraft; if (ephemObjAC.RouteType.ToString() == "ePropagatorAviator") { sw.WriteLine("InterpolationMethod Hermite"); } } catch { if (coordSys == "CentralBody/Earth Fixed") { sw.WriteLine("InterpolationMethod GreatArc"); } } sw.WriteLine("InterpolationSamplesM1 1"); } sw.WriteLine("DistanceUnit Kilometers"); sw.WriteLine("CentralBody " + ephemObject.CentralBodyName); string[] objs = coordSys.Split(' '); sw.WriteLine("CoordinateSystem Custom " + objs[1] + " " + objs[0]); sw.WriteLine("EphemerisTimePosVel"); for (int k = 0; k < ephemLength; k++) { sw.WriteLine("{0} {1} {2} {3} {4} {5} {6}", times.GetValue(k), x.GetValue(k), y.GetValue(k), z.GetValue(k), xVel.GetValue(k), yVel.GetValue(k), zVel.GetValue(k)); } sw.WriteLine("END Ephemeris"); } }
public int isParentObj; // 0 - basechild (value element) 1-parent comp 2-subcomp 3-subsubcomp 4- subsubsubcomp // Default Constructor public STKObject() { m_ObjName = null; m_ObjType = null; m_ObjectHandle = null; m_OrbitData = null; m_Unit = null; isParentObj = 99999; }
private void cbStkObjects_SelectedIndexChanged(object sender, EventArgs e) { string simpleName; string className; Events.Items.Clear(); //Change options in Events box StringCollection objectPaths = m_stkObjectsLibrary.GetObjectPathListFromInstanceNamesXml(CommonData.StkRoot.AllInstanceNamesToXML(), ""); simpleName = cbStkObjects.Text; foreach (string path in objectPaths) { string objectName = m_stkObjectsLibrary.ObjectName(path); className = m_stkObjectsLibrary.ClassNameFromObjectPath(path); if (objectName == simpleName && className != "Scenario") { className = m_stkObjectsLibrary.ClassNameFromObjectPath(path); string objectPath = className + "/" + simpleName; IAgStkObject obj = CommonData.StkRoot.GetObjectFromPath(objectPath); events = obj.Vgt.Events; int eventCount = obj.Vgt.Events.Count; for (int i = 0; i < eventCount; i++) { IAgCrdn currentEvent = (IAgCrdn)events[i]; Events.Items.Add(currentEvent.Name); } } } if (cbStkObjects.Text.Contains("Access")) { IAgScenario scenario = CommonData.StkRoot.CurrentScenario as IAgScenario; Array accesses = scenario.GetExistingAccesses(); int numAccesses = accesses.GetLength(0); for (int i = 0; i < numAccesses; i++) { string object1 = accesses.GetValue(i, 0).ToString(); string shortobject1 = object1.Substring(object1.IndexOf('/') + 1); string object2 = accesses.GetValue(i, 1).ToString(); string shortobject2 = object2.Substring(object2.IndexOf('/') + 1); if (cbStkObjects.Text.Contains(shortobject1) && cbStkObjects.Text.Contains(shortobject2)) { IAgStkAccess access = scenario.GetAccessBetweenObjectsByPath(object1, object2); accessEvents = access.Vgt.Events; for (int j = 0; j < accessEvents.Count; j++) { IAgCrdn currentEvent = (IAgCrdn)accessEvents[j]; Events.Items.Add(currentEvent.Name); } } } } }
public static Array GetArticulations(IAgStkObject parent) { IAgDataPrvFixed articDP = parent.DataProviders["Model LOD 0 Articulations"] as IAgDataPrvFixed; IAgDrResult result = articDP.Exec(); Array names = result.DataSets.ElementNames; return(names); }
public void OnDisplayMenu(string MenuTitle, AgEUiPluginMenuBarKind MenuBarKind, IAgUiPluginMenuBuilder2 MenuBuilder) { if (MenuTitle.Contains("Insert")) { //Add a Menu Item to the Insert menu stdole.IPictureDisp picture1; picture1 = (stdole.IPictureDisp)Microsoft.VisualBasic.Compatibility.VB6.Support.ImageToIPicture(Agi.Ui.GreatArc.Stk12.Properties.Resources.acRoute64); MenuBuilder.InsertMenuItem(4, "RasterSearch.LaunchInterface", "Aircraft from Search Pattern...", "Define an Aircraft based on search criteria", picture1); } if (MenuBarKind == AgEUiPluginMenuBarKind.eUiPluginMenuBarContextMenu) { //the STK Object Root AgStkObjectRoot root = (AgStkObjectRoot)m_pSite.Application.Personality2; //the current Selected Object IAgStkObject oSelectedObject = root.GetObjectFromPath(m_pSite.Selection[0].Path); //Only show menu items for the Scenario or Satellite object if (oSelectedObject.ClassName.Equals("Aircraft") || oSelectedObject.ClassName.Equals("GroundVehicle") || oSelectedObject.ClassName.Equals("Ship")) { MenuBuilder.InsertMenuItem(3, "UpdateVelocity", "Update Velocity", "Update Velocity", null); MenuBuilder.InsertMenuItem(4, "UpdateAltitude", "Update Altitude", "Update Altitude", null); MenuBuilder.InsertMenuItem(5, "UpdateTurnRadius", "Update Turn Radius", "Update Turn Radius", null); MenuBuilder.InsertMenuItem(6, "EnterEditMode", "Enter 3D Edit Mode", "Enter 3D Edit Mode", null); MenuBuilder.InsertSeparator(6); MenuBuilder.InsertSeparator(3); } else if (oSelectedObject.ClassName.Equals("Place") || oSelectedObject.ClassName.Equals("Facility") || oSelectedObject.ClassName.Equals("Target") || oSelectedObject.ClassName.Equals("AreaTarget") || oSelectedObject.ClassName.Equals("LineTarget")) { MenuBuilder.InsertMenuItem(3, "EnterEditMode", "Enter 3D Edit Mode", "Enter 3D Edit Mode", null); MenuBuilder.InsertSeparator(3); } } if (MenuTitle.Contains("Ship") || MenuTitle.Contains("GroundVehicle") || MenuTitle.Contains("Aircraft")) { MenuBuilder.InsertMenuItem(0, "UpdateVelocity", "Update Velocity", "Update Velocity", null); MenuBuilder.InsertMenuItem(1, "UpdateAltitude", "Update Altitude", "Update Altitude", null); MenuBuilder.InsertMenuItem(2, "UpdateTurnRadius", "Update Turn Radius", "Update Turn Radius", null); MenuBuilder.InsertMenuItem(3, "ShiftLatitude", "Shift in Latitude", "Shift in Latitude", null); MenuBuilder.InsertMenuItem(4, "ShiftLongitude", "Shift in Longitude", "Shift in Longitude", null); MenuBuilder.InsertSeparator(5); } }
public static IAgCrdnVector GetVectorBetweenObjects(string parentObjectPath, string fromObjectPath, string toObjectPath, string vectorName = "", bool addDisplay = false) { IAgStkObject parentObject = StkAssistant.Root.GetObjectFromPath(parentObjectPath); IAgStkObject fromObject = StkAssistant.Root.GetObjectFromPath(fromObjectPath); IAgStkObject toObject = StkAssistant.Root.GetObjectFromPath(toObjectPath); return(GetVectorBetweenObjects(parentObject, fromObject, toObject, vectorName, addDisplay)); }
public SensorViewClass(AgStkObjectRoot root, IAgStkObject selectedSensor) { m_root = root; sensor = (IAgSensor)selectedSensor; IAgExecCmdResult result = m_root.ExecuteCommand("GetDirectory / STKHome"); installDir = result[0]; pluginInstallDir = installDir + @"Plugins\SensorBoresightView"; }