示例#1
0
        public static void CmdASTRAMemberLoad(vdDocument document)
        {
            gPoint EPT, SPT;

            document.Prompt("Start Point:");
            object ret = document.ActionUtility.getUserPoint();

            document.Prompt(null);
            if (ret == null || !(ret is gPoint))
            {
                return;
            }
            SPT = ret as gPoint;

            ActionASTRAMemberLoad aFig = new ActionASTRAMemberLoad(SPT, document.ActiveLayOut);

            document.Prompt("End Point :");

            document.ActionAdd(aFig);
            StatusCode scode = aFig.WaitToFinish();

            document.Prompt(null);
            if (scode != VectorDraw.Actions.StatusCode.Success)
            {
                return;
            }

            EPT = aFig.Value as gPoint;



            vdLine line1 = new vdLine();

            line1.SetUnRegisterDocument(document);
            line1.setDocumentDefaults();
            line1.StartPoint = SPT;
            line1.EndPoint   = EPT;
            document.ActiveLayOut.Entities.AddItem(line1);

            vdLine line2 = new vdLine();

            line2.SetUnRegisterDocument(document);
            line2.setDocumentDefaults();
            line2.StartPoint = new gPoint(SPT.x, SPT.y - 1, SPT.z);
            line2.EndPoint   = new gPoint(EPT.x, EPT.y - 1, EPT.z);
            document.ActiveLayOut.Entities.AddItem(line2);


            ASTRAMemberLoad aline = new ASTRAMemberLoad();

            document.ActionLayout.Entities.AddItem(aline);
            document.UndoHistory.PushEnable(false);
            aline.InitializeProperties();
            aline.setDocumentDefaults();
            aline.StartPoint = line2.StartPoint;
            aline.EndPoint   = line1.StartPoint;
            aline.arrowSize  = 0.3;
            aline.Transformby(document.User2WorldMatrix);
            document.UndoHistory.PopEnable();
            document.ActionDrawFigure(aline);


            double ll = ((line1.Length() / 5.0d) / line1.Length());
            double sx, sy, sz;
            double ex, ey, ez;

            sx = sy = sz = 0.0d;
            for (int j = 1; j <= 5; j++)
            {
                ASTRAMemberLoad aline1 = new ASTRAMemberLoad();
                document.ActionLayout.Entities.AddItem(aline1);
                document.UndoHistory.PushEnable(false);
                aline1.InitializeProperties();
                aline1.setDocumentDefaults();
                aline1.arrowSize = 0.3;

                sx = (j * ll) * (line2.EndPoint.x - line2.StartPoint.x) + line2.StartPoint.x;
                sy = (j * ll) * (line2.EndPoint.y - line2.StartPoint.y) + line2.StartPoint.y;
                sz = (j * ll) * (line2.EndPoint.z - line2.StartPoint.z) + line2.StartPoint.z;

                aline1.StartPoint = new gPoint(sx, sy, sz);

                ex = (j * ll) * (line1.EndPoint.x - line1.StartPoint.x) + line1.StartPoint.x;
                ey = (j * ll) * (line1.EndPoint.y - line1.StartPoint.y) + line1.StartPoint.y;
                ez = (j * ll) * (line1.EndPoint.z - line1.StartPoint.z) + line1.StartPoint.z;

                aline1.EndPoint = new gPoint(ex, ey, ez);
                aline1.Transformby(document.User2WorldMatrix);
                document.UndoHistory.PopEnable();
                document.ActionDrawFigure(aline);
            }
            document.Redraw(true);
        }
示例#2
0
        public static void CmdASTRAMemberLoad1(vdDocument document)
        {
            gPoint EPT, SPT;

            document.Prompt("Start Point:");
            object ret = document.ActionUtility.getUserPoint();

            document.Prompt(null);
            if (ret == null || !(ret is gPoint))
            {
                return;
            }
            SPT = ret as gPoint;

            ActionASTRAMemberLoad aFig = new ActionASTRAMemberLoad(SPT, document.ActiveLayOut);

            document.Prompt("End Point :");

            document.ActionAdd(aFig);
            StatusCode scode = aFig.WaitToFinish();

            document.Prompt(null);
            if (scode != VectorDraw.Actions.StatusCode.Success)
            {
                return;
            }

            EPT = aFig.Value as gPoint;



            vdLine line1 = new vdLine();

            line1.SetUnRegisterDocument(document);
            line1.setDocumentDefaults();
            line1.StartPoint = SPT;
            line1.EndPoint   = EPT;
            document.ActiveLayOut.Entities.AddItem(line1);

            vdLine line2 = new vdLine();

            line2.SetUnRegisterDocument(document);
            line2.setDocumentDefaults();
            line2.StartPoint = new gPoint(SPT.x, SPT.y - 1, SPT.z);
            line2.EndPoint   = new gPoint(EPT.x, EPT.y - 1, EPT.z);
            document.ActiveLayOut.Entities.AddItem(line2);


            ASTRAMemberLoad aline = new ASTRAMemberLoad();

            document.ActionLayout.Entities.AddItem(aline);
            document.UndoHistory.PushEnable(false);
            aline.InitializeProperties();
            aline.setDocumentDefaults();
            aline.StartPoint = line1.StartPoint;
            aline.EndPoint   = line2.StartPoint;
            aline.arrowSize  = 0.3;
            aline.Transformby(document.User2WorldMatrix);
            document.UndoHistory.PopEnable();
            document.ActionDrawFigure(aline);

            ASTRAMemberLoad aline1 = new ASTRAMemberLoad();

            document.ActionLayout.Entities.AddItem(aline1);
            document.UndoHistory.PushEnable(false);
            aline1.InitializeProperties();
            aline1.setDocumentDefaults();
            aline1.arrowSize  = 0.3;
            aline1.StartPoint = line1.EndPoint;
            aline1.EndPoint   = line2.EndPoint;
            aline1.Transformby(document.User2WorldMatrix);
            document.UndoHistory.PopEnable();
            document.ActionDrawFigure(aline);

            document.Redraw(true);
        }