Exemplo n.º 1
0
        private static void SketchItFunc(DesignAutomationData data)
        {
            if (data == null)
            {
                throw new InvalidDataException(nameof(data));
            }

            Application rvtApp = data.RevitApp;

            if (rvtApp == null)
            {
                throw new InvalidDataException(nameof(rvtApp));
            }

            Document newDoc = rvtApp.NewProjectDocument(UnitSystem.Imperial);

            if (newDoc == null)
            {
                throw new InvalidOperationException("Could not create new document.");
            }
            string filePath = "sketchIt.rvt";

            string         filepathJson     = "SketchItInput.json";
            SketchItParams jsonDeserialized = SketchItParams.Parse(filepathJson);

            CreateWalls(jsonDeserialized, newDoc);

            CreateFloors(jsonDeserialized, newDoc);

            newDoc.SaveAs(filePath);
        }