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


C# Transaction.SetName方法代码示例

本文整理汇总了C#中Transaction.SetName方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.SetName方法的具体用法?C# Transaction.SetName怎么用?C# Transaction.SetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transaction的用法示例。


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

示例1: Import

        /// <summary>
        /// Collect the parameters and import
        /// </summary>
        /// <returns></returns>
        public override bool Import()
        {
            //Import
            Transaction t = new Transaction(m_activeDoc);
            t.SetName("Import");
            t.Start();
            Document doc =m_commandData.Application.Application.OpenBuildingComponentDocument(m_importFileFullName);
            t.Commit();

            return doc == null ? false : true;
        }
开发者ID:AMEE,项目名称:revit,代码行数:15,代码来源:ImportInventorData.cs

示例2: Import

        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Import()
        {
            bool imported = false;

            //parameter: GBXMLImportOptions
            GBXMLImportOptions options = new GBXMLImportOptions();

            //Import
            Transaction t = new Transaction(m_activeDoc);
            t.SetName("Import GBXML");
            t.Start();
            imported = m_activeDoc.Import(m_importFileFullName, options);
            t.Commit();

            return imported;
        }
开发者ID:AMEE,项目名称:revit,代码行数:20,代码来源:ImportGBXMLData.cs

示例3: Import

        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Import()
        {
            bool imported = false;

            //parameter: ImageImportOptions
            ImageImportOptions options = new ImageImportOptions();
            options.Placement = Autodesk.Revit.DB.BoxPlacement.Center;
            //parameter: Element
            Element element = null;

            //Import
            Transaction t = new Transaction(m_activeDoc);
            t.SetName("Import");
            t.Start();
            imported = m_activeDoc.Import(m_importFileFullName, options, CommandData.Application.ActiveUIDocument.Document.ActiveView, out element);
            t.Commit();

            return imported;
        }
开发者ID:timho102003,项目名称:IES_revit_plugin,代码行数:23,代码来源:ImportImageData.cs

示例4: UpdateWhileIdling

            /// <summary>
            /// The idling callback which adds data to the AVF results.
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="e"></param>
            public void UpdateWhileIdling(object sender, IdlingEventArgs e)
            {
                UIApplication uiApp = sender as UIApplication;

                // Get SpatialFieldManager
                SpatialFieldManager sfm = SpatialFieldManager.GetSpatialFieldManager(uiApp.ActiveUIDocument.Document.ActiveView);
                if (sfm == null) sfm = SpatialFieldManager.CreateSpatialFieldManager(uiApp.ActiveUIDocument.Document.ActiveView, 1);

                // If stopping, clear results and unset event.
                if (m_stop)
                {
                    lock (results)
                    {
                        results.Clear();
                    }
                    uiApp.Idling -= UpdateWhileIdling;
                    return;
                }

                // If document was closed and new document opened, do not run the update.
                if (uiApp.ActiveUIDocument.Document.PathName == m_docName)
                {
                    // Lock access to current calculated results
                    lock (results)
                    {
                        if (results.Count == 0) return;

                        // Turn each result to an AVF ValueAtPoint
                        foreach (ResultsData rData in results)
                        {
                            uvPts.Add(new UV(rData.UV.U, rData.UV.V));
                            IList<double> doubleList = new List<double>();
                            doubleList.Add(rData.Value);
                            valList.Add(new ValueAtPoint(doubleList));
                        }
                        FieldDomainPointsByUV pntsByUV = new FieldDomainPointsByUV(uvPts);
                        FieldValues fieldValues = new FieldValues(valList);

                        // Update with calculated values
                        Transaction t = new Transaction(uiApp.ActiveUIDocument.Document);
                        t.SetName("AVF");
                        t.Start();
                        if (!m_stop)
                            sfm.UpdateSpatialFieldPrimitive(s_spatialFieldId, pntsByUV, fieldValues);
                        t.Commit();

                        // Clear results already processed.
                        results.Clear();

                        // If no more results to process, remove the idling event
                        if (m_uvToCalculateCount == 0)
                        {
                            uiApp.Idling -= UpdateWhileIdling;
                            s_oldViewId = s_activeViewId;
                            s_oldSpatialFieldId = s_spatialFieldId;
                        }
                    }
                }
            }
开发者ID:AMEE,项目名称:revit,代码行数:64,代码来源:MultithreadedCalculation.cs

示例5: Import

        /// <summary>
        /// Collect the parameters and export
        /// </summary>
        /// <returns></returns>
        public override bool Import()
        {
            bool imported = false;

            //parameter: DWGImportOptions
            DWGImportOptions dwgImportOption = new DWGImportOptions();
            dwgImportOption.ColorMode = m_importColorMode;
            dwgImportOption.CustomScale = m_importCustomScale;
            dwgImportOption.OrientToView = m_importOrientToView;
            dwgImportOption.Placement = m_importPlacement;
            dwgImportOption.ThisViewOnly = m_importThisViewOnly;
            View view = null;
            if (!m_importThisViewOnly)
            {
                view = m_importView;
            }
            else
            {
                view = m_activeDoc.ActiveView;
            }
            dwgImportOption.Unit = m_importUnit;
            dwgImportOption.VisibleLayersOnly = m_importVisibleLayersOnly;

            //parameter: ElementId
            ElementId elementId = null;

            //Import
            Transaction t = new Transaction(m_activeDoc);
            t.SetName("Import");
            t.Start();
            imported = m_activeDoc.Import(m_importFileFullName, dwgImportOption, view, out elementId);
            t.Commit();

            return imported;
        }
