Làm việc với Profiles
Làm việc với các Profile
Các Profile trong Aspose.3D cho .NET xác định các hình dạng mặt cắt 2D được sử dụng làm đầu vào cho các thao tác ép đùn và quay khối rắn. LinearExtrusion quét một profile dọc theo một đường dẫn và RevolvedAreaSolid quay nó quanh một trục.
Các Profile tham số
ParameterizedProfile cung cấp các hình học chuẩn — hình chữ nhật, hình tròn, hình ellipse, hình thang và các hình khác — được định nghĩa bằng các tham số số thay vì các đỉnh đa giác rõ ràng.
using Aspose.ThreeD;
using Aspose.ThreeD.Entities;
using Aspose.ThreeD.Profiles;
var scene = new Scene();
// Rectangle profile: 2 units wide, 1 unit tall
var rectProfile = new RectangleShape();
rectProfile.XDim = 2.0;
rectProfile.YDim = 1.0;
// Extrude the rectangle 5 units along Z
var extrusion = new LinearExtrusion(rectProfile, 5.0);
extrusion.Slices = 10;
scene.RootNode.CreateChildNode("beam", extrusion);
scene.Save("beam.gltf", FileFormat.GLTF2);Các hình dạng khác trong ParameterizedProfile:
| Lớp | Tham số |
|---|---|
RectangleShape | XDim, YDim, RoundingRadius |
CircleShape | Radius |
LShape | Width, Depth, Thickness, FilletRadius |
TShape | Depth, FlangeWidth, WebThickness, FlangeThickness |
Các Profile dạng L có tham số
LShape là một profile có tham số tạo ra dầm cấu trúc dạng L từ các thuộc tính kích thước:
using Aspose.ThreeD.Profiles;
// L-shaped cross-section structural beam
var lProfile = new LShape();
lProfile.Width = 0.1;
lProfile.Depth = 0.2;
lProfile.Thickness = 0.01;
var extrusion = new LinearExtrusion(lProfile, 4.0);
scene.RootNode.CreateChildNode("l_beam", extrusion);Hồ sơ phản chiếu
MirroredProfile tạo ra một mặt cắt đối xứng bằng cách phản chiếu một hồ sơ cơ bản. Đưa bất kỳ đối tượng Profile nào vào hàm khởi tạo; thư viện sẽ tự động tạo hình dạng phản chiếu.
using Aspose.ThreeD.Profiles;
// Base profile to mirror
var baseProfile = new RectangleShape();
baseProfile.XDim = 0.5;
baseProfile.YDim = 1.0;
// Mirror the base profile to get a symmetric shape
var mirrored = new MirroredProfile(baseProfile);
var extrusion = new LinearExtrusion(mirrored, 3.0);
scene.RootNode.CreateChildNode("symmetric_beam", extrusion);Hồ sơ đường trung tâm
CenterLineProfile bao bọc một Curve và độ dày tường để tạo ra một mặt cắt rỗng (ví dụ, thành ống). Đưa đường cong trung tâm và độ dày vào hàm khởi tạo.
using Aspose.ThreeD.Profiles;
using Aspose.ThreeD.Entities;
var circle = new Circle { Radius = 0.5 };
var tube = new CenterLineProfile(circle, 0.05); // 5 cm wall
var extrusion = new LinearExtrusion(tube, 10.0);
scene.RootNode.CreateChildNode("pipe", extrusion);API Quick Reference
| Member | Mô tả |
|---|---|
new RectangleShape() | Hình dạng tham số hình chữ nhật (XDim, YDim, RoundingRadius) |
new CircleShape() | Hình dạng tham số hình tròn (Radius) |
new LShape() | Hồ sơ dầm kết cấu dạng L |
new TShape() | Hình dạng dầm cấu trúc dạng T |
new MirroredProfile(base) | Hồ sơ đối xứng được phản chiếu từ hồ sơ cơ sở |
new CenterLineProfile(curve, thickness) | Hồ sơ rỗng có độ dày tường cho trước |
new LinearExtrusion(profile, height) | Quét một hồ sơ dọc theo trục Z |
extrusion.Slices | Số đoạn phân chia dọc theo quét |
new RevolvedAreaSolid() | Quay một hồ sơ quanh trục; đặt các thuộc tính Shape và AngleEnd |
Xem thêm
- Aspose.3D for .NET — Enterprise Documentation
- Làm việc với các Thực thể Cảnh — gắn các khối rút ra vào các nút cảnh