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


C# FamilyInstance类代码示例

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


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

示例1: GetWindowDirection

        /// <summary>
        /// Obtains the facing direction of the window.
        /// </summary>
        /// <param name="wall">The window.</param>
        /// <returns>A normalized XYZ direction vector.</returns>
        protected XYZ GetWindowDirection(FamilyInstance window)
        {
            Options options = new Options();

            // Extract the geometry of the window.
            GeometryElement geomElem = window.get_Geometry(options);

            foreach (GeometryObject geomObj in geomElem.Objects)
            {
                // We expect there to be one main Instance in each window.  Ignore the rest of the geometry.
                GeometryInstance instance = geomObj as GeometryInstance;
                if (instance != null)
                {
                    // Obtain the Instance's transform and the nominal facing direction (Y-direction).
                    Transform t = instance.Transform;
                    XYZ facingDirection = t.BasisY;

                    // If the window is flipped in one direction, but not the other, the transform is left handed.
                    // The Y direction needs to be reversed to obtain the facing direction.
                    if ((window.FacingFlipped && !window.HandFlipped) || (!window.FacingFlipped && window.HandFlipped))
                        facingDirection = -facingDirection;

                    // Because the need to perform this operation on instances is so common,
                    // the Revit API exposes this calculation directly as the FacingOrientation property
                    // as shown in GetWindowDirectionAlternate()

                    return facingDirection;
                }
            }
            return XYZ.BasisZ;
        }
开发者ID:AMEE,项目名称:revit,代码行数:36,代码来源:FindSouthFacingWindows.cs

示例2: GetFamilyParameter

        /// <summary>
        /// Returns a reference to the FAMILY parameter (as a simple Parameter data type) on the given instance
        /// for the parameter with the given name.  Will return the parameter
        /// whether it is an instance or type parameter.
        /// Returns null if no parameter on the instance was found.
        /// </summary>
        /// <param name="nestedFamilyInstance">An instance of a nested family file</param>
        /// <param name="parameterName">The name of the desired parameter to get a reference to</param>
        /// <remarks>
        /// Even though the data type returned is the more generic Parameter type, it will
        /// actually be for the data of the internal FamilyParameter object.
        /// </remarks>
        /// <returns></returns>
        public static Parameter GetFamilyParameter(
            FamilyInstance nestedFamilyInstance,
            string parameterName)
        {
            // Following good SOA practices, verify the
              // incoming parameters before attempting to proceed.

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

              if( string.IsNullOrEmpty( parameterName ) )
              {
            throw new ArgumentNullException(
              "parameterName" );
              }

              Parameter oResult = null;

              //See if the parameter is an Instance parameter
              oResult = nestedFamilyInstance.get_Parameter(
            parameterName );

              // No?  See if it's a Type parameter
              if( oResult == null )
              {
            oResult = nestedFamilyInstance.Symbol.get_Parameter(
              parameterName );
              }
              return oResult;
        }
开发者ID:JesseMom,项目名称:the_building_coder_samples,代码行数:46,代码来源:CmdNestedFamilies.cs

示例3: ProfileBeam

        Matrix4 m_MatrixZaxis = null; //transform points to plane whose normal is Zaxis of beam

        #endregion Fields

        #region Constructors

        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="beam">beam to create opening on</param>
        /// <param name="commandData">object which contains reference to Revit Application</param>
        public ProfileBeam(FamilyInstance beam, ExternalCommandData commandData)
            : base(commandData)
        {
            m_data = beam;
            List<List<Edge>> faces = GetFaces(m_data);
            m_points = GetNeedPoints(faces);
            m_to2DMatrix = GetTo2DMatrix();
            m_moveToCenterMatrix = ToCenterMatrix();
        }
开发者ID:AMEE,项目名称:revit,代码行数:20,代码来源:ProfileBeam.cs