开发者ID:AMEE,项目名称:revit,代码行数:39,代码来源:ImportDWGData.cs

示例6: SlopedWallTest

        public static void SlopedWallTest(
            ExternalCommandData revit)
        {
            Document massDoc = revit.Application.Application.NewFamilyDocument(
              @"C:\ProgramData\Autodesk\RAC 2012\Family Templates\English_I\Conceptual Mass\Mass.rft" );

              Transaction transaction = new Transaction( massDoc );
              transaction.SetName( "TEST" );
              transaction.Start();

              ExternalCommandData cdata = revit;
              Autodesk.Revit.ApplicationServices.Application app = revit.Application.Application;
              app = revit.Application.Application;

              // Create one profile
              ReferenceArray ref_ar = new ReferenceArray();

              Autodesk.Revit.DB.XYZ ptA = new XYZ( 0, 0, 0 );
              XYZ ptB = new XYZ( 0, 30, 0 );
              ModelCurve modelcurve = MakeLine( revit.Application, ptA, ptB, massDoc );
              ref_ar.Append( modelcurve.GeometryCurve.Reference );

              ptA = new XYZ( 0, 30, 0 );
              ptB = new XYZ( 2, 30, 0 );
              modelcurve = MakeLine( revit.Application, ptA, ptB, massDoc );
              ref_ar.Append( modelcurve.GeometryCurve.Reference );

              ptA = new XYZ( 2, 30, 0 );
              ptB = new XYZ( 2, 0, 0 );
              modelcurve = MakeLine( revit.Application, ptA, ptB, massDoc );
              ref_ar.Append( modelcurve.GeometryCurve.Reference );

              ptA = new XYZ( 2, 0, 0 );
              ptB = new XYZ( 0, 0, 0 );
              modelcurve = MakeLine( revit.Application, ptA, ptB, massDoc );
              ref_ar.Append( modelcurve.GeometryCurve.Reference );

              // The extrusion form direction
              XYZ direction = new XYZ( -6, 0, 50 );
              Form form = massDoc.FamilyCreate.NewExtrusionForm( true, ref_ar, direction );
              transaction.Commit();

              if( File.Exists( @"C:\TestFamily.rfa" ) )
            File.Delete( @"C:\TestFamily.rfa" );

              massDoc.SaveAs( @"C:\TestFamily.rfa" );

              if( !revit.Application.ActiveUIDocument.Document.LoadFamily( @"C:\TestFamily.rfa" ) )
            throw new Exception( "DID NOT LOAD FAMILY" );

              Family family = null;
              foreach( Element el in new FilteredElementCollector(
              revit.Application.ActiveUIDocument.Document ).WhereElementIsNotElementType().ToElements() )
              {
            if( el is Family )
            {
              if( ( (Family) el ).Name.ToUpper().Trim().StartsWith( "TEST" ) )
            family = (Family) el;
            }
              }

              FamilySymbol fs = null;
              foreach( FamilySymbol sym in family.Symbols )
            fs = sym;

              // Create a family instance.
              revit.Application.ActiveUIDocument.Document.Create.NewFamilyInstance(
              new XYZ( 0, 0, 0 ), fs, revit.Application.ActiveUIDocument.Document.ActiveView.Level,
              StructuralType.NonStructural );

              WallType wallType = null;
              foreach( WallType wt in revit.Application.ActiveUIDocument.Document.WallTypes )
              {
            if( FaceWall.IsWallTypeValidForFaceWall( revit.Application.ActiveUIDocument.Document, wt.Id ) )
            {
              wallType = wt;
              break;
            }
              }

              foreach( Element el in new FilteredElementCollector(
              revit.Application.ActiveUIDocument.Document ).WhereElementIsNotElementType().ToElements() )
              {
            if( el is FamilyInstance )
            {
              if( ( (FamilyInstance) el ).Symbol.Family.Name.ToUpper().StartsWith( "TEST" ) )
              {
            Options options = revit.Application.Application.Create.NewGeometryOptions();
            options.ComputeReferences = true;
            options.View = revit.Application.ActiveUIDocument.Document.ActiveView;
            GeometryElement geoel = el.get_Geometry( options );

            // Attempt to create a slopped wall from the geometry.
            for( int i = 0; i < geoel.Objects.Size; i++ )
            {
              if( geoel.Objects.get_Item( i ) is Solid )
              {
                Solid solid = (Solid) geoel.Objects.get_Item( i );
                for( int j = 0; j < solid.Faces.Size; j++ )
                {
//.........这里部分代码省略.........
开发者ID:sridharbaldava,项目名称:the_building_coder_samples,代码行数:101,代码来源:CmdFaceWall.cs


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