下载app免费领取会员
本节内容要点
Extrude通常被称为拉伸,是一种将几何或拓扑体沿某个方向延伸生成一个新的几何或拓扑体的建模技术,是几何内核的一个基础建模算法。
在OpenCascade中拉伸算法通过BRepPrimAPI_MakePrism类实现;在ACIS中通过api_sweep_with_options函数的一个重载方法实现(被视作Sweep扫掠算法的一种特殊情况);CGM中由CATICGMTopPrims类实现。
Opencascade中的拉伸算法实现比较简单,而在Parasolid、ACIS、CGM中都支持更多参数(边界等)的设定。
与Extrude相似的概念有Sweep,二者之间有如下区别:
Parasolid中的拉伸建模算法接口由PK_BODY_extrude提供,其函数原型为:
PK_ERROR_code_t PK_BODY_extrude
(
received arguments
PK_BODY_t profile, minimum, wire or sheet profile
to extrude
PK_VECTOR1_t path, direction of linear extrusion
const PK_BODY_extrude_o_t *options, options structure
returned arguments
PK_BODY_t *const body, resulting extruded body
PK_TOPOL_track_r_t *const tracking, tracking information
PK_TOPOL_local_r_t *const results status information
)
从入参上看,PK_BODY_extrude方法接口由PK_BODY_t类型的轮廓、拉伸方向向量path、高级选项options来控制,并返回一个新的BODY。
Parasolid支持对点(Minimum)、线(Wire)、面(Sheet)作为轮廓(profile)进行拉伸,且对WireBody和SheetBody都不要求是平坦的;对MinimumBody的拉伸会生成WireBody,对WireBody拉伸会生成SheetBody,对SheetBody拉伸会形成一个实体(Solid)。
PK_BODY_extrude函数接收轮廓参数必须是PK_BODY_t类型,不支持POINT、VERTEX、 CURVE、EDGE、SURF、FACE这些几何和拓扑类型的参数。 虽然PK_BODY_extrude不支持对拓扑实体和几何实体进行拉伸,但Parasolid提供了其他类似的接口来实现让实体沿着某个方向进行"拉伸"。这些接口在命名上都带有Sweep的标识,Parasolid官方将其都视作扫掠(Sweep)的一种,但由于这些接口都是提供了一个向量参数(PK_VECTOR_t或PK_VECTOR1_t)来以线性的方式进行偏移,因此本文擅作主张将这些接口都归类到本节中,接口有以下几个: 将《Parasolid建模算法-孤立点、线框、薄板》一节中创建的复杂线框进行拉伸形成非封闭薄板。 将《Parasolid建模算法-创建薄板Sheet》一节中创建的带孔洞的薄板进行拉伸形成带孔封闭实体。 PK_BODY_extrude最简单的用法是将一个轮廓朝指定方向拉伸给定的距离,除此之外还支持设定同时对轮廓两侧进行拉伸、设定拉伸到指定边界,选择保留拉伸模型的内外侧等。 拉伸选项PK_BODY_extrude_o_s的定义: PK_bound_def_t的定义: 使用内置的PK_BODY_extrude_o_m宏来设置默认参数: 选项主要包括两个PK_bound_def_s类型的参数start_bound和end_bound,可以用来控制拉伸的起始位置(边界)和终止位置(边界) ,PK_bound_def_s的各参数意义如下: PK_bound_t 边界类型可设置为指定距离或某种类型的实体,PK_bound_def_s的第四个参数entity需设置为指定类型的实体。 forward: 是否跟指定的的拉伸方向一致,否则为反向拉伸。 distance: 拉伸距离,只有当bound为PK_bound_distance_c时生效。 entity: 边界实体对象,只有当bound为PK_bound_surf_c、PK_bound_face_c、PK_bound_body_c、PK_bound_sheet_c时生效。 nearest 是否将最近的相交实体视为边界,否则使用最远的相交视为边界,与nth_division配合使用。 nth_division 设置拉伸体与边界实体多次相交时的第N次相交视为边界。 side 当拉伸体与边界体相交时,保留二者的交集、差集或保留所有。 效果演示 
PK_ERROR_code_t PK_VERTEX_sweep
(
received arguments
PK_VERTEX_t vertex, end vertex of wire body
PK_VECTOR_t path, translation vector
PK_LOGICAL_t local_check, whether local checking will be done
returned arguments
PK_EDGE_t *const lateral, new edge
PK_VERTEX_t *const base, swept vertex
PK_local_check_t *const check_result result of local check
)struct PK_SWEPT_sf_s
{
PK_CURVE_t curve; curve to sweep
PK_VECTOR1_t direction; vector direction to sweep
};
PK_ERROR_code_t PK_SWEPT_create
(
received arguments
const PK_SWEPT_sf_t *swept_sf, swept surf standard form
returned arguments
PK_SWEPT_t *const swept swept surf
)PK_ERROR_code_t PK_CURVE_sweep
(
received arguments
PK_CURVE_t curve, curve to sweep
PK_VECTOR1_t direction, sweep direction
returned arguments
PK_SURF_t *const surf swept surface
)
This function sweeps a curve to form a surface.
The curve must be of one of the following classes:
PK_CLASS_line
PK_CLASS_circle
PK_CLASS_ellipse
PK_CLASS_bcurvePK_ERROR_code_t PK_BCURVE_sweep
(
received arguments
PK_BCURVE_t bcurve, bcurve
PK_VECTOR_t path, translation vector
returned arguments
PK_BSURF_t *const bsurf resulting bsurf
)PK_ERROR_code_t PK_FACE_sweep
(
received arguments
int n_faces, number of faces
const PK_FACE_t faces[], faces
PK_VECTOR_t path, translation vector
PK_LOGICAL_t local_check, whether local checking will be done
returned arguments
int *const n_laterals, number of laterals
PK_FACE_t const laterals, new faces (may be NULL)
PK_EDGE_t const bases, edges swept into laterals
(may be NULL)
PK_local_check_t *const check_result result of local check
)2.2 效果演示