示例4: ColumnFramReinMaker

        RebarBarType m_verticalType = null; //type of the vertical rebar

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor of the ColumnFramReinMaker
        /// </summary>
        /// <param name="commandData">the ExternalCommandData reference</param>
        /// <param name="hostObject">the host column</param>
        public ColumnFramReinMaker(ExternalCommandData commandData, FamilyInstance hostObject)
            : base(commandData, hostObject)
        {
            //create a new options for current project
             Options geoOptions = commandData.Application.Application.Create.NewGeometryOptions();
             geoOptions.ComputeReferences = true;

             //create a ColumnGeometrySupport instance
             m_geometry = new ColumnGeometrySupport(hostObject, geoOptions);
        }
开发者ID:AMEE,项目名称:revit,代码行数:21,代码来源:ColumnFramReinMaker.cs

示例5: Beacon

 /*
  * Initialize beacon object from FamilyInstance and LocationPoint
  *
  */
 public Beacon(FamilyInstance fi, LocationPoint lp)
 {
     this.categoryName = fi.Category.Name;
     this.beaconType = fi.Name;
     this.elementId = fi.Id;
     // Stores as feet internally so convert to meters
     this.xLoc = Utilities.feetToMeters(lp.Point.X);
     this.yLoc = Utilities.feetToMeters(lp.Point.Y);
     this.zLoc = Utilities.feetToMeters(lp.Point.Z);
 }
开发者ID:chipyaya,项目名称:IES_revit_plugin,代码行数:14,代码来源:Beacon.cs

示例6: GetComponentDataJson

        /// <summary>
        /// Retrieve the family instance data to store in 
        /// the external database for the given component
        /// and return it as a dictionary in a JSON 
        /// formatted string.
        /// Obsolete, replaced by GetInstanceData method.
        /// </summary>
        string GetComponentDataJson(
            FamilyInstance a,
            Transform geoTransform)
        {
            Document doc = a.Document;
              FamilySymbol symbol = a.Symbol;

              XYZ location = Util.GetLocation( a );

              XYZ geolocation = geoTransform.OfPoint(
            location );

              string properties = Util.GetPropertiesJson(
            a.GetOrderedParameters() );

              // /a/src/web/CompHoundWeb/model/instance.js
              // _id         : UniqueId // suppress automatic generation
              // project    : String
              // path       : String
              // family     : String
              // symbol     : String
              // level      : String
              // x          : Number
              // y          : Number
              // z          : Number
              // easting    : Number // Geo2d?
              // northing   : Number
              // properties : String // json dictionary of instance properties and values

              string s = string.Format(
            "\"_id\": \"{0}\", "
            + "\"project\": \"{1}\", "
            + "\"path\": \"{2}\", "
            + "\"family\": \"{3}\", "
            + "\"symbol\": \"{4}\", "
            + "\"level\": \"{5}\", "
            + "\"x\": \"{6}\", "
            + "\"y\": \"{7}\", "
            + "\"z\": \"{8}\", "
            + "\"easting\": \"{9}\", "
            + "\"northing\": \"{10}\", "
            + "\"properties\": \"{11}\"",
            a.UniqueId, doc.Title, doc.PathName,
            symbol.FamilyName, symbol.Name,
            doc.GetElement( a.LevelId ).Name,
            Util.RealString( location.X ),
            Util.RealString( location.Y ),
            Util.RealString( location.Z ),
            Util.RealString( geolocation.X ),
            Util.RealString( geolocation.Y ),
            properties );

              return "{" + s + "}";
        }
开发者ID:CompHound,项目名称:CompHoundInv,代码行数:61,代码来源:Command.cs

示例7: Recognization

 public override bool Recognization(FamilyInstance fi)
 {
     _fi = fi;
     if (TryGetFIFloor(_doc))
     {
         --_floor;
         if (_floor < 0) return false;
         else return true;
     }
     else return false;
 }
开发者ID:Xiang-Zeng,项目名称:P58_Loss,代码行数:11,代码来源:PFireSprinkler.cs

