当前位置: 首页>>代码示例>>C#>>正文


C# Autodesk类代码示例

本文整理汇总了C#中Autodesk的典型用法代码示例。如果您正苦于以下问题:C# Autodesk类的具体用法?C# Autodesk怎么用?C# Autodesk使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Autodesk类属于命名空间,在下文中一共展示了Autodesk类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

 public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
 {
     appRevit = commandData.Application;
     ProcessManager pm = new ProcessManager();
     pm.ReloadImages();
     return Result.Succeeded;
 }
开发者ID:AntonOstanin,项目名称:Revit_ImportImages,代码行数:7,代码来源:Reload.cs

示例2: TestElements

 public TestElements( Autodesk.Revit.UI.UIApplication app )
     : base(app)
 {
     m_testFuncs.Add( new RevitLookupTestFuncInfo( "Windows at 18\" sills", "Change all Windows to have an 18\" sill height", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( WindowSill_18 ), RevitLookupTestFuncInfo.TestType.Modify ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Center Windows Vertically", "Change all Windows to be centered in the wall", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( WindowCenterVertical ), RevitLookupTestFuncInfo.TestType.Modify ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Parameter Enum Mapping", "Show enum -> param name mapping", "Enum Mappings", new RevitLookupTestFuncInfo.TestFunc( ParameterEnums ), RevitLookupTestFuncInfo.TestType.Other ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Parameter Enum Mapping (no duplicates)", "Show enum -> param name mapping", "Enum Mappings", new RevitLookupTestFuncInfo.TestFunc( ParameterEnumsNoDups ), RevitLookupTestFuncInfo.TestType.Other ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Category Enum Mapping", "Show enum -> category name mapping", "Enum Mappings", new RevitLookupTestFuncInfo.TestFunc( CategoryEnums ), RevitLookupTestFuncInfo.TestType.Other ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Simple Wall", "Create a hardwired wall", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( SimpleWall ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Simple Floor", "Add a floor for the selected walls", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( SimpleFloor ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Hardwired Shed", "Create some hardwired walls, floors, windows and doors", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( SimpleShed ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Swap Family", "Swap any door with a double door", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( SimpleSwap ), RevitLookupTestFuncInfo.TestType.Modify ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Level Iteration", "Iterate over levels and change floor to floor height", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( SimpleLevelIteration ), RevitLookupTestFuncInfo.TestType.Modify ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Hardwired Classroom", "Create curtain walls, door and furniture", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( ClassRoom ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Flip element(s)", "Rotates element(s) by 180 degrees", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( Flip ), RevitLookupTestFuncInfo.TestType.Modify ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Mirror", "Mirrors selected elements along X axis (Draw above X Axis)", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( Mirror ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Annotation Symbol", "Creates a new annotation symbol", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( AnnoSymbol ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Beam System", "Creates a hardwired beam system", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( BeamSystemHardWired ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Detail Curves", "Creates hardwired detail curves", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( DetailCurveHardWired ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Dimension", "Creates hardwired lines and a dimension for their distance", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( DimensionHardWired ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Foundation Slab", "Creates a hardwired foundation slab", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( FoundationSlabHardWired ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Text Note", "Creates a hardwired text note", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( TextNoteHardWired ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Simple Slab", "Creates a hardwired slab", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( SimpleSlab ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "View Section", "Creates a view section", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( SimpleViewSection ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "View Plan", "Creates a floor view plan", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( FloorViewPlan ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "View and Sheet Addition", "Adds Floor Plan (Level 1) view to new sheet", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( ViewToNewSheetHardwired ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Simple Tag", "Add a tag to the selected elements", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( SimpleTag ), RevitLookupTestFuncInfo.TestType.Create ) );
       m_testFuncs.Add( new RevitLookupTestFuncInfo( "Update Wall Width", "Update the WallType layer thickness to change the width of the wall.", typeof( Revit.Element ), new RevitLookupTestFuncInfo.TestFunc( ModifyWallWidth ), RevitLookupTestFuncInfo.TestType.Modify ) );
 }
开发者ID:halad,项目名称:RevitLookup,代码行数:29,代码来源:TestElements.cs

示例3: Export

        /// <summary>
        /// Exports a Rebar, AreaReinforcement or PathReinforcement to IFC ReinforcingBar.
        /// </summary>
        /// <param name="exporterIFC">The exporter.</param>
        /// <param name="element">The element.</param>
        /// <param name="filterView">The view.</param>
        /// <param name="productWrapper">The product wrapper.</param>
        public static void Export(ExporterIFC exporterIFC,
            Element element, Autodesk.Revit.DB.View filterView, ProductWrapper productWrapper)
        {
            if (element is Rebar)
            {
                ExportRebar(exporterIFC, element, filterView, productWrapper);
            }
            else if (element is AreaReinforcement)
            {
                AreaReinforcement areaReinforcement = element as AreaReinforcement;
                IList<ElementId> rebarIds = areaReinforcement.GetRebarInSystemIds();

                Document doc = areaReinforcement.Document;
                foreach (ElementId id in rebarIds)
                {
                    Element rebarInSystem = doc.GetElement(id);
                    ExportRebar(exporterIFC, rebarInSystem, filterView, productWrapper);
                }
            }
            else if (element is PathReinforcement)
            {
                PathReinforcement pathReinforcement = element as PathReinforcement;
                IList<ElementId> rebarIds = pathReinforcement.GetRebarInSystemIds();

                Document doc = pathReinforcement.Document;
                foreach (ElementId id in rebarIds)
                {
                    Element rebarInSystem = doc.GetElement(id);
                    ExportRebar(exporterIFC, rebarInSystem, filterView, productWrapper);
                }
            }
        }
开发者ID:stiter,项目名称:ifcexporter,代码行数:39,代码来源:RebarExporter.cs

示例4: Execute

 public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
 {
     string killNameProcess = "Revit";
     Process[] processes = Process.GetProcessesByName(killNameProcess);
     processes.First().Kill();
     return Result.Succeeded;
 }
开发者ID:AntonOstanin,项目名称:Revit_ImportImages,代码行数:7,代码来源:Exit.cs

示例5: OnStartup

 /// <summary>
 /// The method called when Autodesk Revit starts.
 /// </summary>
 /// <param name="application">Controlled application to be loaded to Autodesk Revit process.</param>
 /// <returns>Return the status of the external application.</returns>
 public ExternalDBApplicationResult OnStartup(Autodesk.Revit.ApplicationServices.ControlledApplication application)
 {
     // As an ExternalServer, the exporter cannot be registered until full application initialization. Setup an event callback to do this
     // at the appropriate time.
     application.ApplicationInitialized += OnApplicationInitialized;
     return ExternalDBApplicationResult.Succeeded;
 }
开发者ID:whztt07,项目名称:RevitIFC,代码行数:12,代码来源:Exporter.cs

示例6: Execute

        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application 
        /// which contains data related to the command, 
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application 
        /// which will be displayed if a failure or cancellation is returned by 
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application 
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command. 
        /// A result of Succeeded means that the API external method functioned as expected. 
        /// Cancelled can be used to signify that the user cancelled the external operation 
        /// at some point. Failure should be returned if the application is unable to proceed with 
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData,
            ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            Transaction newTran = null;
            try
            {
                if (null == commandData)
                {
                    throw new ArgumentNullException("commandData");
                }

                Document doc = commandData.Application.ActiveUIDocument.Document;
                ViewsMgr view = new ViewsMgr(doc);

                newTran = new Transaction(doc);
                newTran.Start("AllViews_Sample");

                AllViewsForm dlg = new AllViewsForm(view);

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    view.GenerateSheet(doc);
                }
                newTran.Commit();

                return Autodesk.Revit.UI.Result.Succeeded;
            }
            catch (Exception e)
            {
                message = e.Message;
                if ((newTran != null) && newTran.HasStarted() && !newTran.HasEnded())
                    newTran.RollBack();
                return Autodesk.Revit.UI.Result.Failed;
            }
        }
开发者ID:AMEE,项目名称:revit,代码行数:51,代码来源:AllViews.cs

示例7: CreateFloor

 private static Autodesk.Revit.DB.Floor CreateFloor(IEnumerable<Value> edges, FloorType floorType, Autodesk.Revit.DB.Level level)
 {
     var ca = new CurveArray();
     edges.ToList().ForEach(x => ca.Append((Curve) ((Value.Container) x).Item));
     var floor = dynRevitSettings.Doc.Document.Create.NewFloor(ca, floorType, level, false);
     return floor;
 }
开发者ID:kah-heng,项目名称:Dynamo,代码行数:7,代码来源:Floor.cs

示例8: Execute

        public Result Execute(ExternalCommandData commandData,
         ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            MessageBox.Show("Hello, 3D View!", "External Comand Registration Sample");

             return Autodesk.Revit.UI.Result.Succeeded;
        }
开发者ID:AMEE,项目名称:revit,代码行数:7,代码来源:ExternalCommandClass.cs

示例9: InitRebarBarType

        private void InitRebarBarType(double diameter, Autodesk.Revit.DB.Structure.RebarDeformationType deformationType)
        {
            Autodesk.Revit.DB.Document document = DocumentManager.Instance.CurrentDBDocument;

            TransactionManager.Instance.EnsureInTransaction(document);

            var barTypeElem = ElementBinder.GetElementFromTrace<Autodesk.Revit.DB.Structure.RebarBarType>(document);

            if (barTypeElem == null)
            {
                barTypeElem = Autodesk.Revit.DB.Structure.RebarBarType.Create(document);               
            }

            barTypeElem.BarDiameter = diameter;
            barTypeElem.DeformationType = deformationType;

            TransactionManager.Instance.TransactionTaskDone();


            if (barTypeElem != null)
            {
                ElementBinder.CleanupAndSetElementForTrace(document, this.InternalElement);
            }
            else
            {
                ElementBinder.SetElementForTrace(this.InternalElement);
            }

        }
开发者ID:Thomas84,项目名称:DynamoForRebar,代码行数:29,代码来源:RebarBarType.cs

示例10: Execute

        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application 
        /// which contains data related to the command, 
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application 
        /// which will be displayed if a failure or cancellation is returned by 
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application 
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command. 
        /// A result of Succeeded means that the API external method functioned as expected. 
        /// Cancelled can be used to signify that the user cancelled the external operation 
        /// at some point. Failure should be returned if the application is unable to proceed with 
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
                                             ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
             {
            CoordinateSystemData Data = new CoordinateSystemData(commandData);
            Data.GatData();

            using (CoordinateSystemDataForm displayForm =
                                    new CoordinateSystemDataForm(Data, commandData.Application.Application.Cities,
                                                commandData.Application.ActiveUIDocument.Document.SiteLocation))
            {
               if (DialogResult.OK != displayForm.ShowDialog())
               {
                  return Autodesk.Revit.UI.Result.Cancelled;
               }
            }
            return Autodesk.Revit.UI.Result.Succeeded;
             }
             catch (Exception ex)
             {
            message = ex.Message;
            return Autodesk.Revit.UI.Result.Failed;
             }
        }
开发者ID:AMEE,项目名称:revit,代码行数:41,代码来源:Command.cs

示例11: ByOutlineTypeAndLevel

        /// <summary>
        /// Create a Revit Floor given it's curve outline and Level
        /// </summary>
        /// <param name="outline"></param>
        /// <param name="level"></param>
        /// <returns>The floor</returns>
        public static Floor ByOutlineTypeAndLevel( Autodesk.DesignScript.Geometry.Curve[] outline, FloorType floorType, Level level)
        {
            if (outline == null)
            {
                throw new ArgumentNullException("outline");
            }

            if (floorType == null)
            {
                throw new ArgumentNullException("floorType");
            }

            if ( level == null )
            {
                throw new ArgumentNullException("level");
            }

            if (outline.Count() < 3)
            {
                throw new Exception("Outline must have at least 3 edges to enclose an area.");
            }

            var ca = new CurveArray();
            outline.ToList().ForEach(x => ca.Append(x.ToRevitType()));

            return new Floor(ca, floorType.InternalFloorType, level.InternalLevel );
        }
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:33,代码来源:Floor.cs

示例12: ProximityDetection

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="app">Revit application</param>
 /// <param name="doc">Revit document</param>
 private ProximityDetection(
  Autodesk.Revit.ApplicationServices.Application app, 
  Autodesk.Revit.DB.Document doc)
 {
     m_app = app;
      m_doc = doc;
 }
开发者ID:AMEE,项目名称:revit,代码行数:12,代码来源:ProximityDetection.cs

示例13: DbEvent_ObjectAppened_Handler_AreaLinearCalc

        public void DbEvent_ObjectAppened_Handler_AreaLinearCalc(object sender, Autodesk.AutoCAD.DatabaseServices.ObjectEventArgs e)
        {
            try
            {
                if (e.DBObject is Autodesk.AutoCAD.DatabaseServices.LayerTableRecord)
                {
                    //LufsGenplan.AcadApp.AcaEd.WriteMessage("DEBUG: ObjectAppened sender = " + (e.DBObject as Autodesk.AutoCAD.DatabaseServices.LayerTableRecord).Name +
                    //    " ID = " + (e.DBObject as Autodesk.AutoCAD.DatabaseServices.LayerTableRecord).ObjectId + "\n");

                    cbLayerUse.Items.Add(new AcadUtils.CbAutocadItem((e.DBObject as Autodesk.AutoCAD.DatabaseServices.LayerTableRecord).Name,
                                                    (e.DBObject as Autodesk.AutoCAD.DatabaseServices.LayerTableRecord).ObjectId));
                }
                else if (e.DBObject is Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord)
                {
                    //LufsGenplan.AcadApp.AcaEd.WriteMessage("DEBUG: ObjectAppened sender = " + (e.DBObject as Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord).Name +
                    //    " ID = " + (e.DBObject as Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord).ObjectId + "\n");

                    cbLinetUse.Items.Add(new AcadUtils.CbAutocadItem((e.DBObject as Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord).Name,
                                                    (e.DBObject as Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord).ObjectId));
                }
            }
            catch (Exception ex)
            {
                LufsGenplan.AcadApp.AcaEd.WriteMessage("\nERROR: AreaLinearCalc.DbEvent_ObjectAppened_Handler() " + ex + "\n");
            }
        }
开发者ID:Lufan,项目名称:Genplan2012,代码行数:26,代码来源:AreaLinearCalc.cs

示例14: Execute

        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application 
        /// which contains data related to the command, 
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application 
        /// which will be displayed if a failure or cancellation is returned by 
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application 
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command. 
        /// A result of Succeeded means that the API external method functioned as expected. 
        /// Cancelled can be used to signify that the user cancelled the external operation 
        /// at some point. Failure should be returned if the application is unable to proceed with 
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(Autodesk.Revit.UI.ExternalCommandData commandData,
                                               ref string message,
                                               ElementSet elements)
        {
            // Quit if active document is null
            if (null == commandData.Application.ActiveUIDocument.Document)
            {
                message = "Active document is null.";
                return Autodesk.Revit.UI.Result.Failed;
            }

            try
            {
                FamilyInstanceCreator creator = new FamilyInstanceCreator(commandData.Application);

                // an option dialog for user choosing based type of creating
                BasedTypeForm baseTypeform = new BasedTypeForm();
                if (DialogResult.OK == baseTypeform.ShowDialog())
                {
                    PlaceFamilyInstanceForm placeForm = new PlaceFamilyInstanceForm(creator
                        , baseTypeform.BaseType);
                    placeForm.ShowDialog();
                }

                // if everything goes well, return succeeded.
                return Autodesk.Revit.UI.Result.Succeeded;
            }
            catch (Exception ex)
            {
                // If any error, give error information and return failed
                message = ex.Message;
                return Autodesk.Revit.UI.Result.Failed;
            }
        }
开发者ID:AMEE,项目名称:revit,代码行数:50,代码来源:Command.cs

示例15: Execute

        /// <summary>
        /// Implement this method as an external command for Revit.
        /// </summary>
        /// <param name="commandData">An object that is passed to the external application 
        /// which contains data related to the command, 
        /// such as the application object and active view.</param>
        /// <param name="message">A message that can be set by the external application 
        /// which will be displayed if a failure or cancellation is returned by 
        /// the external command.</param>
        /// <param name="elements">A set of elements to which the external application 
        /// can add elements that are to be highlighted in case of failure or cancellation.</param>
        /// <returns>Return the status of the external command. 
        /// A result of Succeeded means that the API external method functioned as expected. 
        /// Cancelled can be used to signify that the user cancelled the external operation 
        /// at some point. Failure should be returned if the application is unable to proceed with 
        /// the operation.</returns>
        public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData,
        ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
            {
                // Verify active document
                if (null == commandData.Application.ActiveUIDocument.Document)
                {
                    message = "Active view is null.";
                    return Autodesk.Revit.UI.Result.Failed;
                }

                MainData mainData = new MainData(commandData);
                // Show the dialog
                using (MainForm mainForm = new MainForm(mainData))
                {
                    if (mainForm.ShowDialog() == DialogResult.Cancel)
                    {
                        return Autodesk.Revit.UI.Result.Cancelled;
                    }
                }
            }
            catch (Exception ex)
            {
                message = ex.ToString();
                return Autodesk.Revit.UI.Result.Failed;
            }

            return Autodesk.Revit.UI.Result.Succeeded;
        }
开发者ID:AMEE,项目名称:revit,代码行数:46,代码来源:Command.cs


注:本文中的Autodesk类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。