Ejemplo n.º 1
0
        private static ECSchema CreateSchema(DgnFile File)
        {
            ECSchema   newSchema        = new ECSchema(schemaName, 1, 0, schemaName);
            ECClass    streamStateClass = new ECClass(className);
            ECProperty streamDataProp   = new ECProperty(propertyName, ECObjects.StringType);

            streamStateClass.Add(streamDataProp);
            newSchema.AddClass(streamStateClass);

            var status = DgnECManager.Manager.ImportSchema(newSchema, File, new ImportSchemaOptions());

            if (status != SchemaImportStatus.Success)
            {
                return(null);
            }

            return(newSchema);
        }
Ejemplo n.º 2
0
        public void CreateAndImport()
        {
            ECSchema schema = new ECSchema(SchemaTreeViewItems.Last().Name, 1, 0, "PDIWT");

            foreach (var classnode in SchemaTreeViewItems.Last().ClassNodes)
            {
                ECClass someclass = new ECClass(classnode.Name);
                foreach (var propnode in classnode.PropertyNodes)
                {
                    ECProperty someProp = new ECProperty(propnode.Name, GetTypeFromString(propnode.PropertyType));
                    //someProp.
                    someclass.Add(someProp);
                    //someclass.AddProperty();
                }
                schema.AddClass(someclass);
            }
            if (BDEC.DgnECManager.Manager.ImportSchema(schema, Program.GetActiveDgnFile(), new BDEC.ImportSchemaOptions()) == BD.SchemaImportStatus.Success)
            {
                MessageBox.Show($"{schema.FullName}导入成功", " 水规院", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Ejemplo n.º 3
0
            public static ECSchema AddSchema()
            {
                DgnFile      File    = Session.Instance.GetActiveDgnFile();
                DgnECManager Manager = DgnECManager.Manager;

                ECSchema   newSchema        = new ECSchema(schemaName, 1, 0, schemaName);
                ECClass    streamStateClass = new ECClass(className);
                ECProperty streamIdProp     = new ECProperty("Id", ECObjects.StringType);
                ECProperty streamDataProp   = new ECProperty("StreamData", ECObjects.StringType);

                streamStateClass.Add(streamIdProp);
                streamStateClass.Add(streamDataProp);
                newSchema.AddClass(streamStateClass);

                var status = Manager.ImportSchema(newSchema, File, new ImportSchemaOptions());

                if (status != SchemaImportStatus.Success)
                {
                    return(null);
                }

                return(newSchema);
            }