当前位置: 首页 > wzjs >正文

台州网站建设百度网站推广费用

台州网站建设,百度网站推广费用,阿里虚拟主机怎么做两个网站,焦作公司做网站模型中存储数据参数读取写入外部存储SchemaEntity快速获取外部存储参数参数 在Revit平台API中,每个图元对象都有参数属性,它是隶属于图元所有属性的集合,在此集合中更改属性值。 每个图元的参数都有一个与之关联的ElementId类型的ID大多数参…

模型中存储数据

  • 参数
    • 读取
    • 写入
  • 外部存储
    • Schema
    • Entity
    • 快速获取外部存储参数

参数

在Revit平台API中,每个图元对象都有参数属性,它是隶属于图元所有属性的集合,在此集合中更改属性值。

  • 每个图元的参数都有一个与之关联的ElementId类型的ID
  • 大多数参数是Revit内置的
  • 还有一部分是存储在硬盘外部共享参数文件的共享参数

Revit API中参数相关的类

  • Autodesk.Revit.Parameters.BuiltInParameter枚举:Revit内建参数枚举
  • Parameter类: 参数
  • Defination类:参数定义类
  • ParameterType枚举: 参数类型枚举

通过Lookup获取参数,点击Parameter得到该元素所有参数
在这里插入图片描述
选择你想获取的参数,然后点击Definition
通过

读取

  1. e.Parameters

  2. e.GetParameters(string name)

  3. e.get_Parameter(BuiltInParameter parameterId)

  4. e.LookupParameter(string name)

写入

判断该参数是否是ReadOnly (p.IsReadOnly)

判断该参数交互时是否可修改(p.UserModifiable)

判断该参数的StorageType

将要写入该参数的值转换为相应的数据类型,然后Set().

外部存储

Revit API允许创建Schema类数据结构并将它们的实例附着到Revit模型中的任何Element。

Revit API中外部存储相关的类
Sechema:数据结构
SchemaBuilder:数据架构编辑器
Field:字段
FieldBuilder:字段编辑器
Entity:数据实体

Schema

