资源简介
revit导出json数据源代码,请需要这下载使用
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Autodesk.Revit.DB;
namespace CustomExporterAdnMeshJson
{
///
/// The data format specifying one solid for the
/// WebGL viewer defining its centre colour id
/// triangular facets their vertex coordinates
/// indices and normals.
///
class AdnMeshData
{
int FacetCount { get; set; } // optional
int VertexCount { get; set; } // optional
int[] VertexCoords { get; set; }
int[] VertexIndices { get; set; } // triangles
double[] Normals { get; set; }
int[] NormalIndices { get; set; } // not optional one normal per vertex
int[] Center { get; set; }
int Color { get; set; }
string Id { get; set; }
///
/// Apply this factor to all point data when
/// saving to JSON to accomodate the expected
/// scaling.
///
const double _export_factor = 0.002;
public AdnMeshData(
VertexLookupInt vertices
List vertexIndices
NormalLookupXyz normals
List normalIndices
PointInt center
Color color
double transparency
string id )
{
int n = vertexIndices.Count;
Debug.Assert( 0 == (n % 3)
“expected triples of 3D point vertex indices“ );
Debug.Assert( normalIndices.Count == n
“expected a normal for each vertex“ );
FacetCount = n / 3;
n = vertices.Count;
VertexCount = n;
VertexCoords = new int[n * 3];
int i = 0;
foreach( PointInt p in vertices.Keys )
{
VertexCoords[i++] = p.X;
VertexCoords[i++] = p.Y;
VertexCoords[i++] = p.Z;
}
VertexIndices = vertexIndices.ToArray();
n = normals.Count;
Normals = new double[n * 3];
i = 0;
foreach( XYZ v in normals.Keys )
{
Normals[i++] = v.X;
Normals[i++] = v.Y;
Normals[i++] = v.Z;
}
NormalIndices = normalIndices.ToArray();
Center = new int[3];
i = 0;
Center[i++] = center.X;
Center[i++] = center.Y;
Center[i] = center.Z;
byte alpha = (byte) (
( 100 - transparency ) * 2.55555555 );
Color = ConvertClr(
color.Red color.Green color.Blue alpha );
Id = id;
}
///
/// Convert colour and transparency to
/// the required integer format.
///
static int ConvertClr( byte r byte g byte b byte a )
{
return ( r << 24 ) + ( g << 16 ) + ( b << 8 ) + a;
}
public string ToJson()
{
// I did think of using a JSON serialiser
// either one of these two provided by the
// .NET framework or one of the other libraries:
// System.Runtime.Serialization.Json.DataContractJsonSerializer
// System.Web.script.Serialization.J
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\
文件 4195 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\.gitignore
文件 965 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson.sln
目录 0 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\
文件 4271 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\AdnMeshData.cs
文件 1333 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\CentroidVolume.cs
文件 2548 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\Command.cs
文件 540 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\CustomExporterAdnMeshJson.addin
文件 3551 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\CustomExporterAdnMeshJson.csproj
文件 7893 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\ExportContextAdnMesh.cs
文件 1190 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\NormalLookupXyz.cs
文件 1140 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\PointInt.cs
目录 0 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\Properties\
文件 1600 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\Properties\AssemblyInfo.cs
文件 1473 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\Util.cs
文件 1224 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\VertexLookupInt.cs
文件 5822 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\CustomExporterAdnMeshJson\x.cs
文件 1080 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\LICENSE
文件 873 2016-06-26 19:34 CustomExporterAdnMeshJson-2017.0.0.0\README.md
- 上一篇:rhel7.6
- 下一篇:C51单片机抢答器程序
相关资源
- Newtonsoft.Json.Compact .dll v3.5.0.8
- json vs2010
- bootstrap-table动态加载json数据并且支持
- win ce 5.0 json解析
- newtonsoft.json源码
- jsjq对json对象增,删,改,查操作
- OA人员选择模块Js+JSON
- LitJson源码--cs文件
- echarts地图扩展中国分区域geoJSON地图数
- ECharts3中国地图json文件及全国省的j
- Unity3D插件-- LitJson.dll
- arcgis api for js +json 实现热力图
- Jsoncpp_0.6rc2修改版
- TCP收发json. 客户端和服务端
- RevitLookup2017包含dll和addin文件
- node.js实现简单登录和注册
- stm32_cjson_demo.rar
- IntersectionDemo.rar
- echarts湖南省json地图包含个市,县地图
- JsonViewer
- channel_v3.json亲测可用
- form数据与json对象的互相转换(完整版
-
Jsonob
ject.dll - 全国各高校学科、专业的json数据
- 全国省市区json
- jsonEditor离线版
- sublime插件必需文件channel_v3.json
- 2017 Revit Lookup
- 2017 Add-In Manager
- echarts地图全国省份json资源JSON版本
评论
共有 条评论