Revit SDK 内容摘要: 8.0 -8.1

前提

不包含已单独写博客部分。

Revit SDK Samples

8.0

AnalyticalViewer
分析模型,VB,略。

namespace Autodesk.Revit.DB.Structure
{
    public class AnalyticalModel : Element
    {
        public AnalyticalRigidLinksOption RigidLinksOption { get; set; }
        public void Approximate(bool enableApproximation);
        public bool CanApproximate();
        public bool CanDisableAutoDetect(AnalyticalDirection direction);
        public bool CanHaveRigidLinks();
        public bool CanUseHardPoints();
        public void CloneAdjustment(AnalyticalModel source, int end);
        public void Disconnect(AnalyticalElementSelector selector);
        public void Enable(bool enable);
        public void EnableAutoDetect(AnalyticalDirection direction, bool enabled);
        public IList<AnalyticalModelSketchComponent> GetAnalyticalModelSketchComponents();
        public IList<AnalyticalModelSupport> GetAnalyticalModelSupports();
        public AnalyzeAs GetAnalyzeAs();
        public double GetApproximationDeviation();
        public ICollection<ElementId> GetAutoDetectMatchedElements(AnalyticalDirection direction);
        public Curve GetCurve();
        public IList<Curve> GetCurves(AnalyticalCurveType curveType);
        public ElementId GetElementId();
        public Transform GetLocalCoordinateSystem();
        public ICollection<ElementId> GetManualAdjustmentMatchedElements();
        public XYZ GetOffset(AnalyticalElementSelector selector);
        public XYZ GetPoint();
        public Reference GetReference(AnalyticalModelSelector selector);
        public Curve GetRigidLink(AnalyticalModelSelector selector);
        public bool HasDeletedLinks();
        public bool HasRigidLinksWith(ElementId neighborId);
        public bool IsAnalyzeAsValid(AnalyzeAs analyzeAs);
        public bool IsApproximated();
        public bool IsAutoDetectEnabled(AnalyticalDirection direction);
        public bool IsElementFullySupported();
        public bool IsEnabled();
        public bool IsManuallyAdjusted();
        public bool IsModified();
        public bool IsSingleCurve();
        public bool IsSinglePoint();
        public bool IsValidDirectionForAutoDetect(AnalyticalDirection direction);
        public bool IsValidForManualAdjustment(Reference reference);
        public bool IsValidManualAdjustmentSource(Reference source, AnalyticalDirection adjustmentDirection);
        public bool IsValidManualAdjustmentTarget(Reference target, Reference source, AnalyticalDirection direction);
        public bool IsValidRigidLinksOption(AnalyticalRigidLinksOption rigidLinksOption);
        public bool IsValidSelector(AnalyticalModelSelector selector);
        public bool ManuallyAdjust(Reference source, Reference target);
        public void ResetLinks();
        public bool ResetManualAdjustment();
        public void SetAnalyzeAs(AnalyzeAs analyzeAs);
        public void SetApproximationDeviation(double deviation);
        public void SetOffset(AnalyticalElementSelector selector, XYZ offset);
        public void SetUsesHardPoints(bool hardPoints);
        public bool SupportsManualAdjustment();
        public bool UsesHardPoints();
    }
}

ArchSample
导出文档信息到Excel。

BrowseBindings
VB.略。

CreateShared
创建共享参数,略。

ElementViewer
FireRating
PhysicalProp
RevitViewer
RoomViewer
查询设计参数,略。

MoveLinear
设置位置线,改变位置。

Autodesk.Revit.DB.LocationCurve lineLoc;
lineLoc = element.Location as LocationCurve;
Autodesk.Revit.DB.Line line;
Autodesk.Revit.DB.XYZ newStart = new XYZ(
                        lineLoc.Curve.GetEndPoint(0).X + 100,
                        lineLoc.Curve.GetEndPoint(0).Y,
                        lineLoc.Curve.GetEndPoint(0).Z);
Autodesk.Revit.DB.XYZ newEnd = new XYZ(
                        lineLoc.Curve.GetEndPoint(1).X,
                        lineLoc.Curve.GetEndPoint(1).Y + 100,
                        lineLoc.Curve.GetEndPoint(1).Z);
line = Line.CreateBound(newStart, newEnd);
lineLoc.Curve = line;

RevitCommands
通过 UIApplication::PostCommand 触发和UI一样的命令。

StructSample
创建柱子等结构元素。

TypeSelector
VB,略。根据类型选择元素。

8.1

DeckProperties
参考 Revit SDK 介绍:CompoundStructure 复合结构

HelloRevit
Hello World,略。

InvisibleParam
设置参数可见性:

//cache application handle
Application revitApp = commandData.Application.Application;
//prepare shared parameter file
commandData.Application.Application.SharedParametersFilename = newPath;

//Open shared parameter file
DefinitionFile parafile = revitApp.OpenSharedParameterFile();

//get walls category
Category wallCat = commandData.Application.ActiveUIDocument.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Walls);
CategorySet categories = revitApp.Create.NewCategorySet();
categories.Insert(wallCat);

InstanceBinding binding = revitApp.Create.NewInstanceBinding(categories);

//Create a group
DefinitionGroup apiGroup = parafile.Groups.Create("APIGroup");

//Create a visible "VisibleParam" of text type.
ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions1 = new ExternalDefinitionCreationOptions("VisibleParam", ParameterType.Text);
Definition visibleParamDef = apiGroup.Definitions.Create
    (ExternalDefinitionCreationOptions1);
        ;
        BindingMap bindingMap = commandData.Application.ActiveUIDocument.Document.ParameterBindings;
bindingMap.Insert(visibleParamDef, binding);

//Create a invisible "InvisibleParam" of text type.
ExternalDefinitionCreationOptions ExternalDefinitionCreationOptions2 = new ExternalDefinitionCreationOptions("InvisibleParam", ParameterType.Text);
ExternalDefinitionCreationOptions2.Visible = false;
Definition invisibleParamDef = apiGroup.Definitions.Create
    (ExternalDefinitionCreationOptions2);
bindingMap.Insert(invisibleParamDef, binding);

ParameterUtils
获取参数,略。

SpanDirection

Floor floor = flr;
String spanDirAngle = "Span direction angle: " + floor.SpanDirectionAngle.ToString() + "\r\n";

// get span direction symbols of Floor(Slab)
String symbols = "Span direction symbols: \r\n\t";
System.Collections.Generic.ICollection<ElementId> symbolArray = floor.GetSpanDirectionSymbolIds();
foreach (ElementId eid in symbolArray){
   Element elem = m_docment.GetElement(eid);
   if (elem != null) {
      symbols += (m_docment.GetElement(elem.GetTypeId()) as ElementType).Name + "\r\n";
   }
}

你可能感兴趣的:(Revit,SDK,介绍,C#)