using Autodesk.Revit.UI;
using System;
using System.IO;
using System.Linq;
using Autodesk.Revit.DB;
using System.Collections.Generic;namespace ParameterBasicDemo
{[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]public class CreateSharedParameterCmd : IExternalCommand{public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements){try{string dllLocation = string.Empty;string sharedFile = string.Empty;dllLocation = "D:\\";sharedFile = Path.Combine(dllLocation, "SharedParameters.txt");//需要文件存在commandData.Application.Application.SharedParametersFilename = sharedFile;DefinitionFile defFile = null;defFile = commandData.Application.Application.OpenSharedParameterFile();using (Transaction tran = new Transaction(commandData.Application.ActiveUIDocument.Document)){tran.Start("创建共享参数");try{// 创建、获得共享参数DefinitionGroup defGroup = defFile.Groups.Create("BasicDemo");Definition def = defGroup.Definitions.get_Item("BasicDemoId");ExternalDefinitionCreationOptions edcOpt = new ExternalDefinitionCreationOptions("BasicDemoId", ParameterType.Text);//高版本不能用ParameterType要用ForgeTypeId(在SpecTypeId类中)if (null == def){def = defGroup.Definitions.Create(edcOpt);}// 获得墙类别集合CategorySet cs = new CategorySet();Category wallCategory =commandData.Application.ActiveUIDocument.Document.Settings.Categories.get_Item(BuiltInCategory.OST_Walls);cs.Insert(wallCategory);// 实例绑定InstanceBinding instBd = commandData.Application.Application.Create.NewInstanceBinding(cs);commandData.Application.ActiveUIDocument.Document.ParameterBindings.Insert(def, instBd);if (TransactionStatus.Committed != tran.Commit()){TaskDialog.Show("共享参数", "事务提交失败!");}}catch{tran.RollBack();throw;}}return Autodesk.Revit.UI.Result.Succeeded;}catch (Exception ex){message = ex.Message;return Autodesk.Revit.UI.Result.Failed;}}}
}

Entity

using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.ExtensibleStorage;
using Autodesk.Revit.UI;
using Autodesk.Revit.UI.Selection;namespace ParameterBasicDemo
{[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]public class WallExternalStorageCmd : IExternalCommand{public Autodesk.Revit.UI.Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements){try{UIDocument uidoc = commandData.Application.ActiveUIDocument;Wall wall = PickWall(uidoc);StoreDataInWall(wall, XYZ.Zero);return Autodesk.Revit.UI.Result.Succeeded;}catch (Exception ex){message = ex.Message;return Autodesk.Revit.UI.Result.Failed;}}private Wall PickWall(UIDocument uidoc){Wall wall = null;while (null == wall){Reference reference = uidoc.Selection.PickObject(ObjectType.Element);wall = uidoc.Document.GetElement(reference.ElementId) as Wall;}return wall;}//创建一个数据结构,将其附加到墙上,用数据填充它,然后从墙上检索数据void StoreDataInWall(Wall wall, XYZ dataToStore){using (Transaction createSchemaAndStoreData = new Transaction(wall.Document, "tCreateAndStore")){createSchemaAndStoreData.Start();SchemaBuilder schemaBuilder = new SchemaBuilder(new Guid("720080CB-DA99-40DC-9415-E53F280AA1F0"));schemaBuilder.SetReadAccessLevel(AccessLevel.Public); // 读权限:所有用户 schemaBuilder.SetWriteAccessLevel(AccessLevel.Vendor); // 可写权限:发行商schemaBuilder.SetVendorId("ADSK"); // 必须,由于可写权限为VendorschemaBuilder.SetSchemaName("WireSpliceLocation");FieldBuilder fieldBuilder = schemaBuilder.AddSimpleField("WireSpliceLocation", typeof(XYZ)); // create a field to store an XYZfieldBuilder.SetSpec(SpecTypeId.Length);fieldBuilder.SetDocumentation("A stored location value representing a wiring splice in a wall.");Schema schema = schemaBuilder.Finish(); // 注册外部存储的数据结构Entity entity = new Entity(schema); // 创建该数据结构类型的数据实体Field fieldSpliceLocation = schema.GetField("WireSpliceLocation"); // 获得数据结构的字段entity.Set<XYZ>(fieldSpliceLocation, dataToStore, UnitTypeId.Meters); // 设置数据实体的指定字段的值wall.SetEntity(entity); // 存储数据实体到墙元素// 读取墙上的外部数据Entity retrievedEntity = wall.GetEntity(schema);XYZ retrievedData = retrievedEntity.Get<XYZ>(schema.GetField("WireSpliceLocation"), UnitTypeId.Meters);createSchemaAndStoreData.Commit();}}}
}

快速获取外部存储参数

方法1
在这里插入图片描述

在LookUp上获取所需的外部存储的guid,得到schema,再得到entity,然后通过get方法输入参数的名称得到参数的值

Schema schema = Schema.Lookup(new Guid("{*****************}"));
Entity entity = ele.GetEntity(schema);
string data = entity.Get<string>(schema.GetField("id"));

方法2

            string data = null;IList<Guid> listGuids = ele.GetEntitySchemaGuids().ToList();foreach (Guid guid in listGuids){Schema schema = Schema.Lookup(guid);if (schema.SchemaName == "schema名称"){Entity entity = ele.GetEntity(schema);data = entity.Get<string>(schema.GetField("参数名称"));}}
http://www.dtcms.com/wzjs/124946.html

相关文章:

  • 企业百度网站怎么做网络广告策划流程有哪些?
  • 建设自己的网站首页google浏览器下载安装
  • 南宁网站关键字优化小熊代刷推广网站
  • 网站推广计划书包含哪些内容百度网盘首页
  • 怎么添加网站程序广州建网站的公司
  • 胶州家园网站建设网盟推广是什么意思
  • 陇南市建设局网站网络舆情监测
  • 美国服务器ip地址免费网站seo视频狼雨seo教程
  • 做网站包括图片设计吗谷歌google官网下载
  • 桐乡网站二次开发怎样建网站
  • 局域网内服务器做网站网络推广外包内容
  • 龙海市城乡规划建设局网站免费域名申请
  • 小程序商城模板免费在线刷seo
  • 网站制作方案书销售人员培训课程有哪些
  • 福州企业高端网站建设制作哪家好宁波seo关键词优化
  • 论坛网站制作费用2023年8月份新冠
  • 届毕业设计代做网站店铺运营方案策划
  • 贵阳工程建设招聘信息网站独立站seo优化
  • 五年级信息做网站的软件bing搜索 国内版
  • 网址免费生成app东莞关键字排名优化
  • 用xp做网站是否先搭建iiskol营销模式
  • 深圳福田网站优化网络营销培训学校网站优化设计的基础是网站基本要素及每个细节的优化
  • 做微信封面模板下载网站百度seo服务
  • 竹溪县县建设局网站百度搜索服务
  • 网站建设有什么系统百度地图优化
  • bitcoind 做交易网站公司网址怎么制作
  • 网站建设用宝塔网站维护需要多长时间
  • 制作公司网站哪个好啥是网络推广
  • 宜春网站建设公司哪家好重庆seo建站
  • 惠州做网站首选惠州邦批量外链工具