예제 #1
0
 public TreeForm()
 {
     InitializeComponent();
     NsNode node = new NsNode("root");
     node.Attach(nsNodeTree1);
     node.Update();
 }
예제 #2
0
        public Form1()
        {
            InitializeComponent();
            //m_node = NodeIO.ReadXml( Environment.GetFolderPath( Environment.SpecialFolder.Desktop) + "\\total.xml");
            m_node = NodeIO.ReadTxt(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\build.txt");

            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "xml files (*.xml)|*.xml|txt files (*.txt)|*.txt|All files (*.*)|*.*";
            if (m_node == null && ofd.ShowDialog() == DialogResult.OK)
            {
                string path = ofd.FileName;
                if (System.IO.Path.GetExtension(path) == ".txt")
                    m_node = NodeIO.ReadTxt(path);
                else
                    m_node = NodeIO.ReadXml(path);
            }

            if (m_node != null)
            {
                m_node.Attach(nsNodeTree1);
                m_node.Update();
            }

            queryView1.Attach(nsNodeTree1);
            //nsNodeView1.Attach(nsNodeTree1);
            BringToFront();
        }
예제 #3
0
 public Center3d(NsNode parent, System.Xml.XmlNode xml)
     : this()
 {
     m_parent = parent;
     if (!FromXml(xml))
         throw new AttributeXmlFormatException(this, xml, "Failed to read xml");
 }
예제 #4
0
 public TapeRefAttribute(NsNode parent, string Label, string ItemNumber, double Width)
 {
     m_parent = parent;
     m_width = Width;
     m_label = Label;
     m_itemnumber = ItemNumber;
 }
예제 #5
0
 public ContourTracker(string label)
 {
     m_node = new NsNode(label);
     Random rand = new Random();
     int i = rand.Next(5345);
     m_node.Add(new ContourAttribute(m_node, null, null));
 }
예제 #6
0
 /// <summary>
 /// Constructs a node flow on a given node
 /// </summary>
 /// <param name="node">the node to flow</param>
 public NsNodeFlow(NsNode node)
 {
     InitializeComponent();
     InitializeFlow();
     m_node = node;
     if (Node != null)
         Reload();
 }
예제 #7
0
 public PassList(NsNode parent, string label, Point3D[][] xyzs, Point3D[][] uvws, double[][] speeds, double[][] caxes)
     : this(parent, label)
 {
     for (int i = 0; i < xyzs.GetLength(0); i++)
     {
         Add(new PassNode(this, xyzs[i], uvws[i], speeds[i], caxes[i]));
     }
 }
예제 #8
0
 public PlyAttribute(NsNode parent, int id, int speed, string taperef, Color color)
 {
     m_parent = parent;
     m_id = id;
     m_speed = speed;
     m_taperef = taperef;
     m_color = color;
 }
예제 #9
0
 public CustomBasis(NsNode parent, double A, double B, double C, double D)
     : this(parent)
 {
     a = A;
        b = B;
        c = C;
        d = D;
 }
예제 #10
0
 public PassList(NsNode parent, string label, IList<IList<Point3D>> xyzs, IList<IList<Point3D>> uvws, IList<IList<double>> speeds, IList<IList<double>> caxes)
     : this(parent, label)
 {
     for (int i = 0; i < xyzs.Count; i++)
     {
         Add(new PassNode(this, xyzs[i], uvws[i], speeds[i], caxes[i]));
     }
 }
예제 #11
0
        public MeshNode(NsNode parent, System.Xml.XmlNode xml)
            : base(parent, xml)
        {
            //if(!FromXml(xml))
               //     throw new AttributeXmlFormatException(null, xml, "Failed to read xml");

               //Add(new MatrixNode(this, "Transformation", 4, 4));
        }
예제 #12
0
        public MeshNode(string label, NsNode parent, double[,] initTransform)
            : this(label, parent)
        {
            for (int i = 0; i < 3; i++)
                    initTransform[i, 3] *= 1000;

               m_T = new Transformation(initTransform);
        }
예제 #13
0
 public MatrixNode(NsNode parent, string Label, double[,] vals)
 {
     m_parent = parent;
     Add(new IntAttribute(this, "Rows", vals.GetLength(0)));
     Add(new IntAttribute(this, "Columns", vals.GetLength(1)));
     for (int i = 0; i < vals.GetLength(0); i++)
         for (int j = 0; j < vals.GetLength(1); j++)
             Add(new DoubleAttribute(this, "[" + i + "," + j + "]", vals[i, j]));
 }
예제 #14
0
 public MatrixNode(NsNode parent, string Label, int rows, int cols)
 {
     m_parent = parent;
     Add(new IntAttribute(this, "Rows", rows));
     Add(new IntAttribute(this, "Columns", cols));
     for (int i = 0; i < rows; i++)
         for (int j = 0; j < cols; j++)
             Add(new DoubleAttribute(this, "[" + i + "," + j + "]", 0));
 }
예제 #15
0
 public ArrayAttribute(NsNode parent, XmlNode xml)
     : this(parent, null, null)
 {
     if (!FromXml(xml))
     {
         System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(1, true);
         throw new AttributeXmlFormatException(this, xml, "Failed to read xml (" + stackFrame.GetMethod() + " ln: " + stackFrame.GetFileLineNumber() +")");
     }
 }
예제 #16
0
 public TapeAttribute(NsNode parent, string label, IList<PointF> points)
 {
     m_parent = parent;
     m_label = label;// Parent.IndexOf(this).ToString();
     if (points != null)
         m_points = new List<PointF>(points);
     else
         m_points = new List<PointF>();
 }
예제 #17
0
 public ArrayAttribute(NsNode parent, string label, IList<double> array)
 {
     m_parent = parent;
     m_label = label;
     if (array != null)
         m_array = new List<double>(array);
     else
         m_array = new List<double>();
 }
예제 #18
0
 private void AddNode()
 {
     NsNode node = new NsNode("new", Node);
     NsNodeEditor edit = new NsNodeEditor(node);
     if (edit.ShowDialog() == DialogResult.OK)
     {
         nodeList.Items.Add(CreateNodeItem(node));
         nodeList.Refresh();
     }
 }
예제 #19
0
 public YarnDoc(string label, NsNode parent)
 {
     if (Path.GetExtension(label) != string.Empty)
     {
         m_doc = new NsNode(Path.GetFileName(label), parent);
         Open3dl(label);
     }
     else
         m_doc = new NsNode(label, parent);
 }
예제 #20
0
        public PolylineAttribute(NsNode parent, string label, IList<double[]> points)
        {
            m_parent = parent;
            if (points != null)
                m_points = new List<double[]>(points);
            else
                m_points = new List<double[]>();

            Label = label;
        }
예제 #21
0
 public MarkAttribute(NsNode parent, string label, PointF point, int plyid)
 {
     m_parent = parent;
     m_label = "Mark";
     m_plyid = plyid;
     if (point != PointF.Empty)
         m_point = point;
     else
         m_point = new PointF();
 }
예제 #22
0
 public RBFCurve(NsNode parent, string label, List<double[]> fitPoints, IBasisFunction basis, IRBFPolynomial poly, double relaxation)
     : base(label, parent)
 {
     Add(new CenterArrayNode(this));
     basis.CopyTo(this);
     poly.CopyTo(this);
     Relaxation = relaxation;
        OriginalFitPoints = fitPoints;
     Fit(fitPoints, relaxation);
 }
예제 #23
0
 public ContourNode(NsNode parent, string label, ITracker tracker)
     : base(label, parent)
 {
     Attributes.Add(new ContourAttribute(this, null, null));
     if (tracker != null)
     {
         Attach(tracker);
         if (tracker is INodeView)
             Attach(tracker as INodeView);
     }
 }
예제 #24
0
 public TapeAttribute(NsNode parent, string label, IList<PointF> points, int plyID, PolylineAttribute strip)
 {
     m_parent = parent;
     m_label = label;
     if (points != null)
         m_points = new List<PointF>(points);
                 else
         m_points = new List<PointF>();
     m_plyid = plyID;
     m_strip = strip.CopyTo(null) as PolylineAttribute;
 }
예제 #25
0
        void TapeRosette(NsNode node, int ply, double den, double width)
        {
            double rad = 0;
            if (radius.Text != "")
                rad = double.Parse(radius.Text);
            if (rad <= 0)
            {
                MessageBox.Show("Must enter a positive radius");
                return;
            }

            double ntapes  = 0;

            if ( numtapes.Text != "")
                ntapes = double.Parse(numtapes.Text);
            if (ntapes <= 0)
            {
                MessageBox.Show("Must enter a positive number of tapes");
                return;
            }

            double[] ang = angles.Point;
            if (Math.Abs(ang[0]) < 1e-5 && Math.Abs(ang[1]) < 1e-5)
            {
                MessageBox.Show("Both angles cannot be 0");
                return;
            }

            List<IAttribute> lines = new List<IAttribute>(3);
            List<double[]> pnts = null;
            PointAttribute pnt;
            if (node.SimpleQuery("PointAttribute=*", lines, true))
            {
                pnts = new List<double[]>(lines.Count);
                foreach (IAttribute atr in lines)
                {
                    if (atr is PointAttribute)
                    {
                        pnt = atr as PointAttribute;
                        pnts.Add((double[])pnt.Value);
                    }
                }
            }
            if (pnts != null && pnts.Count >= 1)
                CreateRosettes(pnts, ply, den, width, rad, ntapes, ang[0], ang[1]);
        }
예제 #26
0
        void TapeContour(NsNode node, int ply, double den, double width)
        {
            double[] dir = direction.Point;
            if (Math.Abs(dir[0]) < 1e-5 && Math.Abs(dir[1]) < 1e-5)
            {
                MessageBox.Show("Must specify a taping direction");
                return;
            }

            double[] ofs = offset.Point;

            List<IAttribute> lines = new List<IAttribute>(1);
            List<devDept.Geometry.Point3D> pnts = null;
            if (node.SimpleQuery("PolylineAttribute=*", lines, true))
            {
                pnts = (List<devDept.Geometry.Point3D>)lines[0].Value;
            }
            if (pnts != null && pnts.Count > 2)
                CreateContour(den, width, dir, ofs, pnts);
        }
예제 #27
0
 /// <summary>
 /// Opens a new modeless dialog box with a grid
 /// </summary>
 /// <param name="node">the node to display</param>
 /// <param name="owner">the parent form to attach to, can be null</param>
 /// <returns>the form containing the grid</returns>
 public static Form Show(NsNode node, Form owner)
 {
     Form f = new Form();
     f.Owner = owner;
     f.SuspendLayout();
     NsNodeGridView flow = new NsNodeGridView();
     flow.Dock = DockStyle.Fill;
     f.Controls.Add(flow);
     f.ResumeLayout();
     flow.Node = node;
     f.StartPosition = FormStartPosition.CenterParent;
     f.FormBorderStyle = FormBorderStyle.SizableToolWindow;
     f.Width = 600;
     f.Height = 300;
     f.Text = node.Label;
     f.Show();
     f.BringToFront();
     flow.ReadNode();
     return f;
 }
예제 #28
0
        public PassNode(NsNode parent, IList<Point3D> xyz, IList<Point3D> uvw, IList<double> speed, IList<double> caxis)
            : this(parent)
        {
            ContourAttribute pl = new ContourAttribute(this, null, xyz);
            Attributes.Add(pl);
            //pl.BlockRef.LayerIndex = 0;

            pl = new ContourAttribute(this, null, uvw);
            Attributes.Add(pl);
            //pl.BlockRef.LayerIndex = 1;

            ArrayAttribute aa = new ArrayAttribute(this, null, speed);
            Attributes.Add(aa);
            //aa.BlockRef.LayerIndex = 2;

            aa = new ArrayAttribute(this, null, caxis);
            Attributes.Add(aa);
            //aa.BlockRef.LayerIndex = 3;

            double scale = Length / 20.0;
            int mid = xyz.Count/2;
            Vector3D[] tpn = TPN(mid);

            //add a direction arrow
            ArrowAttribute arrow = new ArrowAttribute(this, XYZ(mid), tpn[0], tpn[1], tpn[2], scale);
            Attributes.Add(arrow);
            //arrow.BlockRef.LayerIndex = 4;

            //add a gantry frame for each point
            FrameAttribute gant;
            for( int i = 0; i < uvw.Count; i++ )
            {
                tpn = TPN(i);
                if( tpn == null )
                    continue;
                gant = new FrameAttribute(this, XYZ(i), tpn[0], tpn[1], tpn[2], scale);
                Attributes.Add(gant);
                //gant.BlockRef.LayerIndex = 1;
            }
        }
예제 #29
0
 public Point3DEntity(NsNode parent, double x, double y, double z)
     : base(parent, null, x, y, z)
 {
 }
예제 #30
0
 public Point3DEntity(NsNode parent, string label, double[] point)
     : base(parent, label, point)
 {
 }