예제 #1
0
        public bool SetTags()
        {
            BCOM.Element bcomElement;
            FrameList.GetElement(out bcomElement);

            bool res = false;

            foreach (TagToDataGroupMapProperty mapTag in TagsToDataGroupMapping.Instance.Items)
            {
                res |= TagsToDataGroupConverter.SetMapTagOnElement(bcomElement, mapTag);
            }
            return(res);
        }
예제 #2
0
        private bool SetDataGroupInstance_()
        {
            BCOM.Element bcomElement;
            FrameList.GetElement(out bcomElement);
            Element element = bcomElement.ToElement();

            using (var catalogEditHandle = new CatalogEditHandle(element, true, true))
            {
                if (catalogEditHandle == null ||
                    catalogEditHandle.CatalogInstanceName != null)
                {
                    return(false);
                }

                catalogEditHandle.InsertDataGroupCatalogInstance(
                    CatalogTypeName, CatalogInstanceName);
                catalogEditHandle.UpdateInstanceDataDefaults();

                if (DataGroupPropsValues != null)
                {
                    foreach (var pair in DataGroupPropsValues)
                    {
                        Sp3dToDataGroupMapProperty mapProp = pair.Key;
                        string value = pair.Value;

                        DataGroupProperty prop = catalogEditHandle.GetProperties()
                                                 .FirstOrDefault(x => x.Xpath == mapProp.TargetXPath);

                        if (prop == null)
                        {
                            prop = new DataGroupProperty(
                                mapProp.TargetName, value, mapProp.ReadOnly, mapProp.Visible);
                            prop.Xpath = mapProp.TargetXPath;
                            catalogEditHandle.Properties.Add(prop);
                        }
                        catalogEditHandle.SetValue(prop, value);
                    }
                }

                int res = catalogEditHandle.Rewrite((int)BCOM.MsdDrawingMode.Normal);
                return(res == 0);

                // TODO решить проблему вылета при команде Modify DataGroup Instance
            }
        }
예제 #3
0
        private bool addToModel_(BCOM.ModelReference model = null)
        {
            model = model ?? App.ActiveModelReference;

            BCOM.Level level = ElementHelper.GetOrCreateLevel(LevelName);
            App.ActiveSettings.SetByLevel(level);

            BCOM.Element element;
            FrameList.GetElement(out element);

            if (element.ID != 0 && element.ModelReference == model)
            {
                return(true);
            }

            FrameList.AddToModel(model);
            FrameList.GetElement(out element);

            bool res = element.ID != 0;

            return(res);
        }