Buckets:
kuklev9797/revit-ckpts / assets /samples /Samples /ExternalCommand /CS /ExternalCommandRegistration /ExternalCommandClass.cs
| // | |
| // (C) Copyright 2003-2019 by Autodesk, Inc. | |
| // | |
| // Permission to use, copy, modify, and distribute this software in | |
| // object code form for any purpose and without fee is hereby granted, | |
| // provided that the above copyright notice appears in all copies and | |
| // that both that copyright notice and the limited warranty and | |
| // restricted rights notice below appear in all supporting | |
| // documentation. | |
| // | |
| // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. | |
| // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF | |
| // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. | |
| // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE | |
| // UNINTERRUPTED OR ERROR FREE. | |
| // | |
| // Use, duplication, or disclosure by the U.S. Government is subject to | |
| // restrictions set forth in FAR 52.227-19 (Commercial Computer | |
| // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) | |
| // (Rights in Technical Data and Computer Software), as applicable. | |
| // | |
| using System.Collections.Generic; | |
| using Autodesk.Revit.UI; | |
| using Autodesk.Revit.DB; | |
| using TaskDialog = Autodesk.Revit.UI.TaskDialog; | |
| namespace Revit.SDK.Samples.ExternalCommandRegistration.CS | |
| { | |
| /// <summary> | |
| /// Implements the Revit add-in interface IExternalCommand, create a wall | |
| /// </summary> | |
| [] | |
| [] | |
| [] | |
| public class ExternalCommandCreateWall : IExternalCommand | |
| { | |
| public Result Execute(ExternalCommandData commandData, | |
| ref string message, Autodesk.Revit.DB.ElementSet elements) | |
| { | |
| Transaction trans = new Transaction(commandData.Application.ActiveUIDocument.Document, "Revit.SDK.Samples.ExternalCommandRegistration"); | |
| trans.Start(); | |
| UIDocument uiDoc = commandData.Application.ActiveUIDocument; | |
| Autodesk.Revit.Creation.Application creApp = uiDoc.Document.Application.Create; | |
| Autodesk.Revit.Creation.Document creDoc = uiDoc.Document.Create; | |
| List<Curve> curves = new List<Curve>(); | |
| //create rectangular curve: wall length: 60 , wall width: 40 | |
| Line line1 = Line.CreateBound(new Autodesk.Revit.DB.XYZ(0, 0, 0), | |
| new Autodesk.Revit.DB.XYZ(0, 60, 0)); | |
| Line line2 = Line.CreateBound(new Autodesk.Revit.DB.XYZ(0, 60, 0), | |
| new Autodesk.Revit.DB.XYZ(0, 60, 40)); | |
| Line line3 = Line.CreateBound(new Autodesk.Revit.DB.XYZ(0, 60, 40), | |
| new Autodesk.Revit.DB.XYZ(0, 0, 40)); | |
| Line line4 = Line.CreateBound(new Autodesk.Revit.DB.XYZ(0, 0, 40), | |
| new Autodesk.Revit.DB.XYZ(0, 0, 0)); | |
| curves.Add(line1); | |
| curves.Add(line2); | |
| curves.Add(line3); | |
| curves.Add(line4); | |
| //create wall | |
| Wall.Create(uiDoc.Document, curves, false); | |
| trans.Commit(); | |
| return Autodesk.Revit.UI.Result.Succeeded; | |
| } | |
| }; | |
| /// <summary> | |
| /// Implements the Revit add-in interface IExternalCommand, show a message box | |
| /// </summary> | |
| [] | |
| [] | |
| public class ExternalCommand3DView : IExternalCommand | |
| { | |
| public Result Execute(ExternalCommandData commandData, | |
| ref string message, Autodesk.Revit.DB.ElementSet elements) | |
| { | |
| TaskDialog.Show("External Command Registration Sample", "Hello, 3D View!"); | |
| return Autodesk.Revit.UI.Result.Succeeded; | |
| } | |
| }; | |
| /// <summary> | |
| /// Implements the Revit add-in interface IExternalApplication, | |
| /// show message box when Revit start up and shut down | |
| /// </summary> | |
| [] | |
| public class ExternalApplicationClass : IExternalApplication | |
| { | |
| public Result OnStartup(UIControlledApplication application) | |
| { | |
| TaskDialog.Show("External command Registration Sample", "Revit is starting up."); | |
| return Result.Succeeded; | |
| } | |
| public Result OnShutdown(UIControlledApplication application) | |
| { | |
| TaskDialog.Show("External command Registration Sample", "Revit is shutting down."); | |
| return Result.Succeeded; | |
| } | |
| }; | |
| } | |
Xet Storage Details
- Size:
- 4.93 kB
- Xet hash:
- 52a2f4c07f1d06bb5fd154cc2bad68ec5cedd80a62eb06dd3fe89051e75a5003
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.