Sketch
类型: 类
领域: 草图
推荐导入: from cadflow import Sketch
签名
class Sketch(curves: 'Iterable[Edge | Wire] | None' = None, *, name: 'Optional[str]' = None, plane: 'Any' = 'XY', sketch_id: 'Optional[str]' = None) -> 'None'
功能说明
Sketch 是 CadFlow 草图领域的公共类。
原始 API 说明
Declarative constrained sketch container.
Use make_sketch_rsketch(...), add_point_rsketch(...), add_line_rsketch(...), add_circle_rsketch(...), and constrain_*_rsketch(...) as the canonical API for building sketch profiles. Public sketch construction APIs are functional and return an updated Sketch document. The legacy curves constructor remains only for reading already-built wire/edge containers.
参数
| 名称 | 类型 | 必需 | 默认值 | 源码说明 |
|---|---|---|---|---|
curves | 'Iterable[Edge | Wire] | None' | 否 | None | 源码 Docstring 未单独说明。 |
name | 'Optional[str]' | 否 | None | 源码 Docstring 未单独说明。 |
plane | 'Any' | 否 | 'XY' | 源码 Docstring 未单独说明。 |
sketch_id | 'Optional[str]' | 否 | None | 源码 Docstring 未单独说明。 |
返回值
类型: 'None'
源码 Docstring 未声明更多返回语义。
异常
源码 Docstring 未声明更窄的异常契约。类型、数值、所有权、路径或后端状态无效时,仍可能抛出相应公共异常。
公共成员
| 成员 | 类型 | 签名 | 说明 |
|---|---|---|---|
add_arc | method | (self, entity_id: 'str', start: 'SketchRef', end: 'SketchRef', center: 'SketchRef', *, construction: 'bool' = False) -> "'Sketch'" | Add an arc edge defined by start point, end point, and center point. |
add_bspline | method | (self, entity_id: 'str', start: 'SketchRef', end: 'SketchRef', control_points: 'Sequence[Any]', degree: 'int' = 3, knots: 'Optional[Sequence[float]]' = None, multiplicities: 'Optional[Sequence[int]]' = None, weights: 'Optional[Sequence[float]]' = None, periodic: 'bool' = False, *, construction: 'bool' = False) -> "'Sketch'" | Add a B-spline whose poles participate in sketch solving. |
add_circle | method | (self, entity_id: 'str', center: 'SketchRef', radius: 'ScalarLike', *, construction: 'bool' = False) -> "'Sketch'" | 见成员签名。 |
add_constraint | method | (self, kind: 'str', targets: 'Sequence[SketchRef]', *, value: 'Any' = None, constraint_id: 'Optional[str]' = None, driving: 'bool' = True, metadata: 'Optional[Dict[str, Any]]' = None) -> "'Sketch'" | 见成员签名。 |
add_curve | method | (self, curve: 'Edge | Wire') -> "'Sketch'" | 见成员签名。 |
add_line | method | (self, entity_id: 'str', start: 'SketchRef', end: 'SketchRef', *, construction: 'bool' = False) -> "'Sketch'" | 见成员签名。 |
add_point | method | (self, point_id: 'str', x: 'ScalarLike', y: 'ScalarLike') -> 'SketchRef' | 见成员签名。 |
clone | method | (self, *, include_solve: 'bool' = True) -> "'Sketch'" | 见成员签名。 |
closed_wires | method | (self) -> 'List[Wire]' | 见成员签名。 |
curves | method | (self) -> 'List[Edge | Wire]' | 见成员签名。 |
from_dict | class method | (cls, data: 'Mapping[str, Any]') -> "'Sketch'" | 见成员签名。 |
make_face | method | (self, profile: 'int | str' = 0, *, inner_profiles: 'Sequence[int | str]' = (), solve_result: 'Optional[SketchSolveResult]' = None) -> 'Face' | 见成员签名。 |
make_wire | method | (self, profile: 'int | str' = 0, *, solve_result: 'Optional[SketchSolveResult]' = None) -> 'Wire' | 见成员签名。 |
point_ref | method | (self, path: 'str') -> 'SketchRef' | 见成员签名。 |
ref | method | (self, entity_id: 'str', *, kind: 'Optional[str]' = None, subentity: 'str' = 'geometry') -> 'SketchRef' | 见成员签名。 |
resolve_point_id | method | (self, ref: 'SketchRef') -> 'str' | 见成员签名。 |
resolve_target | method | (self, target: 'Union[SketchRef, str]', *, expected: 'Optional[Union[str, Sequence[str]]]' = None) -> 'SketchRef' | 见成员签名。 |
solve | method | (self, *, require_fully_constrained: 'bool' = False, strict: 'bool' = True, tolerance: 'float' = 1e-07, max_iterations: 'int' = 80, backend: 'Any' = None) -> 'SketchSolveResult' | 见成员签名。 |
solved_result | method | (self) -> 'SketchSolveResult' | 见成员签名。 |
to_dict | method | (self) -> 'Dict[str, Any]' | 见成员签名。 |
to_face | method | (self, profile: 'int | str' = 0, *, inner_profiles: 'Sequence[int | str]' = ()) -> 'Face' | 见成员签名。 |
to_faces | method | (self) -> 'List[Face]' | 见成员签名。 |
validate_ref | method | (self, ref: 'SketchRef') -> 'None' | 见成员签名。 |
行为与约束
- 以下契约由当前公共运行时签名生成;所有权与工作流限制见对应领域说明。
导入检查
from cadflow import Sketch