| |
- builtins.object
-
- BoundedEntity
-
- BRepEntity(BoundedEntity, abc.ABC)
-
- Body
- Edge
- Face
- BoundingBox
- Component(BoundedEntity, abc.ABC)
-
- ComponentWithChildren(Component, abc.ABC)
-
- Chamfer
- Combination(ComponentWithChildren, abc.ABC)
-
- Difference
- Group
- Intersection
- Union
- ExtrudeBase
-
- Extrude
- ExtrudeTo
- Fillet
- Loft
- Scale
- SplitFace
- Threads
- Shape(Component, abc.ABC)
-
- BRepComponent
- Box
- Cylinder
- PlanarShape
-
- Circle
- Polygon
-
- RegularPolygon
- Rect
- Sphere
- Point
- Place
- Translation
class BRepComponent(Shape) |
|
Defines a Component for a set of raw BRepBody or BrepFace objects.
This can be useful when you need some advanced feature of Fusion's API that isn't supported by fscad, and can be
used to wrap the result of that advanced operation and let it be used within the fscad API.
Args:
*brep_entities: The BRepBody or BRepFace objects that this Component will contain
name: The name of the Component |
|
- Method resolution order:
- BRepComponent
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, *brep_entities:Union[adsk.fusion.BRepBody, adsk.fusion.BRepFace], name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class BRepEntity(BoundedEntity, abc.ABC) |
|
Represents a single BRep object.
This is the superclass of the various wrappers around the raw Fusion 360 Brep* related objects. |
|
- Method resolution order:
- BRepEntity
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __eq__(self, other)
- Return self==value.
- __init__(self, component:'Component')
- Initialize self. See help(type(self)) for accurate signature.
- __ne__(self, other)
- Return self!=value.
Data descriptors defined here:
- brep
- Returns: the raw BRep type that this object wraps
- component
- Returns: The Component that this entity is a part of
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
- __hash__ = None
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Body(BRepEntity) |
|
Represents a single Body.
This is a wrapper around Fusion 360's BRepBody object.
Args:
body: The BRepBody object to wrap
component: The Component that this BRepBody is a part of |
|
- Method resolution order:
- Body
- BRepEntity
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, body:adsk.fusion.BRepBody, component:'Component')
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- brep
- Returns: The raw BRepBody this object wraps.
- faces
- Returns: All Faces that are a part of this Body, or an empty Sequence if there are None.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from BRepEntity:
- __eq__(self, other)
- Return self==value.
- __ne__(self, other)
- Return self!=value.
Data descriptors inherited from BRepEntity:
- component
- Returns: The Component that this entity is a part of
Data and other attributes inherited from BRepEntity:
- __hash__ = None
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class BoundedEntity(builtins.object) |
|
This is the general superclass for any geometry object.
This provides some common functionality for all geometry objects, like the size, bounding box, etc.
It also provides the '-', '+' and '~' operator overloads that are intended for use by the `Component.place()`
method |
|
Methods defined here:
- __init__(self)
- Initialize self. See help(type(self)) for accurate signature.
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class BoundingBox(BoundedEntity) |
|
Represents a bounding box of another entity or set of entities.
This class is a wrapper around Fusion 360's BoundingBox3D object.
Args:
bounding_box: The BoundingBox3D to wrap. |
|
- Method resolution order:
- BoundingBox
- BoundedEntity
- builtins.object
Methods defined here:
- __init__(self, bounding_box:adsk.core.BoundingBox3D)
- Initialize self. See help(type(self)) for accurate signature.
- make_box(self) -> 'Box'
- Makes a Box component the same size and in the same location of this BoundingBox.
Returns: The new Box component.
Data descriptors defined here:
- bounding_box
- raw_bounding_box
- Returns: a copy of the raw BoundingBox3D that this object wraps.
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
|
class Box(Shape) |
|
Defines a box.
Args:
x: The size of the box in the x axis
y: The size of the box in the y axis
z: The size of the box in the z axis
name: The name of the Component |
|
- Method resolution order:
- Box
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, x:float, y:float, z:float, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- back
- Returns: The back face of the box. i.e. the Face in the positive Y direction.
- bottom
- Returns: The bottom Face of the box. i.e. the Face in the negative Z direction.
- front
- Returns: The front Face of the box. i.e. the Face in the negative Y direction.
- left
- Returns: The left Face of the box. i.e. the Face in the negative X direction.
- right
- Returns: The right Face of the box. i.e. the Face in the positive X direction.
- top
- Returns: The top Face of the box. i.e. The Face in the positive Z direction.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Chamfer(ComponentWithChildren) |
|
Represents a Chamfer operation on a set of edges from the same component.
Args:
edges: The edges to chamfer. All edges must be from the same component.
distance: The distance from the edge to start the chamfer. If distance2 is not given, this distance is used
for both sides of the edge.
distance2: If given, the distance from the other side of the edge to start the chamfer.
name: The name of the component |
|
- Method resolution order:
- Chamfer
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, edges:Iterable[fscad.Edge], distance:float, distance2:float=None, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Circle(PlanarShape) |
|
Defines a 2D circle.
Args:
radius: The radius of the circle
name: The name of the component |
|
- Method resolution order:
- Circle
- PlanarShape
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, radius:float, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from PlanarShape:
- get_plane(self) -> adsk.core.Plane
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Combination(ComponentWithChildren, abc.ABC) |
|
The top level Object of an fscad design.
A component is made up of one or more Bodies, and may also contain visible and hidden children. When constructing
one of the Component subclasses that are based an an input Component, that input Component will typically be made
a hidden child of the newly created Component.
The only case of a visible child currently is in the Group Component.
This roughly corresponds with a Component or Occurrence in Fusion's API/UI. Except that there is no corresponding
concept of having multiple Occurrences of a single Component. Instead, if a Component is used in multiple place in
the design, multiple copies of the Component must be made.
Creating a Component in itself doesn't actually create any object in the Fusion 360 document. You must call the
create_occurrence method to actually create the component in the document. This is typically the last operation
you would perform on the final top-level design component, after building it up from multiple sub-Components.
It can also be useful to visualize any intermediate Components for debugging purposes.
The reason for this is directly creating an object in the Fusion 360 document for every component/operation tends
to get very slow for even slightly complex objects. Instead, fscad tries to use temporary Brep objects as much as
possible, which are typically much faster to work with. |
|
- Method resolution order:
- Combination
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, name)
- Initialize self. See help(type(self)) for accurate signature.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Component(BoundedEntity, abc.ABC) |
|
The top level Object of an fscad design.
A component is made up of one or more Bodies, and may also contain visible and hidden children. When constructing
one of the Component subclasses that are based an an input Component, that input Component will typically be made
a hidden child of the newly created Component.
The only case of a visible child currently is in the Group Component.
This roughly corresponds with a Component or Occurrence in Fusion's API/UI. Except that there is no corresponding
concept of having multiple Occurrences of a single Component. Instead, if a Component is used in multiple place in
the design, multiple copies of the Component must be made.
Creating a Component in itself doesn't actually create any object in the Fusion 360 document. You must call the
create_occurrence method to actually create the component in the document. This is typically the last operation
you would perform on the final top-level design component, after building it up from multiple sub-Components.
It can also be useful to visualize any intermediate Components for debugging purposes.
The reason for this is directly creating an object in the Fusion 360 document for every component/operation tends
to get very slow for even slightly complex objects. Instead, fscad tries to use temporary Brep objects as much as
possible, which are typically much faster to work with. |
|
- Method resolution order:
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors defined here:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class ComponentWithChildren(Component, abc.ABC) |
|
The top level Object of an fscad design.
A component is made up of one or more Bodies, and may also contain visible and hidden children. When constructing
one of the Component subclasses that are based an an input Component, that input Component will typically be made
a hidden child of the newly created Component.
The only case of a visible child currently is in the Group Component.
This roughly corresponds with a Component or Occurrence in Fusion's API/UI. Except that there is no corresponding
concept of having multiple Occurrences of a single Component. Instead, if a Component is used in multiple place in
the design, multiple copies of the Component must be made.
Creating a Component in itself doesn't actually create any object in the Fusion 360 document. You must call the
create_occurrence method to actually create the component in the document. This is typically the last operation
you would perform on the final top-level design component, after building it up from multiple sub-Components.
It can also be useful to visualize any intermediate Components for debugging purposes.
The reason for this is directly creating an object in the Fusion 360 document for every component/operation tends
to get very slow for even slightly complex objects. Instead, fscad tries to use temporary Brep objects as much as
possible, which are typically much faster to work with. |
|
- Method resolution order:
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, name)
- Initialize self. See help(type(self)) for accurate signature.
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Cylinder(Shape) |
|
Defines a cylinder, a cone or a truncated cone.
Args:
height: The height of the cylinder
radius: The radius of the cylinder. If top_radius is also specified, this is the radius of the bottom of the
cylinder/cone.
top_radius: If provided, the radius of the top of the cylinder/cone
name: The name of the component |
|
- Method resolution order:
- Cylinder
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, height:float, radius:float, top_radius:float=None, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- bottom
- Returns: The bottom Face of the cylinder/cone. May be None for a cone with a bottom radius of 0.
- side
- Returns: The side Face of the cylinder/cone.
- top
- Returns: The top face of the cylinder/cone. May be None for a cone with a top radius of 0.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Difference(Combination) |
|
Represents the difference between a Component and any number of other Components.
Args:
*components: The Components to perform a difference on. The first Component will be the "positive"
Component, and any remaining Components will be subtracted from the first Component. If the first
Component is a non-planar Component, the remaining Components must also be non-planar. However, it is
valid to subtract a non-planar Component from a planar Component.
name: The name of the Component |
|
- Method resolution order:
- Difference
- Combination
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, *components:fscad.Component, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
- add(self, *components:fscad.Component) -> fscad.Component
- Adds new Components to this Difference.
The new Components will be subtracted from the first Component.
Args:
*components: The Components to add
Returns: `self`
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Combination:
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Edge(BRepEntity) |
|
Represents a single Edge.
This is a wrapper around Fusion 360's BRepEdge object.
Args:
edge: The BRepEdge object to wrap
body: The Body object that the BRepEdge is a part of |
|
- Method resolution order:
- Edge
- BRepEntity
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, edge:adsk.fusion.BRepEdge, body:fscad.Body)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- body
- Returns: The Body object that this edge is a part of.
- brep
- Returns: The raw BRepEdge this object wraps.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from BRepEntity:
- __eq__(self, other)
- Return self==value.
- __ne__(self, other)
- Return self!=value.
Data descriptors inherited from BRepEntity:
- component
- Returns: The Component that this entity is a part of
Data and other attributes inherited from BRepEntity:
- __hash__ = None
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Extrude(ExtrudeBase) |
|
Extrudes faces a certain distance.
Args:
entity: The object to extrude. This can be a Face, an iterable of Faces, or a planar Component.
height: The distance to extrude the faces
name: The name of the component |
|
- Method resolution order:
- Extrude
- ExtrudeBase
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, entity:Union[fscad.Component, fscad.Face, Iterable[fscad.Face]], height:float, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Data descriptors inherited from ExtrudeBase:
- end_faces
- The faces of the resulting body that correspond with the end of the extrusion.
- side_faces
- The faces of the resulting body that correspond to the sides of the extrusion.
- start_faces
- The faces of the resulting body that the extrude starts from.
If extruding an existing face of a 3d object, this will normally be empty. If extruding a face or set of faces,
this will normally be the starting faces that were used to perform the extrude.
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class ExtrudeBase(ComponentWithChildren) |
|
The top level Object of an fscad design.
A component is made up of one or more Bodies, and may also contain visible and hidden children. When constructing
one of the Component subclasses that are based an an input Component, that input Component will typically be made
a hidden child of the newly created Component.
The only case of a visible child currently is in the Group Component.
This roughly corresponds with a Component or Occurrence in Fusion's API/UI. Except that there is no corresponding
concept of having multiple Occurrences of a single Component. Instead, if a Component is used in multiple place in
the design, multiple copies of the Component must be made.
Creating a Component in itself doesn't actually create any object in the Fusion 360 document. You must call the
create_occurrence method to actually create the component in the document. This is typically the last operation
you would perform on the final top-level design component, after building it up from multiple sub-Components.
It can also be useful to visualize any intermediate Components for debugging purposes.
The reason for this is directly creating an object in the Fusion 360 document for every component/operation tends
to get very slow for even slightly complex objects. Instead, fscad tries to use temporary Brep objects as much as
possible, which are typically much faster to work with. |
|
- Method resolution order:
- ExtrudeBase
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, component:fscad.Component, faces:Iterable[adsk.fusion.BRepFace], extent, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- end_faces
- The faces of the resulting body that correspond with the end of the extrusion.
- side_faces
- The faces of the resulting body that correspond to the sides of the extrusion.
- start_faces
- The faces of the resulting body that the extrude starts from.
If extruding an existing face of a 3d object, this will normally be empty. If extruding a face or set of faces,
this will normally be the starting faces that were used to perform the extrude.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class ExtrudeTo(ExtrudeBase) |
|
Extrudes the specified faces until they intersect with the face of another object.
Args:
entity: The faces to extrude. This can be a Face, an Iterable of Faces or a planar Component.
to_entity: The object to extrude the faces to
name: The name of the component |
|
- Method resolution order:
- ExtrudeTo
- ExtrudeBase
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, entity:Union[fscad.Face, fscad.Component, Iterable[fscad.Face]], to_entity:Union[fscad.Component, fscad.Face, fscad.Body], name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Data descriptors inherited from ExtrudeBase:
- end_faces
- The faces of the resulting body that correspond with the end of the extrusion.
- side_faces
- The faces of the resulting body that correspond to the sides of the extrusion.
- start_faces
- The faces of the resulting body that the extrude starts from.
If extruding an existing face of a 3d object, this will normally be empty. If extruding a face or set of faces,
this will normally be the starting faces that were used to perform the extrude.
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Face(BRepEntity) |
|
Represents a single Face.
This is a wrapper around Fusion 360's BRepFace object.
Args:
face: The BRepFace object to wrap
body: The Body object that the BRepFace is a part of |
|
- Method resolution order:
- Face
- BRepEntity
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, face:adsk.fusion.BRepFace, body:fscad.Body)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- body
- Returns: The Body object that this edge is a part of.
- brep
- Returns: The raw BRepFace this object wraps.
- connected_faces
- Returns: All Faces that are connected to this Face, or an empty Sequence if there are None.
- edges
- Returns: All Edges that make up the boundary of this Face, or an empty Sequence if there are None.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from BRepEntity:
- __eq__(self, other)
- Return self==value.
- __ne__(self, other)
- Return self!=value.
Data descriptors inherited from BRepEntity:
- component
- Returns: The Component that this entity is a part of
Data and other attributes inherited from BRepEntity:
- __hash__ = None
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Fillet(ComponentWithChildren) |
|
Represents a Fillet operation on a set of edges from the same component.
Args:
edges: The edges to fillet. All edges must be from the same component.
radius: The fillet radius
blend_corners: If true, use fusion's "setback" corner type, otherwise use the "rolling ball" corner type.
name: The name of the component |
|
- Method resolution order:
- Fillet
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, edges:Iterable[fscad.Edge], radius:float, blend_corners:bool=False, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Group(Combination) |
|
Groups a set of Components without performing any operation on them.
This can be useful when you need to perform some operation on a group of Components, but don't want to Union or
otherwise join them together.
Args:
visible_children: The children to add as visible children
hidden_children: The children to add as hidden children
name: The name of the Component |
|
- Method resolution order:
- Group
- Combination
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, visible_children, hidden_children=None, name=None)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- bodies
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Combination:
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Intersection(Combination) |
|
Represents the intersection between multiple Components.
Args:
*components: The Components to intersect with each other. This can be a mix of planar and non-planar geometry.
name: The name of the Component |
|
- Method resolution order:
- Intersection
- Combination
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, *components:fscad.Component, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
- add(self, *components:fscad.Component) -> fscad.Component
- Adds new Components to this intersection.
Args:
*components: The the new Components to add to this intersection.
Returns: `self`
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Combination:
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Loft(ComponentWithChildren) |
|
Represents a body created by lofting through a set of faces.
Currently, only a basic loft is supported. Support for center lines and guide rails, etc. is not yet implemented.
Args:
*components: The Components to loft through. These must all be planar Components.
name: The name of the Component |
|
- Method resolution order:
- Loft
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, *components:fscad.Component, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- bottom
- The bottom (starting) face of the loft.
- sides
- All side faces of the loft.
- top
- The top (ending) face of the loft.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Place(builtins.object) |
|
An intermediate object intended for use with the `Component.place()` method.
The idea is that you can get the Place object for various defined points on an object, and then use the `==`
operator with another Place or point-like object to get a vector between them, which can be used to "place" one
object as some location relative to another.
You typically get a Place object via the '-', '+' and '~' unary operator overloads on a BoundedEntity object.
Args:
point: The Point3D that this Place object represents. |
|
Methods defined here:
- __eq__(self, other:Union[_ForwardRef('Place'), float, int, adsk.core.Point3D]) -> fscad.Translation
- Return self==value.
- __init__(self, point:adsk.core.Point3D)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- __hash__ = None
|
class PlanarShape(Shape) |
|
The top level Object of an fscad design.
A component is made up of one or more Bodies, and may also contain visible and hidden children. When constructing
one of the Component subclasses that are based an an input Component, that input Component will typically be made
a hidden child of the newly created Component.
The only case of a visible child currently is in the Group Component.
This roughly corresponds with a Component or Occurrence in Fusion's API/UI. Except that there is no corresponding
concept of having multiple Occurrences of a single Component. Instead, if a Component is used in multiple place in
the design, multiple copies of the Component must be made.
Creating a Component in itself doesn't actually create any object in the Fusion 360 document. You must call the
create_occurrence method to actually create the component in the document. This is typically the last operation
you would perform on the final top-level design component, after building it up from multiple sub-Components.
It can also be useful to visualize any intermediate Components for debugging purposes.
The reason for this is directly creating an object in the Fusion 360 document for every component/operation tends
to get very slow for even slightly complex objects. Instead, fscad tries to use temporary Brep objects as much as
possible, which are typically much faster to work with. |
|
- Method resolution order:
- PlanarShape
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, body:adsk.fusion.BRepBody, name:str)
- Initialize self. See help(type(self)) for accurate signature.
- get_plane(self) -> adsk.core.Plane
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Point(BoundedEntity) |
|
Represents a single 3D Point.
This class is a wrapper around Fusion 360's Point3D class.
This is useful, for example, for being able to align a Component relative to a Point via the Component.place()
method. e.g. component.place(~component == point, +component == point, -component == point)
Args:
point: The Point3D to wrap. |
|
- Method resolution order:
- Point
- BoundedEntity
- builtins.object
Methods defined here:
- __init__(self, point:adsk.core.Point3D)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- point
- Returns the raw Point3D object that this class wraps.
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Polygon(PlanarShape) |
|
Defines an arbitrary 2D polygon.
Args:
*points: A sequence of vertices of the polygon. An edge will be added between each adjacent point in the
sequence, and also one between the first and last point.
name: The name of the component |
|
- Method resolution order:
- Polygon
- PlanarShape
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, *points:Union[Tuple[float, float], adsk.core.Point2D, adsk.core.Point3D, fscad.Point], name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from PlanarShape:
- get_plane(self) -> adsk.core.Plane
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Rect(PlanarShape) |
|
Defines a 2D rectangle.
Args:
x: The size of the rectangle in the x axis
y: The size of the rectangle in the y axis
name: The name of the component |
|
- Method resolution order:
- Rect
- PlanarShape
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, x:float, y:float, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from PlanarShape:
- get_plane(self) -> adsk.core.Plane
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class RegularPolygon(Polygon) |
|
Defines a regular 2D polygon.
Args:
sides: The number of sides of the polygon
radius: The "radius" of the polygon. This is normally the distance from the center to the midpoint of a side.
Also known as the apothem or inradius. If is_outer_radius is True, this is instead the distance from the
center to a vertex.
is_outer_radius: Whether radius is specified as the apothem/inradius, or the outer radius
name: The name of the component |
|
- Method resolution order:
- RegularPolygon
- Polygon
- PlanarShape
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, sides:int, radius:float, is_outer_radius:bool=True, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from PlanarShape:
- get_plane(self) -> adsk.core.Plane
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Scale(ComponentWithChildren) |
|
Represents a uniform on non-uniform scaling operation on a component
For uniform scaling, its usually preferred to just use `Component.scale`, which is limited to uniform scaling. This
class is useful when you need to perform a non-uniform scale.
Args:
component: The component to scale
sx: The scaling ratio in the x axis
sy: The scaling ratio in the y axis
sz: The scaling ratio in the z axis
center: The center of the scaling operation. Defaults to (0, 0, 0) if not specified.
name: The name of the component |
|
- Method resolution order:
- Scale
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, component:fscad.Component, sx:float=1, sy:float=1, sz:float=1, center:Union[adsk.core.Point3D, fscad.Point, Tuple[float, float, float]]=None, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Shape(Component, abc.ABC) |
|
The top level Object of an fscad design.
A component is made up of one or more Bodies, and may also contain visible and hidden children. When constructing
one of the Component subclasses that are based an an input Component, that input Component will typically be made
a hidden child of the newly created Component.
The only case of a visible child currently is in the Group Component.
This roughly corresponds with a Component or Occurrence in Fusion's API/UI. Except that there is no corresponding
concept of having multiple Occurrences of a single Component. Instead, if a Component is used in multiple place in
the design, multiple copies of the Component must be made.
Creating a Component in itself doesn't actually create any object in the Fusion 360 document. You must call the
create_occurrence method to actually create the component in the document. This is typically the last operation
you would perform on the final top-level design component, after building it up from multiple sub-Components.
It can also be useful to visualize any intermediate Components for debugging purposes.
The reason for this is directly creating an object in the Fusion 360 document for every component/operation tends
to get very slow for even slightly complex objects. Instead, fscad tries to use temporary Brep objects as much as
possible, which are typically much faster to work with. |
|
- Method resolution order:
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, *bodies:adsk.fusion.BRepBody, name:str)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Sphere(Shape) |
|
Defines a sphere.
Args:
radius: The radius of the sphere
name: The name of the component |
|
- Method resolution order:
- Sphere
- Shape
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, radius:float, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- surface
- Returns: the Face representing the surface of the sphere.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- children(self) -> Iterable[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_children(self, name, recursive=True) -> Sequence[_ForwardRef('Component')]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class SplitFace(ComponentWithChildren) |
|
Splits the faces of a Component at the areas where it intersects with another Face or Component.
Args:
component: The Component to split the faces of
splitting_tool: The Face or Component to use to split the faces
name: The name of the component |
|
- Method resolution order:
- SplitFace
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, component:fscad.Component, splitting_tool:Union[fscad.Face, fscad.Component], name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data descriptors defined here:
- split_faces
- Returns: The new faces that were created by this Split operation.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Threads(ComponentWithChildren) |
|
Represents the result of adding threads to a cylindrical object/face.
E.g., to create a triangular thread profile with 45 degree upper and lower faces, and a pitch of 1mm::
cylinder = Cylinder(10, 1)
threaded_cylinder = Threads(cylinder,
[(0, 0), (.5, .5), (0, 1)],
1)
Args:
entity: The Component or Face to add threads to. If a Component is given, there must be exactly 1
cylindrical face present in the Component. If a Face is given, it must be a cylindrical face. In either
case, a partial cylindrical face is acceptable.
thread_profile: The thread profile as a list of (x, y) tuples. (0, 0) is the "origin" of the thread profile,
while +x is a vector perpendicular and away from the face of the cylinder, and +y is a vector parallel with
the axis of the cylinder, pointing toward the top.
pitch:
The distance between each thread
reverse_axis:
In case of non-symmetric threads, the direction can be important. Set this to true to reverse the direction
of the threads, so the top is bottom, and vice versa. Note: This does not change the handed-ness of the
thread. To make a left-handed thread, you can apply a mirror operation afterward.
name: The name of the component |
|
- Method resolution order:
- Threads
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, entity:Union[fscad.Component, fscad.Face], thread_profile:Iterable[Tuple[float, float]], pitch:float, reverse_axis=False, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
|
class Translation(builtins.object) |
|
A wrapper around a Vector3D, that provides functionality useful for use with the `Component.place` method.
This is primarily used as an intermediate object within a placement expression within a Component.place() call. It
allows specifying an additive or multiplicative offset to the base placement vector. This object is typically
returned by the Place object's '==' operator overload.
Args:
vector: The Vector3D that this Translation object wraps. |
|
Methods defined here:
- __add__(self, other:float) -> 'Translation'
- Modifies this Translation object by adding the given constant to every component.
Returns: This Translation object with the specified addition applied.
- __div__(self, other:float) -> 'Translation'
- Modifies this Translation object by dividing every component by the given value.
Returns: This Translation object with the specified division applied.
- __init__(self, vector:adsk.core.Vector3D)
- Initialize self. See help(type(self)) for accurate signature.
- __mul__(self, other:float) -> 'Translation'
- Modifies this Translation object by multiplying every component by the given value.
Returns: This Translation object with the specified multiplication applied.
- __sub__(self, other:float) -> 'Translation'
- Modifies this Translation object by subtracting the given value from every component.
Returns: This Translation object with the specified subtraction applied.
- vector(self) -> adsk.core.Vector3D
- Return: The Vector3D that this Translation wraps.
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- x
- Returns: the X component of this Translation.
- y
- Returns: the Y component of this Translation.
- z
- Returns: the Z component of this Translation.
|
class Union(Combination) |
|
Unions a number of Components together.
Args:
*components: The Components to union together. The Components must be all planar, or all non-planar.
name: The name of the Component |
|
- Method resolution order:
- Union
- Combination
- ComponentWithChildren
- Component
- BoundedEntity
- abc.ABC
- builtins.object
Methods defined here:
- __init__(self, *components:fscad.Component, name:str=None)
- Initialize self. See help(type(self)) for accurate signature.
- add(self, *components:fscad.Component) -> fscad.Component
- Adds new Components to this Union.
Args:
*components: The Components to add to this Union. If the existing Components are planar, the new Components
must also be planar, or if the existing Components are non-planar, the new Components must also be
non-planar.
Returns: `self`
Data and other attributes defined here:
- __abstractmethods__ = frozenset()
Methods inherited from Combination:
- get_plane(self) -> Union[adsk.core.Plane, NoneType]
- Returns: The plane that this Component lies in, or None if this is not a Planar component.
Methods inherited from ComponentWithChildren:
- children(self) -> Sequence[_ForwardRef('Component')]
- Returns: All direct children of this Component.
- find_children(self, name, recursive=True) -> Sequence[fscad.Component]
- Find any children of this Component with the given name.
Args:
name: The name of the children to find
recursive: If true, look for all children anywhere in the Component hierarchy under this Component. If
false, only look for the direct children of this Component.
Returns: The children with the given name, or an empty Sequence if none are found.
Methods inherited from Component:
- add_named_faces(self, name:str, *faces:fscad.Face)
- Associates a name with the specified Faces in this Component.
The Faces can later be looked up by name using `named_faces(name)`
Args:
name: The name to associate with the given Faces.
*faces: The faces to associate a name with. These must be Faces within this Component.
- add_named_point(self, name:str, point:Union[Sequence[float], adsk.core.Point3D, fscad.Point])
- Adds a point to this Component with the given name.
The added point will remain in the same relative position in the component even when the component is
moved/transformed.
Args:
name: The name of the point to add.
point: A point to add to this Component. This may be any arbitrary point, it doesn't have to be an object
(vertex, etc.) already associated with this Component.
- align_to(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]], vector:adsk.core.Vector3D) -> 'Component'
- Moves this component along the given vector until it touches the specified entity.
This uses a potentially iterative method based on the shortest distant between the 2 entities. In some cases,
this may take many iterations to complete. For example, if there is a section where there are 2 parallel faces
that are sliding past each other with a very small space between them.
Args:
entity: The entity representing the end point of the movement. The movement will stop once the object is
within Fusion 360's point tolerance of this entity(`Application.pointTolerance`). It is guaranteed that
this object will be exactly touching, or almost touching (within the above tolerance), but will *not*
be "past" touching this entity.
vector: The vector to move this component along
Returns: `self`
Raises:
ValueError: If the entities do not intersect along the given vector. If this occurs, this Component will
remain in its original position.
- closest_points(self, entity:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), _ForwardRef('Point'), Iterable[_ForwardRef('_entity_types')]]]]]]]]) -> Tuple[adsk.core.Point3D, adsk.core.Point3D]
- Finds the points on this entity and the specified entity that are closest to one another.
In the case of parallel faces or other cases where there may be multiple sets of points at the same
minimum distance, the exact points that are returned are unspecified.
Args:
entity: The entity to find the closest points with.
Returns: A tuple of 2 Point3D objects. The first will be a point on this Component, and the second will be
a point on the other entity.
- copy(self, copy_children=True) -> 'Component'
- Makes a copy of this Component.
Args:
copy_children: If true, the entire Component hierarchy under this Component is also copied. If false,
only "visible" children are copied. Group is currently the only Component type that has visible
children.
Returns: A new copy of this Component.
- create_occurrence(self, create_children=False, scale=1) -> adsk.fusion.Occurrence
- Creates an occurrence of this Component in the root of the document in Fusion 360.
No objects are actually added to the Fusion 360 design until this method is called. This should be called
once for every top level Component in your design.
It is typically much quicker to create a component without children, so this is typically what you would want to
do, unless there is a specific reason you need the children.
Creating the children can be useful for debugging purposes, to be able to drill down into the design to find a
specific sub-component in the context of the overall design.
Args:
create_children: If true, also add any children of this Component recursively as hidden children of the
corresponding Occurrence in the Fusion 360 document.
scale: If specified, the Occurrence in Fusion 360 will be created at the given scale, with the scale
operation centered at the origin. This is most useful if you want to normally work in mm units, since
Fusion 360's default unit for the API is cm. You can simply work in mm everywhere in the script, and
then specify a scale value of .1 in the call to create_occurrence.
Returns: The `Occurrence` that was created in the Fusion 360 document.
- find_faces(self, selector:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Face]
- Finds any faces that is coincident with any face in the given entities.
This finds any face in this Component whose intersection with one of the faces in the face selectors is also a
face. i.e. two faces that intersect in a point or a curve are not considered coincident.
Args:
selector: The entities used to find any coincident faces of in this Component
Returns: A Sequence of the Faces that are coincident with one of the selector's Faces, or an empty Sequence if
there are no such faces.
- named_faces(self, name) -> Union[Sequence[fscad.Face], NoneType]
- Gets all faces with the specified name in this Component.
Args:
name: The name of the face
Returns: A Sequence of Faces, or None if no Faces with the given name were found.
- named_point(self, name) -> Union[fscad.Point, NoneType]
- Gets the Point in this Component with the given name.
Args:
name: The name of the Point to get
Returns: The point with the given name, or None if no such point exists in this Component.
- place(self, x:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, y:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>, z:Union[adsk.core.Vector3D, _ForwardRef('Translation'), adsk.core.Point3D]=<adsk.core.Vector3D object at 0x000002BB6D750128>)
- Moves this component by the individual axes component of each of the 3 specified vectors.
This is a powerful method that can be used in various ways to specify the location of a component.
It is typically used to place this Component at some position relative to another Component or other
BoundedEntity. This takes advantage of the __neg__ (-), __pos__ (+) and __invert__ (~) operator overrides on
BoundedEntity that return a Place object, and also the __eq__ (==) operator override in the Place object.
'-' is used to denote the minimum value of the entity in one of the 3 axes, '+' is used to denote the maximum,
and '~' is used to denote the midpoint.
You can leave out any of the placement components and this Component won't be moved along that axis.
For example, to place this Component so that the minimum x, y and z points are aligned with the midpoint of
another object, you could do::
component.place(-component == ~other_component,
-component == ~other_component,
-component == ~other_component)
or a slightly more complex example::
component.place(-component == ~other_component,
+component == -other_component,
~component == +other_component)
This would place this component so that the minimum x bound of this object is aligned with the mid X point of
the other object, the maximum y bound with the negative y bound, and the mid Z point with the maximum Z bound.
You can also specify an offset to the alignment::
component.place((-component == ~other_component) + 10,
+component == -other_component,
~component == +other_component)
This is the same as the previous example, except that the component is translated by an additional 10 cm in the
x axis. Note that due to operator precedence, parenthesis are required around the == statement in this case.
It can also be occasionally useful to specify an alignment based on some different object::
component.place((-other_component == +some_other_component))
And finally, you can also use this to specify a specific numeric location for any of the major axes::
component.place(~component == 3, -component == 10, +component == -233.4471)
Args:
x: This Component will be translated by the x component of this vector.
y: This Component will be translated by the y component of this vector.
z: This Component will be translated by the z component of this vector.
Returns: `self`
- rotate(self, rx:float=0, ry:float=0, rz:float=0, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component.
The component will first be rotated around the X axis, then the Y axis, then the Z axis.
Args:
rx: The angle in degrees to rotate this object around the X axis by.
ry: The angle in degrees to rotate this object around the Y axis by.
rz: The angle in degrees to rotate this object around the Z axis by.
center: If given, the rotation will occur around an axis parallel with each of the 3 major axes that run
through this point.
Returns: `self`
- rx(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the X axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the X axis that runs through this
point.
Returns: `self`
- ry(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Y axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Y axis that runs through this
point.
Returns: `self`
- rz(self, angle:float, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Rotates this Component around the Z axis.
Args:
angle: The angle in degrees to rotate this object by.
center: If given, the rotation will occur around an axis parallel with the Z axis that runs through this
point.
Returns: `self`
- scale(self, sx:float=1, sy:float=1, sz:float=1, center:Union[Iterable[Union[float, int]], adsk.core.Point3D]=None) -> 'Component'
- Uniformly scales this object.
A mirror along one of the 3 major axes can also be achieved by specifying a negative scale factor, but the
absolute value of all scale factors must be equal.
Args:
sx: The scale factor along the X axis
sy: The scale factor along the Y axis
sz: The scale factor along the Z axis
center: The center of the scale operation. If not specified, the center will be the origin.
Returns: `self`
- shared_edges(self, face_selector1:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]], face_selector2:Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[Union[_ForwardRef('Component'), _ForwardRef('Body'), _ForwardRef('Face'), Iterable[_ForwardRef('_face_selector_types')]]]]]]]]) -> Sequence[fscad.Edge]
- Finds any shared edges between any Face matching face_selector1, and any Face matching face_selector2.
Args:
face_selector1: A set of face selectors for the first set of faces
face_selector2: A set of face selectors for the second set of faces
Returns: All edges that are shared between the 2 sets of faces.
- translate(self, tx:float=0, ty:float=0, tz:float=0) -> 'Component'
- Translates this Component the given distances along the 3 major axes.
Args:
tx: The distance to move this Component in the X axis.
ty: The distance to move this Component in the Y axis.
tz: The distance to move this Component in the Z axis.
Returns: `self`
- tx(self, tx:float) -> 'Component'
- Translates this Component the given distance in the X axis.
Args:
tx: The distance to move this Component in the X axis.
Returns: `self`
- ty(self, ty:float) -> 'Component'
- Translates this Component the given distance in the Y axis.
Args:
ty: The distance to move this Component in the Y axis.
Returns: `self`
- tz(self, tz:float) -> 'Component'
- Translates this Component the given distance in the Z axis.
Args:
tz: The distance to move this Component in the Z axis.
Returns: `self`
Data descriptors inherited from Component:
- bodies
- Returns: All bodies that make up this Component.
- parent
- Returns: The parent Component of this Component, or None if this Component is a top-level Component with no
parent.
Data and other attributes inherited from Component:
- name = Ellipsis
Methods inherited from BoundedEntity:
- __invert__(self) -> fscad.Place
- Returns: a Place object that represents this entity's midpoint.
- __neg__(self) -> fscad.Place
- Returns: a Place object that represents this entity's negative bound.
- __pos__(self) -> fscad.Place
- Returns: a Place object that represents this entity's positive bound.
- max(self) -> adsk.core.Point3D
- Returns: The maximum point of this entity's bounding box.
- mid(self) -> adsk.core.Point3D
- Returns: The geometric midpoint of this entity.
- min(self) -> adsk.core.Point3D
- Returns: The minimum point of this entity's bounding box.
- size(self) -> adsk.core.Vector3D
- Returns: The size of this entity as a Vector3D.
Data descriptors inherited from BoundedEntity:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
- bounding_box
- Returns: The bounding box of this entity.
| |