AnyCAD三维控件

AnyCAD三维控件

  • Docs
  • Download
  • Showcase
  • About

›Get Started

Get Started

  • Overview
  • Features
  • Hello World .Net
  • Modeling Concepts
  • Visualization Concepts
  • Data Exchange

Showcase

  • CAD
  • CAM
  • CAE
  • BIM
  • Robot

Reference

  • API
  • Samples in github

Modeling Concepts

Quick Start

The code snips to create and show the geometry cylinder:

  TopoShape cylinder = GlobalInstance.BrepTools.MakeCylinder(new Vector3(120, 0, 0), new Vector3(0, 0, 1), 20, 100, 40, 315);
   // 103 is the Id for geometry for latter query usage.
 renderView.ShowGeometry(cylinder, 103);

Concepts

TopoShape

The topology BREP presentation of the shape, which can be used to present any shapes in AnyCAD. Points, edges, faces, bodies, compound shapes are all TopoShape objects.

GeomBase

The geometry presentation of the shape, which uses parameters to present the shape. GeomPoint, GeomCurve, GeomSurface are the geometry presentation of the point, edge and face.

BrepTools

Most of the basic modeling algorithms are encapsulated in the BrepTools class, and you can use BrepTools to create shapes.

You can access the global BrepTools instance by GlobalInstance.BrepTools.

TopoExplor

TopoExplor is used to explore the sub shapes of a TopoShape, such as vertex, edge, face, shell, solid.

TopoShapeProperty

TopoShapeProperty is used to get the geometry information:

  • Length of the curve
  • Area of the surface
  • Center of the shape mass

FaceTriangulation

FaceTriangulation is used to triangulate the face to triangle meshes.

Please reference the AnyCAD .Net API help documentation for more information about the APIs.

Sample

FaceTriangulation usage sample:

            TopoShape face = …;
            if (face.GetShapeType() == EnumShapeShapeType.Topo_FACE)
            {
                MessageBox.Show("This is a face!");
            }

            FaceTriangulation ft = new FaceTriangulation();
            ft.SetTolerance(5);
            ft.Perform(face);
            float[] points = ft.GetVertexBuffer();
            int pointCount = points.Length / 3;
            uint[] indexBuffer = ft.GetIndexBuffer();
            int faceCount = indexBuffer.Length / 3;
            float[] normals = ft.GetNormalBuffer();
            float[] colorBuffer = new float[pointCount * 4];
            
            Random num = new Random();
            for (int ii = 0; ii < pointCount; ++ii)
            {
                int idx = ii * 4;
                colorBuffer[idx] = num.Next(0, 256)/256.0f;
                colorBuffer[idx+1] = num.Next(0, 256) / 256.0f;
                colorBuffer[idx+2] = num.Next(0, 256) / 256.0f;
                colorBuffer[idx+3] = 1;
            }

            RenderableEntity entity = GlobalInstance.TopoShapeConvert.CreateColoredFaceEntity(points, indexBuffer, normals, colorBuffer, face.GetBBox());

            EntitySceneNode node = new EntitySceneNode();
            node.SetEntity(entity);

            renderView.SceneManager.AddNode(node);

Practice

A good way to learn how to use AnyCAD SDK is look at the source code of the AnyCAD SDK Demo, reference the API help document and use the APIs to create some shapes. You can try to use basic BrepTools methods to create complex shapes around of you.

← Hello World .NetVisualization Concepts →
AnyCAD三维控件
Docs
Getting StartedSamplesAPI Reference
More
BlogGitHubYouku
Copyright © 2006~2019 AnyCAD Graphics Solution.