示例8: CorbelFrame

        /// <summary>
        /// Constructor to initialize the fields.
        /// </summary>
        /// <param name="corbel">Corbel family instance</param>
        /// <param name="profile">Trapezoid profile</param>
        /// <param name="path">Extrusion Line</param>
        /// <param name="hostDepth">Corbel Host Depth</param>
        /// <param name="hostTopCorverDistance">Corbel Host cover distance</param>
        public CorbelFrame(FamilyInstance corbel, Trapezoid profile,
                Line path, double hostDepth, double hostTopCorverDistance)
        {
            m_profile = profile;
            m_extrusionLine = path;
            m_corbel = corbel;
            m_hostDepth = hostDepth;
            m_hostCoverDistance = hostTopCorverDistance;

            // Get the cover distance of corbel from CommonCoverType.
            RebarHostData rebarHost = RebarHostData.GetRebarHostData(m_corbel);
            m_corbelCoverDistance = rebarHost.GetCommonCoverType().CoverDistance;
        }
开发者ID:AMEE,项目名称:revit,代码行数:21,代码来源:CorbelFrame.cs

示例9: JtPlacement2dInt

    public JtPlacement2dInt( FamilyInstance fi )
    {
      LocationPoint lp = fi.Location as LocationPoint;

      Debug.Assert( null != lp,
        "expected valid family instanace location point" );

      Translation = new Point2dInt( lp.Point );

      Rotation = Util.ConvertRadiansToDegrees( lp.Rotation );

      SymbolId = fi.Symbol.UniqueId;
    }
开发者ID:mtumminello,项目名称:RoomEditorApp,代码行数:13,代码来源:JtPlacement2dInt.cs

示例10: ColumnGeometrySupport

        double m_columnWidth; //the width of the column

        #endregion Fields

        #region Constructors

        /// <summary>
        /// constructor for the ColumnGeometrySupport
        /// </summary>
        /// <param name="element">the column which the rebars are placed on</param>
        /// <param name="geoOptions">the geometry option</param>
        public ColumnGeometrySupport(FamilyInstance element, Options geoOptions)
            : base(element, geoOptions)
        {
            // assert the host element is a column
            if (!element.StructuralType.Equals(StructuralType.Column))
            {
                throw new Exception("ColumnGeometrySupport can only work for column instance.");
            }

            // Get the length, width and height of the column.
            m_columnHeight = GetDrivingLineLength();
            m_columnLength = GetColumnLength();
            m_columnWidth = GetColumnWidth();
        }
开发者ID:AMEE,项目名称:revit,代码行数:25,代码来源:ColumnGeometrySupport.cs

示例11: BeamGeometrySupport

        double m_beamWidth; //the width of the beam

        #endregion Fields

        #region Constructors

        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="element">the beam which the rebars are placed on</param>
        /// <param name="geoOptions">the geometry option</param>
        public BeamGeometrySupport(FamilyInstance element, Options geoOptions)
            : base(element, geoOptions)
        {
            // assert the host element is a beam
            if (!element.StructuralType.Equals(StructuralType.Beam))
            {
                throw new Exception("BeamGeometrySupport can only work for beam instance.");
            }

            // Get the length, width and height of the beam.
            m_beamLength = GetDrivingLineLength();
            m_beamWidth = GetBeamWidth();
            m_beamHeight = GetBeamHeight();
        }
开发者ID:AMEE,项目名称:revit,代码行数:25,代码来源:BeamGeometrySupport.cs

示例12: LightFixture

        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="e">Accepts generic element (after processing) as input</param>
        public LightFixture(Element e, FamilyInstance fi)
        {
            // Set properties initially based on passed FamilyInstance
            CandlePower = e.get_Parameter(BuiltInParameter.FBX_LIGHT_LIMUNOUS_INTENSITY).AsDouble();
            Lumens = e.get_Parameter(BuiltInParameter.FBX_LIGHT_LIMUNOUS_FLUX).AsDouble();
            Efficacy = e.get_Parameter(BuiltInParameter.FBX_LIGHT_EFFICACY).AsDouble();
            LightLossFactor = e.get_Parameter(BuiltInParameter.FBX_LIGHT_TOTAL_LIGHT_LOSS).AsDouble();
            CoefficientOfUtilization = e.get_Parameter(BuiltInParameter.RBS_ELEC_CALC_COEFFICIENT_UTILIZATION).AsDouble();

            Elevation = fi.get_Parameter(BuiltInParameter.INSTANCE_ELEVATION_PARAM).AsDouble();

            LocationPoint = fi.Location as LocationPoint;

            // Future
            // TODO: Get photometric file and parse IES to provide correct
        }
