首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用eyeshot将面域提取到网格或实体?

如何使用eyeshot将面域提取到网格或实体?
EN

Stack Overflow用户
提问于 2019-01-08 16:38:24
回答 1查看 442关注 0票数 1

我正在尝试使用Eyeshot在autodesk naviswork上创建导航网格。

使用Solid.FromTriangles()创建实体后,将顶点和IndexTriangle转换为顶点三角形。

代码语言:javascript
复制
var solidList = new List();
var Solid = Solid.FromTriangles(item.vertices, item.triangles);

但我认为它不适用于布尔运算符。

所以我想要提取区域来使用布尔运算符。

如何将面域提取到网格或实体(或顶点三角形)?

EN

回答 1

Stack Overflow用户

发布于 2019-01-08 20:10:51

这很容易做到。你必须确保你的区域vertese是排序的,否则你可能会遇到一些问题,但这只是一个简单的参数。如果形状不是中空的,下面是一个例子:

代码语言:javascript
复制
// the verteses has to be in order and direction doesn't matter here 
// i simply assume it's drawn on X/Y for the purpose of the example
public static Region CreateRegion(List<Point3D> verteses)
{
    // create a curve list representing
    var curves = new List<ICurve>();

    // for each vertex we add them to the list
    for (int i = 1; i < verteses.Count; i++)
    {
        curves.Add(new Line(verteses[i - 1], verteses[i]));
    }

    // close the region
    curves.Add(new Line(verteses.Last(), verteses[0]));

     return new Region(new CompositeCurve(curves, true), Plane.XY, true);
}

// this extrude in Z the region
public static Solid CreateSolidFromRegion(Region region, double extrudedHeight)
{
    // extrude toward Z by the amount
    return region.ExtrudeAsSolid(new Vector3D(0, 0, 1), extrudedHeight);
}

一个从vertese创建10 x 10 x 10的立方体的简单示例(有更简单的方法来创建立方体,但为了简单起见,我将创建一个立方体)

代码语言:javascript
复制
// create the 4 verteses
var verteses = new List<Point3D>()
{
    new Point3D(0, 0, 0),
    new Point3D(10, 0, 0),
    new Point3D(10, 10, 0),
    new Point3D(0, 10, 0)
}

// create the region on the XY plane using the static method
var region = CreateRegion(verteses);

// extrude the region in Z by 10 units
var solid = CreateSolidFromRegion(region, 10d);
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54088008

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档