示例#1
0
        internal static StepDynamicItem CreateFromSyntaxList(StepBinder binder, StepSimpleItemSyntax stepSimpleSyntax, int id)
        {
            StepSyntaxList syntaxList  = stepSimpleSyntax.Parameters;
            var            dynamicItem = new StepDynamicItem();

            dynamicItem.SyntaxList = syntaxList;
            dynamicItem.Id         = id;
            dynamicItem.Keyword    = stepSimpleSyntax.Keyword;
            dynamicItem.BindSyntaxList(binder, syntaxList, 0);
            return(dynamicItem);
        }
        /// <summary>
        /// This function is used for handle simple syntax items
        /// </summary>
        /// <param name="binder"></param>
        /// <param name="itemSyntax"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        internal static StepRepresentationItem FromTypedParameterToItem(StepBinder binder, StepItemSyntax itemSyntax, int id)
        {
            try
            {
                StepRepresentationItem item = null;

                var simpleItem = (StepSimpleItemSyntax)itemSyntax;
                LogWriter.Instance.WriteDebugLog(string.Format("id={0}, keyword={1}", id, simpleItem.Keyword));
                switch (simpleItem.Keyword)
                {
                case StepItemTypeExtensions.ProductDefinitionFormationWithSpecifiedSourceText:
                    item = StepProductDefFormationWithSpecSource.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                case StepItemTypeExtensions.ProductText:
                    item = StepProduct.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                case StepItemTypeExtensions.ProductDefinitionText:
                    item = StepProductDefinition.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                case StepItemTypeExtensions.ShapeDefinitionRepresentationText:
                    item = StepShapeDefinitionRepresentation.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                case StepItemTypeExtensions.ProductDefinitionShapeText:
                    item = StepProductDefinitionShape.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                case StepItemTypeExtensions.ShapeRepresentationRelationshipText:
                    item = StepShapeRepresentationRelationShip.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                case StepItemTypeExtensions.ShapeRepresentationText:
                    item = StepShapeRepresentation.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                case StepItemTypeExtensions.AdvancedBrepShapeRepresentationText:
                    item = StepAdvancedBrepShapeRepresentation.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                case StepItemTypeExtensions.StyledItemText:
                    item = StepStyledItem.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                case StepItemTypeExtensions.NextAssemblyUsageOccurrenceText:
                    item = StepNextAssemblyUsageOccrrence.CreateFromSyntaxList(binder, simpleItem.Parameters, id);
                    break;

                default:
                    item = StepDynamicItem.CreateFromSyntaxList(binder, simpleItem, id);     //Tien added on Mar 21 2020
                    break;
                }
                return(item);
            }
            catch (Exception ex)
            {
                LogWriter.Instance.WriteDebugLog(ex);
                return(null);
            }
        }