當前位置: 首頁>>代碼示例>>C#>>正文


C# Reference.ConvertToStableRepresentation方法代碼示例

本文整理匯總了C#中System.Reference.ConvertToStableRepresentation方法的典型用法代碼示例。如果您正苦於以下問題:C# Reference.ConvertToStableRepresentation方法的具體用法?C# Reference.ConvertToStableRepresentation怎麽用?C# Reference.ConvertToStableRepresentation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Reference的用法示例。


在下文中一共展示了Reference.ConvertToStableRepresentation方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: GetInstanceEdgeFromSymbolRef

        public static Edge GetInstanceEdgeFromSymbolRef(
            Reference symbolRef,
            Document dbDoc)
        {
            Edge instEdge = null;

              Options gOptions = new Options();
              gOptions.ComputeReferences = true;
              gOptions.DetailLevel = ViewDetailLevel.Undefined;
              gOptions.IncludeNonVisibleObjects = false;

              Element elem = dbDoc.GetElement( symbolRef.ElementId );

              string stableRefSymbol = symbolRef
            .ConvertToStableRepresentation( dbDoc );

              string[] tokenList = stableRefSymbol.Split(
            new char[] { ':' } );

              string stableRefInst = tokenList[3] + ":"
            + tokenList[4] + ":" + tokenList[5];

              GeometryElement geomElem = elem.get_Geometry(
            gOptions );

              foreach( GeometryObject geomElemObj in geomElem )
              {
            GeometryInstance geomInst = geomElemObj
              as GeometryInstance;

            if( geomInst != null )
            {
              GeometryElement gInstGeom = geomInst
            .GetInstanceGeometry();

              foreach( GeometryObject gGeomObject
            in gInstGeom )
              {
            Solid solid = gGeomObject as Solid;
            if( solid != null )
            {
              foreach( Edge edge in solid.Edges )
              {
                string stableRef = edge.Reference
                  .ConvertToStableRepresentation(
                    dbDoc );

                if( stableRef == stableRefInst )
                {
                  instEdge = edge;
                  break;
                }
              }
            }

            if( instEdge != null )
            {
              // already found, exit early
              break;
            }
              }
            }
            if( instEdge != null )
            {
              // already found, exit early
              break;
            }
              }
              return instEdge;
        }
開發者ID:jeremytammik,項目名稱:the_building_coder_samples,代碼行數:70,代碼來源:CmdDimensionInstanceOrigin.cs


注:本文中的System.Reference.ConvertToStableRepresentation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。