/// <summary> /// Test for ProjectOntoPlane /// </summary> public void ProjectOntoPlaneTest(string genericCurveFile, Planes plane, MM position) { // Get curve var genericCurve = (PSGenericCurve)ImportAndGetEntity(genericCurveFile); // Project curve genericCurve.ProjectOntoPlane(plane, position); // Check the curve is flat in the projected plane and projected to the correction position switch (plane) { case Planes.XY: Assert.AreEqual((MM)0.0, genericCurve.BoundingBox.ZSize); Assert.AreEqual(position, genericCurve.BoundingBox.MinZ); break; case Planes.YZ: Assert.AreEqual((MM)0.0, genericCurve.BoundingBox.XSize); Assert.AreEqual(position, genericCurve.BoundingBox.MinX); break; case Planes.ZX: Assert.AreEqual((MM)0.0, genericCurve.BoundingBox.YSize); Assert.AreEqual(position, genericCurve.BoundingBox.MinY); break; } }
public static MM SetMapMode(IHandle hdc, MM mode) { MM result = SetMapMode((HDC)hdc.Handle, mode); GC.KeepAlive(hdc); return(result); }
public MM create() { switch (botwindow.getParam()) { case "C:\\America\\": mm = new MMAmerica(botwindow); break; case "C:\\Europa\\": mm = new MMEuropa(botwindow); break; case "C:\\Europa2\\": mm = new MMEuropa2(botwindow); break; case "C:\\SINGA\\": mm = new MMSing(botwindow); break; case "C:\\America2\\": mm = new MMAmerica2(botwindow); break; default: mm = new MMSing(botwindow); break; } return(mm); }
/// <summary> /// Projects the curve onto the specified plane at the specified position on the plane. /// </summary> /// <param name="plane">The plane onto which to project the curve.</param> /// <param name="positionOnPlane">The position on the plane at which to project the curve.</param> public void ProjectOntoPlane(Planes plane, MM positionOnPlane) { // Determine the axis string axis = ""; switch (plane) { case Planes.XY: axis = "Z"; break; case Planes.ZX: axis = "Y"; break; case Planes.YZ: axis = "X"; break; } // Select the curve AddToSelection(true); // Do the projection _powerSHAPE.DoCommand("EDIT PROJECT", "ALONG_" + axis, "DISTANCE " + positionOnPlane.ToString("0.######"), "KEEP_COPY OFF", "ACCEPT"); }
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string asset in importedAssets) { if (!filePath.Equals(asset)) { continue; } MM data = (MM)AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(MM)); if (data == null) { data = ScriptableObject.CreateInstance <MM> (); data.SheetName = filePath; data.WorksheetName = sheetName; AssetDatabase.CreateAsset((ScriptableObject)data, assetFilePath); //data.hideFlags = HideFlags.NotEditable; } //data.dataArray = new ExcelQuery(filePath, sheetName).Deserialize<MMData>().ToArray(); //ScriptableObject obj = AssetDatabase.LoadAssetAtPath (assetFilePath, typeof(ScriptableObject)) as ScriptableObject; //EditorUtility.SetDirty (obj); ExcelQuery query = new ExcelQuery(filePath, sheetName); if (query != null && query.IsValid()) { data.dataArray = query.Deserialize <MMData>().ToArray(); ScriptableObject obj = AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(ScriptableObject)) as ScriptableObject; EditorUtility.SetDirty(obj); } } }
public void CheckFailTooMuch() { if (IsVoteTask()) { int succ = 0; if (TaskName.Equals(TASK_VOTE_JIUTIAN)) { TimerChecked++; succ = JiuTian.GetSucc(); } else if (TaskName.Equals(TASK_VOTE_MM)) { TimerChecked++; succ = MM.GetSucc(); } else if (TaskName.Equals(TASK_VOTE_YUANQIU)) { TimerChecked++; succ = YuanQiu.GetSucc(); } if (succ - SuccCount < 2 && TimerChecked >= 2) { FailTooMuch = true; } LogCore.Write("success:" + succ + " last:" + SuccCount); SuccCount = succ; } }
private void button1_Click(object sender, EventArgs e) { decimal kk = 1; EsiToField[] Meta = MM.GetCateMeta(kk).Result; ucd1.Config(Meta); }
public static MM GetMapMode(IHandle hdc) { MM result = GetMapMode((HDC)hdc.Handle); GC.KeepAlive(hdc); return(result); }
}//free video private void Video_Timer_Tick(object sender, EventArgs e) { string HH, MM, SS; if (Video_Timer_Enable) { VideoPosition = (int)vid.CurrentPosition; trackBar.Value = 10 * VideoPosition; hour = VideoPosition / 3600; minute = (VideoPosition - hour * 3600) / 60; second = (VideoPosition - hour * 3600 - minute * 60); HH = ("00" + hour.ToString()); HH = HH.Substring(HH.Length - 2, 2); MM = ("00" + minute.ToString()); MM = MM.Substring(MM.Length - 2, 2); SS = ("00" + second.ToString()); SS = SS.Substring(SS.Length - 2, 2); curTime.Text = HH + ":" + MM + ":" + SS; if (curTime.Text == Video_Time) { audio_stop_Click(null, null); } } }
/// <summary> /// Sets the <paramref name="mapMode"/> in the given <paramref name="hdc"/> using /// <see cref="SetMapMode(HDC, MM)"/>. /// </summary> public SetMapModeScope(HDC hdc, MM mapMode) { _previousMapMode = SetMapMode(hdc, mapMode); // If we didn't actually change the map mode, don't keep the HDC so we skip putting back the same state. _hdc = mapMode == _previousMapMode ? default : hdc; }
public void EqualityOfMmArrayAndPointTest() { MM[] left = null; Point right = null; bool expected = false; bool actual = false; left = new MM[] { 1.0, 2.0, 3.0 }; right = new Point(1.0, 2.0, 3.0); expected = true; actual = left == right; Assert.AreEqual(expected, actual); actual = right == left; Assert.AreEqual(expected, actual); left = new MM[] { 1.0, 2.0, 4.0 }; right = new Point(1.0, 2.0, 3.0); expected = false; actual = left == right; Assert.AreEqual(expected, actual); actual = right == left; Assert.AreEqual(expected, actual); }
private void PopulateVendingItem() { foreach (var product in _inMemoryRepository.GetProducts()) { VendingMachineItem vendingMachineItem; switch (product.ProductCode) { //orderNumber, productName, price, totalItem case "COKE": vendingMachineItem = new Coke(product.OrderNumber, product.Name, product.Price, product.Quantity); _vendingMachineMap.TryAdd(product.OrderNumber, vendingMachineItem); break; case "MM": vendingMachineItem = new MM(product.OrderNumber, product.Name, product.Price, product.Quantity); _vendingMachineMap.TryAdd(product.OrderNumber, vendingMachineItem); break; case "WATER": vendingMachineItem = new Water(product.OrderNumber, product.Name, product.Price, product.Quantity); _vendingMachineMap.TryAdd(product.OrderNumber, vendingMachineItem); break; case "SNICKER": vendingMachineItem = new Snickers(product.OrderNumber, product.Name, product.Price, product.Quantity); _vendingMachineMap.TryAdd(product.OrderNumber, vendingMachineItem); break; default: throw new InvalidOperationException($"Invalid product code {product.ProductCode} vending machine does not support."); } } }
private void UpdateThroughUserInput() { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(Helper.CnnVal("AssetDB"))) { var equipment = new Equipment { equipmentId = ID, equipmentName = Name, equipmentSystem = BarCode, equipmentType = Type, building = Building, floor = Level, room = Room, zone = Zone, docLink = DocLink, docPhoto = DocPhotoLink, classification = Classification, materialType = MaterialType, consequencePriority = ConsequencePriority, opeationStatus = OpeationStatus, manufacturer = Manufacturer, year = MM.ToShortDateString(), degradationInfo = DegradationInfo, detail = Detail, inspectionStatus = Status, alarmType = AlarmType, collectedBy = CollectedBy, collectedOn = CollectedOn.ToShortDateString(), notes = Notes, inspectionPhotoLink = InspectionPhotoLink, attachmentLink = AttachmentLink }; Equipmentlist.Add(equipment); connection.Execute( "dbo.EquipmentList_Insert " + "@equipmentId, @equipmentName, @equipmentSystem, @equipmentType," + "@building,@floor,@room,@zone," + "@docLink,@docPhoto," + "@classification,@materialType," + "@consequencePriority,@opeationStatus," + "@manufacturer,@year,@degradationInfo,@detail," + "@inspectionStatus,@alarmType,@collectedBy," + "@collectedOn,@notes,@inspectionPhotoLink,@attachmentLink" , Equipmentlist); } MessageBox.Show("The data has been uploaded to the SQL Server!"); Equipmentlist.Clear(); }
/// <summary> /// 计算节点相交处相应单元的轴力向量 /// </summary> /// <param name="node">节点号</param> /// <param name="ele">单元号(必须为FrameElement)</param> /// <param name="com">荷载组合</param> /// <returns>轴力向量</returns> public Vector3 GetNodeForceVec(int node, int ele, BLoadComb com) { Vector3 Res = new Vector3(); FrameElement fme = MM.elements[ele] as FrameElement; //如果节点不在单元上则返回0向量 if (fme.iNs.Contains(node) == false) { return(new Vector3()); } ElemForce Force = MM.CalElemForceComb(com, ele); if (fme.I == node) { Res = MM.getFrameVec(ele); Res.Normalize();//归一化 Res = Res * Force.Force_i.N; } else { Res = -MM.getFrameVec(ele); Res.Normalize();//归一化 Res = Res * Force.Force_j.N; } return(Res); }
public static void CheckSucc() { TaskCore taskCore = MonitorCore.GetTaskCore(); string taskName = taskCore.TaskName; if (taskCore.IsVoteTask()) { var succ = 0; if (taskName.Equals(TaskCore.TASK_VOTE_JIUTIAN)) { succ = JiuTian.GetSucc(); } else if (taskName.Equals(TaskCore.TASK_VOTE_MM)) { succ = MM.GetSucc(); } else if (taskName.Equals(TaskCore.TASK_VOTE_YUANQIU)) { succ = YuanQiu.GetSucc(); } if (succ == 0) { succ = succCount; } double price = 0; try { price = double.Parse(ConfigCore.GetAutoVote("Price")); } catch (Exception) { } var name = ConfigCore.GetAutoVote("ProjectName"); var validCount = price >= 1 ? 1 : 2; var diff = succ - succCount; if (diff < validCount) { timerChecked++; if (timerChecked >= 2) { FailTooMuch = true; } } else { timerChecked = 0; } if (diff > 0) { Statistics.Add(name, price, diff); } LogCore.Write("成功:" + succ + " 上次成功:" + succCount); succCount = succ; } }
public void SaveMM(MM przesunieciemagazynowe) { if (przesunieciemagazynowe.MMID == 0) { context.MMs.Add(przesunieciemagazynowe); context.SaveChanges(); } }
void MoveFinished() { if (MM.map[(int)transform.position.x, (int)transform.position.y].hasJukeBox) { MM.die(); } CheckIfHit(); }
/// <summary> /// Creates a new solid sphere at the specified origin and radius. /// </summary> /// <param name="origin">Origin at which to create the sphere.</param> /// <param name="radius">Radius of the sphere.</param> /// <returns>The created sphere.</returns> public PSSolidSphere CreateSphere(Point origin, MM radius) { PSSolidSphere sphere = new PSSolidSphere(_powerSHAPE, origin); sphere.Radius = radius; Add(sphere); return(sphere); }
/// <summary> /// Creates a new solid cylinder at the specified origin, radius and length. /// </summary> /// <param name="origin">Origin at which to create the cylinder.</param> /// <param name="radius">Radius of the cylinder.</param> /// <param name="length">Length of the cylinder.</param> /// <returns>The created cylinder.</returns> public PSSolidCylinder CreateCylinder(Point origin, MM radius, MM length) { PSSolidCylinder cylinder = new PSSolidCylinder(_powerSHAPE, origin); cylinder.Radius = radius; cylinder.Length = length; Add(cylinder); return(cylinder); }
/// <summary> /// Creates a full Arc (circle) /// </summary> internal PSArc(PSAutomation powerSHAPE, Point centre, Point startPoint, MM radius) : this( powerSHAPE, centre, startPoint, startPoint, radius, 360.0f) { }
/// <summary> /// Creates an Arc based on a start point, radius and span /// </summary> internal PSArc(PSAutomation powerSHAPE, Point centre, Point startPoint, MM radius, Degree span) : this( powerSHAPE, centre, startPoint, startPoint, radius, (float)span) { }
/// <summary> /// This constructor creates a plane at a specified origin and sets is length and width properties /// </summary> internal PSSurfacePlane(PSAutomation powershape, Point origin, Planes principalPlane, MM length, MM width) : this( powershape, origin, principalPlane) { // Alter attributes Length = length; Width = width; }
/// <summary> /// This operation creates a Block in PowerMILL from an existing model. /// </summary> /// <param name="modelName">The name of the model from which to create the block.</param> /// <param name="blockExpansion">Offsets the minimum block size by blockExpansion. If this parameter is 0 the block used to calculat ethe silhouette boundary will have the minimum size to embed the part.</param> public void CreateBlock(string modelName, MM blockExpansion) { _powerMILL.DoCommand("EDIT MODEL ALL DESELECT ALL"); _powerMILL.DoCommand(string.Format("EDIT MODEL \"{0}\" SELECT ALL", modelName)); _powerMILL.DoCommand("DELETE BLOCK"); _powerMILL.DoCommand(string.Format("EDIT BLOCK RESETLIMIT \"{0}\"", blockExpansion)); _powerMILL.DoCommand("EDIT BLOCK LIMITTYPE MODEL"); _powerMILL.DoCommand("EDIT BLOCK RESET"); _powerMILL.DoCommand("BLOCK ACCEPT"); }
public void KTest() { Vector target = new Vector(); MM expected = 2.0; MM actual = default(MM); target.K = expected; actual = target.K; Assert.AreEqual(expected, actual); }
public void NormalizeTest() { Vector target = new Vector(2.0, 7.0, 3.0); MM expected = 1.0; target.Normalize(); MM actual = target.Magnitude; Assert.AreEqual(expected, actual); }
public void ZTest() { Point target = new Point(1.0, 2.0, 3.0); MM expected = 3.0; MM actual = default(MM); target.Z = expected; actual = target.Z; Assert.AreEqual(expected, actual); }
public static void TestGenericStruct() { var m2 = new MM() { i = 1, s = "01" }; Ttt(m2); //抛异常 Ttt2(m2); //正确 }
public void VectorConstructorTest1() { MM i = 2.0; MM j = 3.0; MM k = 4.0; Vector target = new Vector(i, j, k); Assert.AreEqual(i, target.I); Assert.AreEqual(j, target.J); Assert.AreEqual(k, target.K); }
public void VectorConstructorTest2() { MM i = 0.0; MM j = 0.0; MM k = 0.0; Vector target = new Vector(); Assert.AreEqual(i, target.I); Assert.AreEqual(j, target.J); Assert.AreEqual(k, target.K); }
public void DotProductTest() { Vector left = new Vector(2.0, 3.0, 4.0); Vector right = new Vector(5.0, 7.0, 9.0); MM expected = 67.0; MM actual = default(MM); actual = Vector.DotProduct(left, right); Assert.AreEqual(expected, actual); }
public MM RangeField(string label, MM range) { return RangeField(label, range, 1); }
public MM RangeField(string label, MM range, float scale) { MM v = new MM(range.ToString()); BeginHorizontal("box"); FixedLabel(label); v.min = EditorGUILayout.FloatField(range.min, Width(fieldWidth * scale/2f)); FixedLabel("-"); v.max = EditorGUILayout.FloatField(range.max, Width(fieldWidth * scale/2f)); EndHorizontal(); changed = changed || (checkChanges && (!v.Equals(range))); return v; }