Ejemplo n.º 1
0
        public void Execute(UIApplication a)
        {
            UIDocument uidoc = a.ActiveUIDocument;
            Document   doc   = uidoc.Document;

            Transaction transaction = new Transaction(doc);

            transaction.Start("Draw Line Patterns or Weights");

            DrawLines myThis = new DrawLines();

            myThis._99_DrawLinePatterns(true, false, uidoc);
            transaction.Commit();
            return;
        }
Ejemplo n.º 2
0
        public void myMacro(UIDocument uidoc)
        {
            TaskDialog mainDialog = new TaskDialog("Fun Secrets of Revit Coding!");


//            mainDialog.MainInstruction = "Secret Code in Revit API !";
//            mainDialog.MainContent = "Do you want to be an awesome, all powerful, all knowing Revit API coder?";
//            mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1,"Yes, I do - show me the way!");
//            mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "No, I'm in a comfortable vegetative state.");

//
//           mainDialog.MainInstruction = "You just iterated!";
//            mainDialog.MainContent = "Did you go build-to-test in under 2 seconds?";
//            mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1,"Yes, that was under two seconds!");
//            mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "No, that was more than two seconds.");


            mainDialog.MainInstruction = "Lets do something";
            mainDialog.MainContent     = "Do you want to draw line patterns or line weights?";
            mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Line Patterns");
            mainDialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "Line Weights");

            mainDialog.CommonButtons = TaskDialogCommonButtons.Close;
            mainDialog.DefaultButton = TaskDialogResult.Close;


            Form1 myForm1 = new Form1();

            myForm1.doc = uidoc.Document;
            myForm1.Show();

            return;


            TaskDialogResult tResult = mainDialog.Show();


            bool Yes = true;

            if (TaskDialogResult.CommandLink1 == tResult)
            {
                Yes = true;
            }
            else if (TaskDialogResult.CommandLink2 == tResult)
            {
                Yes = false;
            }
            else
            {
                return;
            }

//            if(Yes)TaskDialog.Show("TaskDialogue", "You are cool.");
//            if(!Yes)TaskDialog.Show("TaskDialogue", "Ignorance is bliss.");
//            if(Yes)TaskDialog.Show("TaskDialogue", "Well done.");
//            if(!Yes)TaskDialog.Show("TaskDialogue", "Practice makes perfect.");

            Transaction transaction = new Transaction(uidoc.Document);

            transaction.Start("Draw Line Patterns or Weights");

            DrawLines myThis = new DrawLines();

            if (Yes)
            {
                myThis._99_DrawLinePatterns(true, false, uidoc);
            }
            if (!Yes)
            {
                myThis._99_DrawLinePatterns(false, false, uidoc);
            }

            transaction.Commit();

            //use relative paths there is no need to figure out a directly structure, you can leave development modules exactly where you revit made them (there is no need to move them with relative paths)
            //there is no need to restart revit to install an addin, ther is no need to find a special directly for addin as opposed to macros (they are the same thing)
            //use relative path in the addin and there is no need to ever move it
            //use InvokeMember to run rapid iteration, because everytime you want to use the btton you have to restart revit which is annoying expective if you have a massive project open, because previously that is a secrete becaues usually a restart of revit is required if a assembly changed
            //any change to the revit db requires transactions

            //then i am going to sequence you through the normal range or error messages which revit throws up, and how to deal with them


            //this isn't project specfic to but always for rapid iteration /* */
            //IExternalCommand modess less commands need to be external evetns

            //put crashes inside try catch statements to avoid crashes, i will demonstartate that now
            //use addin file
            //keep actions commit stateents
        }