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


C# FamilyInstance.GetOriginalGeometry方法代码示例

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


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

示例1: 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

示例2: 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

示例3: OriginalInstanceGeometry

        public OriginalInstanceGeometry(string label, FamilyInstance val, Autodesk.Revit.ApplicationServices.Application app)
            : base(label)
        {
            m_val = val;
             m_app = app;

             m_hasGeometry = false;

             if (m_val != null && m_app != null)
             {
            Autodesk.Revit.DB.Options geomOp = m_app.Create.NewGeometryOptions();
            geomOp.DetailLevel = ViewDetailLevel.Undefined;
            if (m_val.GetOriginalGeometry(geomOp) != null)
               m_hasGeometry = true;
             }
        }
开发者ID:halad,项目名称:RevitLookup,代码行数:16,代码来源:ElementGeometry.cs


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