Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

create viewport revit api

        public static void MoveViewOnSheet(View view, Sheet sheet, Document doc)
        {
            var revitView = doc.GetElement(view.ElementID) as ViewPlan;
            var revitSheet = doc.GetElement(sheet.ElementID) as ViewSheet;


            // Get all viewports
            foreach (Viewport vp in (new FilteredElementCollector(doc).OfClass(typeof(Viewport))))
            {
                // Get those viewport which matches the viewid
                if (vp.ViewId.ToString().Contains(revitView.Id.ToString()))
                {
                    // Delete the viewport
                    using (Transaction transaction = new Transaction(doc, "Remove viewport"))
                    {
                        
                            transaction.Start();
                             doc.Delete(vp.Id);
                            transaction.Commit();


                    }
                }
            }


            // Map the view on sheet
            using (Transaction transaction = new Transaction(doc, "Mapping views on sheet"))
            {
                
                if (Viewport.CanAddViewToSheet(doc, revitSheet.Id, revitView.Id))
                {

                    transaction.Start();
                    Viewport.Create(doc, revitSheet.Id, revitView.Id, XYZ.Zero);
                    transaction.Commit();

                }

            }
        }
Comment

create viewport revit api

 Autodesk.Revit.DB.Viewport.Create(
    Document, viewSheet.Id, View.Id, zero );
Comment

PREVIOUS NEXT
Code Example
Csharp :: changing color of material of renderer with multiple materias 
Csharp :: c# dubble comment 
Csharp :: c# label continue in new line 
Csharp :: how to use external resource.resx file in c# 
Csharp :: Nested objects with linq expression 
Csharp :: Acrylic UWP Title bar C# 
Csharp :: c# functions 
Csharp :: translate nicely between two vector3 
Csharp :: how to make infinite loop in c# 
Csharp :: c# reflection 
Csharp :: using c# 
Csharp :: c# Add or Concatenate Strings In C# 
Csharp :: unity NetworkBehaviour the type or namespace could not be found 
Csharp :: unity new input system get button down 
Csharp :: get index of item unity 
Csharp :: c# get pixel from bitmap click 
Csharp :: how to add colider in obj in unity 2020 
Csharp :: c# convert ad objectguid to string 
Csharp :: wpf scoll to on new item datagrtid 
Html :: html rupee symbol 
Html :: ml5 cdn 
Html :: accept only image input file 
Html :: html chevron 
Html :: jquery $ is not defined 
Html :: html input type file accept text and word files 
Html :: how to link html pages in different folders 
Html :: html lien 
Html :: meta redirect header 
Html :: html skype chat link 
Html :: markdown new page break 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =