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


C# Autodesk.get_Geometry方法代码示例

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


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

示例1: DoorGeometry

        /// <summary>
        /// construct function.
        /// </summary>
        /// <param name="door">of which geometry data is wanted.</param>
        public DoorGeometry(Autodesk.Revit.DB.Element door)
        {
            m_options                              = new Options();
             m_options.View                         = GetPlanform2DView(door);
             m_options.ComputeReferences            = false;
             Autodesk.Revit.DB.GeometryElement geoEle = door.get_Geometry(m_options);
             AddGeometryElement(geoEle);

             m_bbox = door.get_BoundingBox(m_options.View);
        }
开发者ID:AMEE,项目名称:revit,代码行数:14,代码来源:DoorFamilyGeometry.cs

示例2: GetPointCloud

        /// <summary>
        /// Obtain a sparse point collection outlining a Revit element bt traversing it's
        /// GeometryObject representation
        /// </summary>
        /// <param name="e"></param>
        /// <param name="pts"></param>
        protected static void GetPointCloud(Autodesk.Revit.DB.Element e, List<XYZ> pts)
        {
            var options = new Options()
            {
                ComputeReferences = true,
                DetailLevel = ViewDetailLevel.Coarse,
                IncludeNonVisibleObjects = false
            };

            foreach (var gObj in e.get_Geometry(options))
            {
                if (gObj is Autodesk.Revit.DB.Solid)
                {
                    GetPointCloud(gObj as Autodesk.Revit.DB.Solid, pts);
                }
                else if (gObj is GeometryInstance)
                {
                    GetPointCloud(gObj as GeometryInstance, pts);
                }
            }
        }
开发者ID:heegwon,项目名称:Dynamo,代码行数:27,代码来源:View3D.cs

示例3: GetCurvesFromFamily

        private Value GetCurvesFromFamily(Autodesk.Revit.DB.FamilyInstance fi, int count,
                                          Autodesk.Revit.DB.Options options)
        {
            FamilySymbol fs = fi.Symbol;
            //Autodesk.Revit.DB.GeometryElement geomElem = fs.get_Geometry(options);
            Autodesk.Revit.DB.GeometryElement geomElem = fi.get_Geometry(options);
                // our particular case of a loaded mass family with no joins has no geom in the instance

            //fi.GetOriginalGeometry(options);
            //fi.GetTransform()

            Autodesk.Revit.DB.CurveArray curves = new CurveArray();
            Autodesk.Revit.DB.ReferenceArray curveRefs = new ReferenceArray();

            //Find all curves and insert them into curve array
            AddCurves(fi, geomElem, count, ref curves);

            //curves.Append(GetCurve(fi, options)); //test

            //extract references for downstream use
            foreach (Curve c in curves)
            {
                curveRefs.Append(c.Reference);
            }

            //convert curvearray into list using Stephens MakeEnumerable
            Value result = Value.NewList(Utils.SequenceToFSharpList(
                dynUtils.MakeEnumerable(curves).Select(Value.NewContainer)
                                             ));

            return result;
        }
开发者ID:parchjs,项目名称:Dynamo,代码行数:32,代码来源:FamilyInstance.cs

示例4: SendElement

        // Note: Some element does not expose geometry, for example, curtain wall and dimension.
        // In case of a curtain wall, try selecting a whole wall by a window/box instead of a single pick.
        // It will then select internal components and be able to display its geometry.
        //
        public void SendElement(Autodesk.Revit.DB.Element elem)
        {
            if (elem.GetType() ==  typeof(Autodesk.Revit.DB.Element))
             {
            return;
             }
             if (elem is Autodesk.Revit.DB.TextNote)
             {
             sendTextNote(elem);
             }
             if (elem is Autodesk.Revit.DB.View)
             {
             sendViewpoint(elem);
             }
             // if it is a Group. we will need to look at its components.
             if (elem is Autodesk.Revit.DB.Group)
             {

             /* if we add this, the elements of the Group are duplicates
                Autodesk.Revit.DB.Group @group = (Autodesk.Revit.DB.Group)elem;
                Autodesk.Revit.DB.ElementArray members = @group.GetMemberIds;

                MessageBuffer mb = new MessageBuffer();
                mb.add(elem.Id.IntegerValue);
                mb.add(elem.Name);
                sendMessage(mb.buf, MessageTypes.NewGroup);
                foreach (Autodesk.Revit.DB.Element elm in members)
                {
                   SendElement(elm);
                }
                mb = new MessageBuffer();
                sendMessage(mb.buf, MessageTypes.EndGroup);*/
             }

             else
             {

            // not a group. look at the geom data.
             Autodesk.Revit.DB.GeometryElement geom = elem.get_Geometry(mOptions);
            if ((geom != null))
            {
               SendElement(geom, elem);
            }
             }
        }
开发者ID:dwickeroth,项目名称:covise,代码行数:49,代码来源:COVER.cs

示例5: GetFaces

 /// <summary>
 /// Get edges of element's profile
 /// </summary>
 /// <param name="elem">selected element</param>
 /// <returns>all the faces in the selected Element</returns>
 public virtual List<List<Edge>> GetFaces(Autodesk.Revit.DB.Element elem)
 {
     List<List<Edge>> faceEdges = new List<List<Edge>>();
     Options options = m_appCreator.NewGeometryOptions();
     options.DetailLevel = DetailLevels.Medium;
     //make sure references to geometric objects are computed.
     options.ComputeReferences = true;
     Autodesk.Revit.DB.GeometryElement geoElem = elem.get_Geometry(options);
     GeometryObjectArray gObjects = geoElem.Objects;
     //get all the edges in the Geometry object
     foreach (GeometryObject geo in gObjects)
     {
         Solid solid = geo as Solid;
         if (solid != null)
         {
             FaceArray faces = solid.Faces;
             foreach (Face face in faces)
             {
                 EdgeArrayArray edgeArrarr = face.EdgeLoops;
                 foreach (EdgeArray edgeArr in edgeArrarr)
                 {
                     List<Edge> edgesList = new List<Edge>();
                     foreach (Edge edge in edgeArr)
                     {
                         edgesList.Add(edge);
                     }
                     faceEdges.Add(edgesList);
                 }
             }
         }
     }
     return faceEdges;
 }
开发者ID:AMEE,项目名称:revit,代码行数:38,代码来源:Profile.cs

示例6: ExtractGeom

 /// <summary>
 /// Extract the geometry of the given Element.
 /// </summary>
 /// <param name="elem">Element parameter</param>
 /// <returns>Element's geometry</returns>
 protected ElementGeometry ExtractGeom(Autodesk.Revit.DB.Element elem)
 {
     Solid result = null;
     Options options = new Options();
     options.ComputeReferences = true;
     Autodesk.Revit.DB.GeometryElement gElement = elem.get_Geometry(options);
     foreach (GeometryObject gObj in gElement.Objects)
     {
         result = gObj as Solid;
         if (result != null && result.Faces.Size > 0)
             break;
     }
     BoundingBoxXYZ box = elem.get_BoundingBox(null);
     return new ElementGeometry(result, box);
 }
开发者ID:AMEE,项目名称:revit,代码行数:20,代码来源:HostedSweepCreator.cs

示例7: GetFaces

 /// <summary>
 /// Get edges of element's profile
 /// </summary>
 /// <param name="elem">selected element</param>
 /// <returns>all the faces in the selected Element</returns>
 public override List<List<Edge>> GetFaces(Autodesk.Revit.DB.Element elem)
 {
     List<List<Edge>> faceEdges = new List<List<Edge>>();
     Options options = m_appCreator.NewGeometryOptions();
     options.DetailLevel = DetailLevels.Medium;
     //make sure references to geometric objects are computed.
     options.ComputeReferences = true;
     Autodesk.Revit.DB.GeometryElement geoElem = elem.get_Geometry(options);
     GeometryObjectArray gObjects = geoElem.Objects;
     //get all the edges in the Geometry object
     foreach (GeometryObject geo in gObjects)
     {
         //if beam doesn't contain opening on it, then we can get edges from instance
         //and the points we get should be transformed by instance.Tranceform
         if (geo is Autodesk.Revit.DB.GeometryInstance)
         {
             Autodesk.Revit.DB.GeometryInstance instance = geo as Autodesk.Revit.DB.GeometryInstance;
             m_beamTransform = instance.Transform;
             Autodesk.Revit.DB.GeometryElement elemGeo = instance.SymbolGeometry;
             GeometryObjectArray objectsGeo = elemGeo.Objects;
             foreach (GeometryObject objGeo in objectsGeo)
             {
                 Solid solid = objGeo as Solid;
                 if (null != solid)
                 {
                     FaceArray faces = solid.Faces;
                     foreach (Face face in faces)
                     {
                         EdgeArrayArray edgeArrarr = face.EdgeLoops;
                         foreach (EdgeArray edgeArr in edgeArrarr)
                         {
                             List<Edge> edgesList = new List<Edge>();
                             foreach (Edge edge in edgeArr)
                             {
                                 edgesList.Add(edge);
                             }
                             faceEdges.Add(edgesList);
                         }
                     }
                 }
             }
         }
         //if beam contains opening on it, then we can get edges from solid
         //and the points we get do not need transform anymore
         else if (geo is Autodesk.Revit.DB.Solid)
         {
             m_haveOpening = true;
             Solid solid = geo as Solid;
             FaceArray faces = solid.Faces;
             foreach (Face face in faces)
             {
                 EdgeArrayArray edgeArrarr = face.EdgeLoops;
                 foreach (EdgeArray edgeArr in edgeArrarr)
                 {
                     List<Edge> edgesList = new List<Edge>();
                     foreach (Edge edge in edgeArr)
                     {
                         edgesList.Add(edge);
                     }
                     faceEdges.Add(edgesList);
                 }
             }
         }
     }
     return faceEdges;
 }
开发者ID:AMEE,项目名称:revit,代码行数:71,代码来源:ProfileBeam.cs

示例8: Solid

        /// <summary>
        /// Internal constructor to make a solid by extracting solids from an element.
        /// </summary>
        /// <param name="element"></param>
        internal Solid(Autodesk.Revit.DB.Element element)
        {
            // Regenerate to get the solids in the element. If the element was
            // created during this same run, document regeneration will not have
            // occured.
            TransactionManager.Instance.EnsureInTransaction(DocumentManager.Instance.CurrentDBDocument);
            DocumentManager.Regenerate();
            TransactionManager.Instance.TransactionTaskDone();

            var instanceSolids = new Dictionary<ElementId, List<Autodesk.Revit.DB.GeometryObject>>();;
            Autodesk.Revit.DB.Solid mySolid = null;

            var thisId = ElementId.InvalidElementId;

            if (element != null)
            {
                thisId = element.Id;
                instanceSolids[thisId] = new List<Autodesk.Revit.DB.GeometryObject>();
            }

            bool bNotVisibleOption = false;
            if (element is GenericForm)
            {
                var gF = (GenericForm)element;
                if (!gF.Combinations.IsEmpty)
                    bNotVisibleOption = true;
            }

            int nTry = (bNotVisibleOption) ? 2 : 1;
            for (int iTry = 0; iTry < nTry && (mySolid == null);
                iTry++)
            {
                var geoOptions = new Autodesk.Revit.DB.Options();
                geoOptions.ComputeReferences = true;
                if (bNotVisibleOption && (iTry == 1))
                    geoOptions.IncludeNonVisibleObjects = true;

                Autodesk.Revit.DB.GeometryObject geomObj = element.get_Geometry(geoOptions);
                var geomElement = geomObj as GeometryElement;

                if (geomElement != null)
                {
                    foreach (Autodesk.Revit.DB.GeometryObject geob in geomElement)
                    {
                        var ginsta = geob as GeometryInstance;
                        if (ginsta != null && thisId != ElementId.InvalidElementId)
                        {
                            GeometryElement instanceGeom = ginsta.GetInstanceGeometry();

                            instanceSolids[thisId].Add(instanceGeom);

                            foreach (Autodesk.Revit.DB.GeometryObject geobInst in instanceGeom)
                            {
                                mySolid = geobInst as Autodesk.Revit.DB.Solid;
                                if (mySolid != null)
                                {
                                    FaceArray faceArr = mySolid.Faces;
                                    var thisEnum = faceArr.GetEnumerator();
                                    bool hasFace = false;
                                    for (; thisEnum.MoveNext(); )
                                    {
                                        hasFace = true;
                                        break;
                                    }
                                    if (!hasFace)
                                        mySolid = null;
                                    else
                                        break;
                                }
                            }
                            if (mySolid != null)
                                break;
                        }
                        else
                        {
                            mySolid = geob as Autodesk.Revit.DB.Solid;
                            if (mySolid != null)
                            {
                                FaceArray faceArr = mySolid.Faces;
                                var thisEnum = faceArr.GetEnumerator();
                                bool hasFace = false;
                                for (; thisEnum.MoveNext(); )
                                {
                                    hasFace = true;
                                    break;
                                }
                                if (!hasFace)
                                    mySolid = null;
                                else
                                    break;
                            }

                        }
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:101,代码来源:Solid.cs


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