internal void UpdateRecord(TaggedObject record) { m_cachedRecord = new CachedP4Record(record); m_cachedStatus = SourceControlStatus.Unknown; // invalidate cache status NotControlled = false; NotInClientView = false; m_dirty = false; }
public CachedP4Record(TaggedObject record) { Record = record; ResetTimestamp(); }
public Asn1Mrz(Asn1Document document, TaggedObject content, Asn1Object parentObject) : base(document, content, parentObject) { }
public DummyCommandResult(bool success, params string[] args) { Success = success; TaggedOutput = new TaggedObjectList(); foreach (var item in args) { var record = new TaggedObject(); record["clientFile"] = item; record["dummy"] = "true"; // identifies IP4CommandResult as containing a dummy record for this item TaggedOutput.Add(record); } }
protected override Asn1Object CreateSpecificTaggedObject(Asn1Document document, TaggedObject content, Asn1Object parent) { var result = base.CreateSpecificTaggedObject(document, content, parent); if (result != null) { return(result); } var tag = content.Tag.Value; if (tag == (ushort)Tags.Icao.Mrz) { return(new Asn1Mrz(document, content, parent)); } return(null); }
public Asn1DataGroupData(Asn1Document document, TaggedObject content, Asn1Object parentObject) : base(document, content, parentObject) { EFTag = (Tags.EF)content.Tag.Value; }
/// <summary> /// Return the persistent HANDLE for an object tag. /// </summary> /// <param name="taggedObject"></param> /// <returns></returns> public static string GetHandle(this TaggedObject taggedObject) { TheUfSession.Tag.AskHandleFromTag(taggedObject.Tag, out string handle); return(handle); }
private static org.fressian.handlers.ILookup <Type, IDictionary <String, WriteHandler> > initCoreWriteHandlers() { IDictionary <Type, IDictionary <String, WriteHandler> > handlers = new Dictionary <Type, IDictionary <String, WriteHandler> >(); var intHandler = new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => w.writeInt(o))); installHandler(handlers, typeof(short), "int", intHandler); installHandler(handlers, typeof(int), "int", intHandler); installHandler(handlers, typeof(long), "int", intHandler); installHandler(handlers, typeof(bool), "bool", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => w.writeBoolean(o)))); installHandler(handlers, (new byte[0]).GetType(), "bytes", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => w.writeBytes((byte[])o)))); installHandler(handlers, typeof(double), "double", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => w.writeDouble(o)))); installHandler(handlers, typeof(float), "float", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => w.writeFloat(o)))); installHandler(handlers, typeof(string), "string", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => w.writeString(o)))); //FF - c# dictionaries cannot key on null //installHandler(handlers, null, "null", new Action<Writer, object>((w, o) => w.writeNull())); installHandler(handlers, typeof(Null), "null", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => w.writeNull()))); installHandler(handlers, (new int[] { }).GetType(), "int[]", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => { int[] ints = (int[])o; w.writeTag("int[]", 2); w.writeInt(ints.Length); for (int n = 0; n < ints.Length; n++) { w.writeInt(ints[n]); } }))); installHandler(handlers, (new long[] { }).GetType(), "long[]", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => { long[] longs = (long[])o; w.writeTag("long[]", 2); w.writeInt(longs.Length); for (int n = 0; n < longs.Length; n++) { w.writeInt(longs[n]); } }))); installHandler(handlers, (new float[] { }).GetType(), "float[]", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => { float[] floats = (float[])o; w.writeTag("float[]", 2); w.writeInt(floats.Length); for (int n = 0; n < floats.Length; n++) { w.writeFloat(floats[n]); } }))); installHandler(handlers, (new bool[] { }).GetType(), "boolean[]", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => { bool[] bools = (bool[])o; w.writeTag("boolean[]", 2); w.writeInt(bools.Length); for (int n = 0; n < bools.Length; n++) { w.writeBoolean(bools[n]); } }))); installHandler(handlers, (new double[] { }).GetType(), "double[]", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => { double[] doubles = (double[])o; w.writeTag("double[]", 2); w.writeInt(doubles.Length); for (int n = 0; n < doubles.Length; n++) { w.writeDouble(doubles[n]); } }))); installHandler(handlers, (new Object[] { }).GetType(), "Object[]", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => { Object[] objects = (Object[])o; w.writeTag("Object[]", 2); w.writeInt(objects.Length); for (int n = 0; n < objects.Length; n++) { w.writeObject(objects[n]); } }))); installHandler(handlers, typeof(TaggedObject), "any", new GenericWriteHandler <object>(new Action <Writer, object>((w, o) => { TaggedObject t = (TaggedObject)o; Object[] value = t.Value; w.writeTag(t.Tag, value.Length); for (int n = 0; n < value.Length; n++) { //FF - c# dictionaries cannot have null keys, this is part of the workaround var x = value[n]; w.writeObject(x == null ? Handlers.Null.Value : x); } }))); return(new InheritanceLookup <IDictionary <String, WriteHandler> >(new MapLookup <Type, IDictionary <String, WriteHandler> >(handlers))); }
public static int NotMain(string[] args) { theSession = Session.GetSession(); uf = UFSession.GetUFSession(); theUI = UI.GetUI(); var Zsort = new SortByZ(); var part = theSession.Parts.Work; var AllPoints = new List <NodePoint>(); int counter = 0; for (int i = 0; i < theUI.SelectionManager.GetNumSelectedObjects(); i++) { TaggedObject obj = theUI.SelectionManager.GetSelectedTaggedObject(i); if (obj is Point) { Point3d coords = ((Point)obj).Coordinates; NodePoint iNode = new NodePoint("Point_" + counter++, coords); AllPoints.Add(iNode); // Собираем список всех точек } } var Tags = new List <Tag>(); var tag = new Tag(); /* // Curvature = OK * AllPoints.Sort(Zsort); * foreach (NodePoint node in AllPoints) * { * var newpoint = new Point3d(node.X, node.Y, node.Z); * var p = part.Points.CreatePoint(newpoint); * node.Name = "A" + counter++; * p.SetName(node.Name); * PointFeatureBuilder p_feature; * p_feature = part.BaseFeatures.CreatePointFeatureBuilder(null); * p_feature.Point = p; * p_feature.Commit(); * p_feature.GetFeature().SetName(node.Name); * Tags.Add(p_feature.GetFeature().Tag); * p.SetVisibility(SmartObject.VisibilityOption.Visible); * } * uf.Modl.CreateSetOfFeature("Curvature", Tags.ToArray(), Tags.Count, 1, out tag); */ /* * foreach (NodePoint Vstart in AllPoints) * { * foreach (NodePoint Vend in AllPoints) * { * if (Vstart.Name != Vend.Name) * { * Vstart.DistanceTo.Add(Vend, getDistance(Vstart, Vend)); * } * } * } * * * NodePoint thisNode = AllPoints[0]; * NodePoint nextNode = null; * counter = 0; * thisNode.Name = "A" + counter++; * Graph.AddLast(thisNode); * * while (Graph.Count < AllPoints.Count) * { * nextNode = thisNode.getClosestNode(); * while (Graph.Contains(nextNode)) * { * thisNode.DistanceTo.Remove(nextNode); * nextNode = thisNode.getClosestNode(); * } * thisNode = nextNode; * thisNode.Name = "A" + counter++; * Graph.AddLast(thisNode); * } * * for (LinkedListNode<NodePoint> node = Graph.First; node != null; node = node.Next) * { * var newpoint = new Point3d(node.Value.X, node.Value.Y, node.Value.Z); * var p = part.Points.CreatePoint(newpoint); * p.SetName(node.Value.Name); * PointFeatureBuilder p_feature; * p_feature = part.BaseFeatures.CreatePointFeatureBuilder(null); * p_feature.Point = p; * p_feature.Commit(); * p_feature.GetFeature().SetName(node.Value.Name); * Tags.Add(p_feature.GetFeature().Tag); * p.SetVisibility(SmartObject.VisibilityOption.Visible); * } * * * uf.Modl.CreateSetOfFeature("Curvature", Tags.ToArray(), Tags.Count, 1, out tag); */ return(0); }
//------------------------------------------------------------------------------ //Callback Name: update_cb //------------------------------------------------------------------------------ public int update_cb(NXOpen.BlockStyler.UIBlock block) { try { if (block == addOrModify) { //---------Enter your code here----------- if (addOrModify.Value) { addOrModify.Label = "添加WORK"; string[] members = { "WORK" + (numbers[numbers.Count - 1] + 1).ToString() }; workNumber.Enable = false; workNumber.SetEnumMembers(members); } else { addOrModify.Label = "修改WORK"; List <string> members = new List <string>(); foreach (int i in numbers) { members.Add("WORK" + i.ToString()); } workNumber.Enable = true; workNumber.SetEnumMembers(members.ToArray()); } } else if (block == workNumber) { //---------Enter your code here----------- } else if (block == selePart) { //---------Enter your code here----------- Part part = (this.selePart.GetSelectedObjects()[0] as NXOpen.Assemblies.Component).Prototype as Part; List <NXObject> partBody = new List <NXObject>(); foreach (Body body in part.Bodies) { partBody.Add(body); } this.moveObjectBasic = new MoveObjectBasic(partBody); points = moveObjectBasic.CreatePoint(); } else if (block == selePoint) { TaggedObject obj = selePoint.GetSelectedObjects()[0]; //---------Enter your code here----------- if (obj is Point) { this.selectionPt = obj as Point; } if (obj is Face) { this.selectionFace = obj as Face; } if (selectionPt != null) { Point3d temp; if (selectionFace != null) { temp = moveObjectBasic.GetPointToFaceDis(selectionPt, selectionFace); } else { temp = selectionPt.Coordinates; } CsysUtils.SetWcsOfCentePoint(temp); } } else if (block == button_X) { //---------Enter your code here----------- CsysUtils.RotateWcs(WCS.Axis.XAxis, 90); } else if (block == button_Y) { //---------Enter your code here----------- CsysUtils.RotateWcs(WCS.Axis.YAxis, 90); } else if (block == button_Z) { //---------Enter your code here----------- CsysUtils.RotateWcs(WCS.Axis.ZAxis, 90); } } catch (Exception ex) { //---- Enter your exception handling code here ----- theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString()); } return(0); }