PK_BODY_extrude_o_t extrude_o;
PK_BODY_extrude_o_m(extrude_o);
extrude_o.end_bound.distance = 30;
PK_TOPOL_track_r_t tracking;
PK_TOPOL_local_r_t results;
PK_BODY_t extrude_body = PK_ENTITY_null;
PK_BODY_extrude(circ_sheet, { 0, 0, 1 }, &extrude_o, &extrude_body, &tracking, &results);
三、PK_BODY_extrude算法的高级选项
struct PK_BODY_extrude_o_s
{
int o_t_version; /* options structure version */
PK_bound_def_t start_bound; /* starting bound of swept body */
PK_bound_def_t end_bound; /* ending bound of swept body */
PK_BODY_t extruded_body; /* body to use instead of swept */
PK_LOGICAL_t allow_disjoint; /* swept body can have a disjoint */
PK_PARAM_consistent_t consistent_params; /* whether to ensure consistent */
};
typedef struct PK_BODY_extrude_o_s PK_BODY_extrude_o_t;struct PK_bound_def_s
{
PK_bound_t bound; /* method of defining bound */
PK_LOGICAL_t forward; /* whether bound in positive sense of path */
double distance; /* extrusion distance */
PK_ENTITY_t entity; /* bounding entity */
PK_LOGICAL_t nearest; /* whether divisions are numbered from */
int nth_division; /* select nth division */
PK_bound_side_t side; /* which side is the first division if */
};
typedef struct PK_bound_def_s PK_bound_def_t;#define PK_BODY_extrude_o_m(options) \
( \
(options).o_t_version = 5, \
(options).start_bound.bound = PK_bound_distance_c, \
(options).start_bound.forward = PK_LOGICAL_true, \
(options).start_bound.distance = 0.0, \
(options).start_bound.entity = PK_ENTITY_null, \
(options).start_bound.nearest = PK_LOGICAL_true, \
(options).start_bound.nth_division = 1, \
(options).start_bound.side = PK_bound_side_both_c, \
(options).end_bound .bound = PK_bound_distance_c, \
(options).end_bound .forward = PK_LOGICAL_true, \
(options).end_bound .distance = 1.0, \
(options).end_bound .entity = PK_ENTITY_null, \
(options).end_bound .nearest = PK_LOGICAL_true, \
(options).end_bound .nth_division = 1, \
(options).end_bound .side = PK_bound_side_both_c, \
(options).extruded_body = PK_ENTITY_null, \
(options).allow_disjoint = PK_LOGICAL_false, \
(options).consistent_params = PK_PARAM_consistent_unset_c \
)
转载请注明来源本文地址:https://www.tuituisoft/gongyesheji/250126.html
上一篇:没有了
下一篇:没有了