Exemplo n.º 1
0
        public void DrawCenterLines(TsPart tsPart, TsView tsView)
        {
            double scale = tsView.scale;
            double delta = 2 * scale;

            double[] start = tsPart.partStart;
            double[] end   = tsPart.partEnd;

            Point o = tsPart.origin;

            Point startPoint = new Point(start[0], start[1], start[2]);
            Point endPoint   = new Point(end[0], end[1], end[2]);

            LineSegment auxLS = new LineSegment(o, endPoint);

            Vector auxVec = auxLS.GetDirectionVector();

            Vector clVec  = Extensions.ExtendVector(auxVec, delta);
            Vector nclVec = (-1) * clVec;

            startPoint.Translate(nclVec.X, nclVec.Y, nclVec.Z);
            endPoint.Translate(clVec.X, clVec.Y, clVec.Z);

            Inserter.InsertLine(tsView._viewBase, startPoint, endPoint);
        }
Exemplo n.º 2
0
        public void DrawCenterLines(TsPart tsPart, TsView tsView)
        {
            double   scale  = tsView.scale;
            double   width  = tsPart.width;
            double   height = tsPart.height;
            ViewBase view   = tsView._viewBase;

            double delta      = Math.Max(width, height) / 2 + 2 * scale;
            Point  partCenter = tsPart.origin;

            Point iStart = new Point(partCenter.X + delta, partCenter.Y, partCenter.Z);
            Point iEnd   = new Point(partCenter.X - delta, partCenter.Y, partCenter.Z);

            Inserter.InsertLine(view, iStart, iEnd);

            Point jStart = new Point(partCenter.X, partCenter.Y + delta, partCenter.Z);
            Point jEnd   = new Point(partCenter.X, partCenter.Y - delta, partCenter.Z);

            Inserter.InsertLine(view, jStart, jEnd);

            Point kStart = new Point(partCenter.X, partCenter.Y, partCenter.Z + delta);
            Point kEnd   = new Point(partCenter.X, partCenter.Y, partCenter.Z - delta);

            Inserter.InsertLine(view, kStart, kEnd);
        }
Exemplo n.º 3
0
        public void DrawCenterLines(TsPart tsPart, TsView tsView)
        {
            double scale = tsView.scale;
            double delta = 2 * scale;

            Point o = tsPart.origin;

            CoordinateSystem partCS = tsPart.partCS;

            double width  = tsPart.width;
            double height = tsPart.height;
            double length = tsPart.length;

            var x = new Point(o);
            var y = new Point(o);
            var z = new Point(o);

            var nx = new Point(o);
            var ny = new Point(o);
            var nz = new Point(o);

            Vector rX = Extensions.RoundVector(partCS.AxisX.GetNormal()) * length * 0.5;
            Vector rY = Extensions.RoundVector(partCS.AxisY.GetNormal()) * height * 0.5;
            Vector rZ =
                Extensions.RoundVector(Vector.Cross(partCS.AxisX, partCS.AxisY).GetNormal()) * width * 0.5;

            rX = Extensions.ExtendVector(rX, delta);
            rY = Extensions.ExtendVector(rY, delta);
            rZ = Extensions.ExtendVector(rZ, delta);

            Vector nrX = (-1) * rX;
            Vector nrY = (-1) * rY;
            Vector nrZ = (-1) * rZ;

            x.Translate(rX.X, rX.Y, rX.Z);
            y.Translate(rY.X, rY.Y, rY.Z);
            z.Translate(rZ.X, rZ.Y, rZ.Z);

            nx.Translate(nrX.X, nrX.Y, nrX.Z);
            ny.Translate(nrY.X, nrY.Y, nrY.Z);
            nz.Translate(nrZ.X, nrZ.Y, nrZ.Z);

            ViewBase view = tsView._viewBase;

            Inserter.InsertLine(view, nx, x);
            Inserter.InsertLine(view, ny, y);
            Inserter.InsertLine(view, nz, z);
        }
Exemplo n.º 4
0
 public CenterLinesDrawer(TSD.Part drawingPart, ViewBase viewBase)
 {
     _tsPart = new TsPart(drawingPart);
     _tsView = new TsView(viewBase);
 }