“Ansichtsfenster -Revit -API erstellen” Code-Antworten

Ansichtsfenster -Revit -API erstellen

        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();

                }

            }
        }
Sore Stork

Ansichtsfenster -Revit -API erstellen

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

Ähnliche Antworten wie “Ansichtsfenster -Revit -API erstellen”

Fragen ähnlich wie “Ansichtsfenster -Revit -API erstellen”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen