• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# FamilyInstance类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: LinkNestedFamilyParameterToHostFamilyParameter

        /// <summary>
        /// This method takes an instance of a nested family and links a parameter on it to
        /// a parameter on the given host family instance.  This allows a change at the host
        /// level to automatically be sent down and applied to the nested family instance.
        /// </summary>
        /// <param name="hostFamilyDocument">The host family document to have one of its parameters be linked to a parameter on the given nested family instance</param>
        /// <param name="nestedFamilyInstance">The nested family whose parameter should be linked to a parameter on the host family</param>
        /// <param name="nestedFamilyParameterName">The name of the parameter on the nested family to link to the host family parameter</param>
        /// <param name="hostFamilyParameterNameToLink">The name of the parameter on the host family to link to a parameter on the given nested family instance</param>
        public static void LinkNestedFamilyParameterToHostFamilyParameter(
            Document hostFamilyDocument,
            FamilyInstance nestedFamilyInstance,
            string nestedFamilyParameterName,
            string hostFamilyParameterNameToLink)
        {
            // Following good SOA practices, verify the incoming
              // parameters before attempting to proceed.

              ValidateFamilyDocument( hostFamilyDocument ); // Throws an exception if is not valid family doc

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

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

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

              Parameter oNestedFamilyParameter
            = GetFamilyParameter( nestedFamilyInstance,
              nestedFamilyParameterName );

              if( oNestedFamilyParameter == null )
              {
            throw new Exception( "Parameter '"
              + nestedFamilyParameterName
              + "' was not found on the nested family '"
              + nestedFamilyInstance.Symbol.Name + "'" );
              }

              FamilyParameter oHostFamilyParameter
            = hostFamilyDocument.FamilyManager.get_Parameter(
              hostFamilyParameterNameToLink );

              if( oHostFamilyParameter == null )
              {
            throw new Exception( "Parameter '"
              + hostFamilyParameterNameToLink
              + "' was not found on the host family." );
              }

              hostFamilyDocument.FamilyManager
            .AssociateElementParameterToFamilyParameter(
              oNestedFamilyParameter, oHostFamilyParameter );
        }
开发者ID:jeremytammik,项目名称:the_building_coder_samples,代码行数:65,代码来源:CmdNestedFamilies.cs


示例17: AddObjectsToTree

        protected void AddObjectsToTree(FamilyInstance elem, TreeNodeCollection curNodes)
        {
            Autodesk.Revit.DB.Options geomOp = m_app.Create.NewGeometryOptions();
             geomOp.ComputeReferences = false; // Not allowed for GetOriginalGeometry()!
             TreeNode tmpNode;

             // add geometry with the View set to null.
             TreeNode rootNode1 = new TreeNode("View = null");
             curNodes.Add(rootNode1);

             tmpNode = new TreeNode("Detail Level = Undefined");
             geomOp.DetailLevel = ViewDetailLevel.Undefined;
             tmpNode.Tag = elem.GetOriginalGeometry(geomOp);
             rootNode1.Nodes.Add(tmpNode);

             tmpNode = new TreeNode("Detail Level = Coarse");
             geomOp.DetailLevel = ViewDetailLevel.Coarse;
             tmpNode.Tag = elem.GetOriginalGeometry(geomOp);
             rootNode1.Nodes.Add(tmpNode);

             tmpNode = new TreeNode("Detail Level = Medium");
             geomOp.DetailLevel = ViewDetailLevel.Medium;
             tmpNode.Tag = elem.GetOriginalGeometry(geomOp);
             rootNode1.Nodes.Add(tmpNode);

             tmpNode = new TreeNode("Detail Level = Fine");
             geomOp.DetailLevel = ViewDetailLevel.Fine;
             tmpNode.Tag = elem.GetOriginalGeometry(geomOp);
             rootNode1.Nodes.Add(tmpNode);

             // SOFiSTiK FS
             // add model geometry including geometry objects not set as Visible.
             {
            Autodesk.Revit.DB.Options opts = m_app.Create.NewGeometryOptions();
            opts.ComputeReferences = false; // Not allowed for GetOriginalGeometry()!;
            opts.IncludeNonVisibleObjects = true;

            TreeNode rootNode = new TreeNode("View = null - Including geometry objects not set as Visible");
            curNodes.Add(rootNode);

            tmpNode = new TreeNode("Detail Level = Undefined");
            opts.DetailLevel = ViewDetailLevel.Undefined;
            tmpNode.Tag = elem.GetOriginalGeometry(opts);
            rootNode.Nodes.Add(tmpNode);

            tmpNode = new TreeNode("Detail Level = Coarse");
            opts.DetailLevel = ViewDetailLevel.Coarse;
            tmpNode.Tag = elem.GetOriginalGeometry(opts);
            rootNode.Nodes.Add(tmpNode);

            tmpNode = new TreeNode("Detail Level = Medium");
            opts.DetailLevel = ViewDetailLevel.Medium;
            tmpNode.Tag = elem.GetOriginalGeometry(opts);
            rootNode.Nodes.Add(tmpNode);

            tmpNode = new TreeNode("Detail Level = Fine");
            opts.DetailLevel = ViewDetailLevel.Fine;
            tmpNode.Tag = elem.GetOriginalGeometry(opts);
            rootNode.Nodes.Add(tmpNode);
             }

             // now add geometry with the View set to the current view
             if (elem.Document.ActiveView != null)
             {
            Options geomOp2 = m_app.Create.NewGeometryOptions();
            geomOp2.ComputeReferences = false; // Not allowed for GetOriginalGeometry()!;
            geomOp2.View = elem.Document.ActiveView;

            TreeNode rootNode2 = new TreeNode("View = Document.ActiveView");
            rootNode2.Tag = elem.GetOriginalGeometry(geomOp2);
            curNodes.Add(rootNode2);

            // SOFiSTiK FS
            // add model geometry including geometry objects not set as Visible.
            {
               Autodesk.Revit.DB.Options opts = m_app.Create.NewGeometryOptions();
               opts.ComputeReferences = false; // Not allowed for GetOriginalGeometry()!;
               opts.IncludeNonVisibleObjects = true;
               opts.View = elem.Document.ActiveView;

               TreeNode rootNode = new TreeNode("View = Document.ActiveView - Including geometry objects not set as Visible");
               curNodes.Add(rootNode);

               rootNode.Tag = elem.GetOriginalGeometry(opts);
            }
             }
        }
开发者ID:jeremytammik,项目名称:RevitLookup,代码行数:87,代码来源:Geometry.cs


示例18: CreateWindow

        public static DoorWindowInfo CreateWindow(ExporterIFC exporterIFC, FamilyInstance famInst,  HostObject hostObj,
            ElementId overrideLevelId, Transform trf)
        {
            DoorWindowInfo doorWindowInfo = new DoorWindowInfo();
            doorWindowInfo.Initialize(false, true, famInst, hostObj);
            doorWindowInfo.CalculateDoorWindowInformation(exporterIFC, famInst, overrideLevelId, trf);

            return doorWindowInfo;
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:9,代码来源:DoorWindowInfo.cs


示例19: CalculateDoorWindowInformation

        private void CalculateDoorWindowInformation(ExporterIFC exporterIFC, FamilyInstance famInst, 
            ElementId overrideLevelId, Transform trf)
        {
            IFCFile file = exporterIFC.GetFile();

            if (ExportingDoor)
            {
                string doorOperationType = null;

                Element doorType = famInst.Document.GetElement(famInst.GetTypeId());
                if (doorType != null)
                    ParameterUtil.GetStringValueFromElement(doorType, BuiltInParameter.DOOR_OPERATION_TYPE, out doorOperationType);

                DoorOperationTypeString = "NOTDEFINED";
                if (!string.IsNullOrWhiteSpace(doorOperationType))
                {
                    Type enumType = null;
                    if (ExporterCacheManager.ExportOptionsCache.ExportAs4)
                        enumType = typeof(Toolkit.IFC4.IFCDoorStyleOperation);
                    else
                        enumType = typeof(Toolkit.IFCDoorStyleOperation);

                    foreach (Enum ifcDoorStyleOperation in Enum.GetValues(enumType))
                    {
                        string enumAsString = ifcDoorStyleOperation.ToString();
                        if (NamingUtil.IsEqualIgnoringCaseSpacesAndUnderscores(enumAsString, doorOperationType))
                        {
                            DoorOperationTypeString = enumAsString;
                            break;
                        }
                    }
                }

                if (DoorOperationTypeString == "NOTDEFINED")
                {
                    // We are going to try to guess the hinge placement.
                    DoorOperationTypeString = CalculateDoorOperationStyle(famInst);
                }
                
                if (FlippedX ^ FlippedY)
                    DoorOperationTypeString = ReverseDoorStyleOperation(DoorOperationTypeString);

                if (String.Compare(DoorOperationTypeString, "USERDEFINED", true) == 0)
                {
                    string userDefinedOperationType;
                    ParameterUtil.GetStringValueFromElementOrSymbol(doorType, "UserDefinedOperationType", out userDefinedOperationType);
                    if (!string.IsNullOrEmpty(userDefinedOperationType))
                        UserDefinedOperationType = userDefinedOperationType;
                    else
                        DoorOperationTypeString = "NOTDEFINED";         //re-set to NotDefined if operation type is set to UserDefined but the userDefinedOperationType parameter is empty!
                }
            }

            if (HasRealWallHost)
            {
                // do hingeside calculation
                Wall wall = HostObject as Wall;
                PosHingeSide = true;

                BoundingBoxXYZ famBBox = null;
                Options options = GeometryUtil.GetIFCExportGeometryOptions();
                GeometryElement geomElement = famInst.GetOriginalGeometry(options);
                if (geomElement != null)
                    famBBox = geomElement.GetBoundingBox();

                if (famBBox != null)
                {
                    XYZ bboxCtr = trf.OfPoint((famBBox.Min + famBBox.Max) / 2.0);

                    Curve curve = WallExporter.GetWallAxis(wall);

                    XYZ wallZDir = WallExporter.GetWallHeightDirection(wall);

                    // famInst.HostParameter will fail if FamilyPlacementType is WorkPlaneBased, regardless of whether or not the reported host is a Wall.
                    // In this case, just use the start parameter of the curve.
                    bool hasHostParameter = famInst.Symbol.Family.FamilyPlacementType != FamilyPlacementType.WorkPlaneBased;
                    double param = hasHostParameter ? famInst.HostParameter : curve.GetEndParameter(0);

                    Transform wallTrf = curve.ComputeDerivatives(param, false);
                    XYZ wallOrig = wallTrf.Origin;
                    XYZ wallXDir = wallTrf.BasisX;
                    XYZ wallYDir = wallZDir.CrossProduct(wallXDir);

                    double eps = MathUtil.Eps();

                    bboxCtr -= wallOrig;
                    PosHingeSide = (bboxCtr.DotProduct(wallYDir) > -eps);

                    XYZ famInstYDir = trf.BasisY;
                    FlippedSymbol = (PosHingeSide != (wallYDir.DotProduct(famInstYDir) > -eps));
                }
            }
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:93,代码来源:DoorWindowInfo.cs


示例20: Initialize

        private void Initialize(bool isDoor, bool isWindow, FamilyInstance famInst, HostObject hostObject)
        {
            HostObject = hostObject;
            InsertInstance = famInst;

            ExportingDoor = isDoor;
            if (isDoor) 
		        PreDefinedType = "DOOR";

            ExportingWindow = isWindow;
            if (isWindow) 
		        PreDefinedType = "WINDOW";

            FlippedSymbol = false;

            DoorOperationTypeString = "NOTDEFINED";
            WindowPartitioningTypeString = "NOTDEFINED";

            FlippedX = (famInst == null) ? false : famInst.HandFlipped;
            FlippedY = (famInst == null) ? false : famInst.FacingFlipped;

            Wall wall = (hostObject == null) ? null : hostObject as Wall;
            Curve centerCurve = WallExporter.GetWallAxis(wall);
            HasRealWallHost = ((wall != null) && (centerCurve != null) && ((centerCurve is Line) || (centerCurve is Arc)));
        }
开发者ID:whztt07,项目名称:RevitCustomIFCexporter,代码行数:25,代码来源:DoorWindowInfo.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# FamilySymbol类代码示例发布时间:2022-05-24
下一篇:
C# Fakes.FakeTypeFinder类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap