Пример #1
0
 private static void MarkReferencedItems(StepRepresentationItem item, HashSet <StepRepresentationItem> visitedItems, HashSet <StepRepresentationItem> referencedItems)
 {
     if (visitedItems.Add(item))
     {
         foreach (var referenced in item.GetReferencedItems())
         {
             referencedItems.Add(referenced);
             MarkReferencedItems(referenced, visitedItems, referencedItems);
         }
     }
 }
Пример #2
0
        private int WriteItem(StepRepresentationItem item, StringBuilder builder)
        {
            if (!_inlineReferences)
            {
                // not inlining references, need to write out entities as we see them
                foreach (var referencedItem in item.GetReferencedItems())
                {
                    if (!_itemMap.ContainsKey(referencedItem))
                    {
                        var refid = WriteItem(referencedItem, builder);
                    }
                }
            }

            var id     = ++_nextId;
            var syntax = GetItemSyntax(item, id);

            WriteToken(new StepEntityInstanceToken(id, -1, -1), builder);
            WriteToken(StepEqualsToken.Instance, builder);
            WriteTokens(syntax.GetTokens(), builder);
            WriteToken(StepSemicolonToken.Instance, builder);
            WriteNewLine(builder);
            return(id);
        }