开发者ID:kmorin,项目名称:LightingAnalysis,代码行数:20,代码来源:LightFixture.cs

示例13: Properties

 /// <summary>
 /// get this family instance's properties to display.
 /// </summary>
 /// <param name="f">a In-Place family instance</param>
 public Properties(FamilyInstance f)
 {
     m_ID = f.Id.IntegerValue;
     m_Name = f.Name;
     m_Family = f.Symbol.Family.Name;
     m_Type = f.Symbol.Name;
     m_StructuralType = f.StructuralType.ToString();
     try
     {
         m_StructuralUsage = f.StructuralUsage.ToString();
     }
     catch(Exception)
     {
         m_StructuralUsage = null;
     }
     m_Material = f.StructuralMaterialType.ToString();
 }
开发者ID:AMEE,项目名称:revit,代码行数:21,代码来源:Properties.cs

示例14: GetFamilyParameter

        /// <summary>
        /// Returns a reference to the FAMILY parameter (as a simple Parameter data type) on the given instance
        /// for the parameter with the given name.  Will return the parameter
        /// whether it is an instance or type parameter.
        /// Returns null if no parameter on the instance was found.
        /// </summary>
        /// <param name="nestedFamilyInstance">An instance of a nested family file</param>
        /// <param name="parameterName">The name of the desired parameter to get a reference to</param>
        /// <remarks>
        /// Even though the data type returned is the more generic Parameter type, it will
        /// actually be for the data of the internal FamilyParameter object.
        /// </remarks>
        /// <returns></returns>
        public static Parameter GetFamilyParameter(
            FamilyInstance nestedFamilyInstance,
            string parameterName)
        {
            // Following good SOA practices, verify the
              // incoming parameters before attempting to proceed.

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

              if( string.IsNullOrEmpty( parameterName ) )
              {
            throw new ArgumentNullException(
              "parameterName" );
              }

              Parameter oResult = null;

              // See if the parameter is an Instance parameter

              //oResult = nestedFamilyInstance.get_Parameter( parameterName ); // 2014

              Debug.Assert( 2 > nestedFamilyInstance.GetParameters( parameterName ).Count,
            "ascertain that there are not more than one parameter of the given name" );

              oResult = nestedFamilyInstance.LookupParameter( parameterName ); // 2015

              // No?  See if it's a Type parameter

              if( oResult == null )
              {
            //oResult = nestedFamilyInstance.Symbol.get_Parameter( parameterName ); // 2014

            Debug.Assert( 2 > nestedFamilyInstance.Symbol.GetParameters( parameterName ).Count,
              "ascertain that there are not more than one parameter of the given name" );

            oResult = nestedFamilyInstance.Symbol.LookupParameter( parameterName ); // 2015
              }
              return oResult;
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:56,代码来源:CmdNestedFamilies.cs

示例15: GetGeometryFromInplaceWall

 /// <summary>
 /// Obtains a special snapshot of the geometry of an in-place wall element suitable for export.
 /// </summary>
 /// <param name="famInstWallElem">
 /// The in-place wall instance.
 /// </param>
 /// <returns>
 /// The in-place wall geometry.
 /// </returns>
 static GeometryElement GetGeometryFromInplaceWall(FamilyInstance famInstWallElem)
 {
     return ExporterIFCUtils.GetGeometryFromInplaceWall(famInstWallElem);
 }
开发者ID:whztt07,项目名称:BIM-IFC,代码行数:13,代码来源:WallExporter.cs


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