docs poc
This commit is contained in:
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.data_objects.DataObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.data_objects.QgisObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IBlenderObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.ICurve
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IDataObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IDisplayValue
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IBlenderObject
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IHasArea
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IHasUnits
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IHasVolume
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.interfaces.IProperties
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.other.RenderMaterial
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.primitive.Interval
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.proxies.ColorProxy
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.proxies.GroupProxy
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.proxies.InstanceDefinitionProxy
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.proxies.InstanceProxy
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.proxies.RenderMaterialProxy
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.box.Box
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.circle.Circle
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.control_point.ControlPoint
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.ellipse.Ellipse
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.line.Line
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.mesh.Mesh
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.plane.Plane
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.point.Point
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.point_cloud.PointCloud
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.polycurve.Polycurve
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.polyline.Polyline
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.spiral.Spiral
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.surface.Surface
|
||||
@@ -0,0 +1 @@
|
||||
::: specklepy.objects.geometry.vector.Vector
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 386 B |
+24
-12
@@ -1,17 +1,29 @@
|
||||
# Welcome to MkDocs
|
||||
# Introduction
|
||||
|
||||
For full documentation visit [mkdocs.org](https://www.mkdocs.org).
|
||||
Welcome to the Specklepy Developer Docs - a single source of documentation on everything Specklepy! If you're looking for info on how to use Speckle, check our [user guide](https://speckle.guide/).
|
||||
|
||||
## Commands
|
||||
### Code Repository
|
||||
The Python SDK can be found in our [repository](//github.com/specklesystems/specklepy), its readme contains instructions on how to build it.
|
||||
|
||||
* `mkdocs new [dir-name]` - Create a new project.
|
||||
* `mkdocs serve` - Start the live-reloading docs server.
|
||||
* `mkdocs build` - Build the documentation site.
|
||||
* `mkdocs -h` - Print help message and exit.
|
||||
### Installation
|
||||
You can install it using pip
|
||||
```
|
||||
pip install specklepy
|
||||
```
|
||||
|
||||
## Project layout
|
||||
### Key Components
|
||||
|
||||
mkdocs.yml # The configuration file.
|
||||
docs/
|
||||
index.md # The documentation homepage.
|
||||
... # Other markdown pages, images and other files.
|
||||
SpecklePy has three main parts:
|
||||
|
||||
1. a `SpeckleClient` which allows you to interact with the server API
|
||||
2. `operations` and `transports` for sending and receiving large objects
|
||||
3. a `Base` object and accompaniying serializer for creating and customizing your own Speckle objects
|
||||
|
||||
|
||||
### Local Data Paths
|
||||
|
||||
It may be helpful to know where the local accounts and object cache dbs are stored. Depending on on your OS, you can find the dbs at:
|
||||
|
||||
- Windows: `APPDATA` or `<USER>\AppData\Roaming\Speckle`
|
||||
- Linux: `$XDG_DATA_HOME` or by default `~/.local/share/Speckle`
|
||||
- Mac: `~/.config/Speckle`
|
||||
|
||||
+42
-6
@@ -1,6 +1,39 @@
|
||||
site_name: SpecklePy API Docs
|
||||
site_name: Specklepy Docs
|
||||
theme:
|
||||
name: material
|
||||
favicon: assets/speckle_logo.png
|
||||
logo: assets/speckle_logo.png
|
||||
features:
|
||||
- navigation.tabs
|
||||
palette:
|
||||
# Palette toggle for light mode
|
||||
- scheme: default
|
||||
primary: white
|
||||
toggle:
|
||||
icon: material/weather-night
|
||||
name: Switch to dark mode
|
||||
|
||||
# Palette toggle for dark mode
|
||||
- scheme: slate
|
||||
primary: black
|
||||
logo: assets/logo_white.png
|
||||
toggle:
|
||||
icon: material/weather-sunny
|
||||
name: Switch to light mode
|
||||
|
||||
|
||||
|
||||
markdown_extensions:
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
line_spans: __span
|
||||
pygments_lang_class: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
- pymdownx.superfences
|
||||
|
||||
extra_css:
|
||||
- css/mkdocstrings.css
|
||||
|
||||
plugins:
|
||||
- search
|
||||
@@ -9,6 +42,7 @@ plugins:
|
||||
python:
|
||||
paths: [.]
|
||||
options:
|
||||
parameter_headings: false
|
||||
members_order: source
|
||||
separate_signature: true
|
||||
filters: ["!^_"] #Ignore _ prefixed properties
|
||||
@@ -18,11 +52,13 @@ plugins:
|
||||
show_signature_annotations: true
|
||||
signature_crossrefs: true
|
||||
show_if_no_docstring: true
|
||||
show_labels: true
|
||||
show_source: true
|
||||
show_symbol_type_heading: true
|
||||
show_symbol_type_toc: true
|
||||
show_bases: false
|
||||
heading_level: 3
|
||||
|
||||
inventories:
|
||||
- url: https://docs.python.org/3/objects.inv
|
||||
domains: [py, std]
|
||||
# selection:
|
||||
# docstring_style: google # Ensures Google-style docstrings are parsed correctly
|
||||
rendering:
|
||||
show_root_heading: true
|
||||
show_source: true
|
||||
|
||||
@@ -323,6 +323,30 @@ def _validate_type(t: Optional[type], value: Any) -> Tuple[bool, Any]:
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class Base(_RegisteringBase, speckle_type="Base"):
|
||||
"""Base class for all Speckle objects.
|
||||
|
||||
The base object class is the foundation of all data being
|
||||
transferred with Speckle. Any custom data structure that you want to transfer via
|
||||
Speckle should inherit from it.
|
||||
|
||||
Objects in Speckle are immutable for storage purposes. When any property changes,
|
||||
the object gets a new identity (hash). This hash is stored in the `id` property
|
||||
after serialization.
|
||||
|
||||
Attributes:
|
||||
id: Unique identifier (hash) for the object. This is typically
|
||||
set automatically during serialization and depends on the object's properties.
|
||||
applicationId: Optional identifier for the application that created
|
||||
this object, can store the host application's native object ID.
|
||||
|
||||
```py title="Example"
|
||||
from specklepy.objects.base import Base
|
||||
obj = Base(id="some-id", applicationId="my-app")
|
||||
obj["custom_prop"] = 42 # Add a dynamic property
|
||||
obj["@detached_prop"] = another_object # Add a detached property
|
||||
```
|
||||
"""
|
||||
|
||||
id: Union[str, None] = None
|
||||
# totalChildrenCount: Union[int, None] = None
|
||||
applicationId: Union[str, None] = None
|
||||
|
||||
@@ -13,6 +13,10 @@ class DataObject(
|
||||
speckle_type="Objects.Data.DataObject",
|
||||
detachable={"displayValue"},
|
||||
):
|
||||
"""
|
||||
A generic data object that can hold arbitrary properties and display values.
|
||||
"""
|
||||
|
||||
name: str
|
||||
properties: Dict[str, object]
|
||||
displayValue: List[Base]
|
||||
|
||||
@@ -10,15 +10,27 @@ from specklepy.objects.interfaces import ICurve, IHasUnits
|
||||
@dataclass(kw_only=True)
|
||||
class Arc(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Arc"):
|
||||
"""
|
||||
An arc defined by a plane, start point, mid point and end point.
|
||||
|
||||
attributes:
|
||||
plane: asdfji;sfd
|
||||
plane: asdfji;sfd
|
||||
midPoint: ajosdfds
|
||||
endPoint: ajosdfds
|
||||
This class represents a circular arc in 3D space, defined by three points
|
||||
and a plane. The arc is a portion of a circle that lies on the specified plane.
|
||||
|
||||
properties:
|
||||
radius: asdfsadf
|
||||
Attributes:
|
||||
plane: The plane on which the arc lies
|
||||
startPoint: The starting point of the arc
|
||||
midPoint: A point on the arc between the start and end points
|
||||
endPoint: The ending point of the arc.
|
||||
|
||||
|
||||
```py title="Example"
|
||||
from specklepy.objects.geometry.plane import Plane
|
||||
from specklepy.objects.geometry.point import Point
|
||||
plane = Plane(origin=Point(0, 0, 0), normal=Point(0, 0, 1))
|
||||
start = Point(1, 0, 0)
|
||||
mid = Point(0.7071, 0.7071, 0)
|
||||
end = Point(0, 1, 0)
|
||||
arc = Arc(plane=plane, startPoint=start, midPoint=mid, endPoint=end)
|
||||
```
|
||||
"""
|
||||
|
||||
plane: Plane
|
||||
@@ -28,10 +40,20 @@ class Arc(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Arc"):
|
||||
|
||||
@property
|
||||
def radius(self) -> float:
|
||||
"""Calculates the radius of the arc.
|
||||
|
||||
Returns:
|
||||
The radius of the arc, as the distance from the start point to the origin.
|
||||
"""
|
||||
return self.startPoint.distance_to(self.plane.origin)
|
||||
|
||||
@property
|
||||
def length(self) -> float:
|
||||
"""Calculates the length of the arc.
|
||||
|
||||
Returns:
|
||||
The length of the arc.
|
||||
"""
|
||||
start_to_mid = self.startPoint.distance_to(self.midPoint)
|
||||
mid_to_end = self.midPoint.distance_to(self.endPoint)
|
||||
r = self.radius
|
||||
@@ -42,6 +64,11 @@ class Arc(Base, IHasUnits, ICurve, speckle_type="Objects.Geometry.Arc"):
|
||||
|
||||
@property
|
||||
def measure(self) -> float:
|
||||
"""Calculates the angular measure of the arc in radians.
|
||||
|
||||
Returns:
|
||||
The angular measure of the arc in radians.
|
||||
"""
|
||||
start_to_mid = self.startPoint.distance_to(self.midPoint)
|
||||
mid_to_end = self.midPoint.distance_to(self.endPoint)
|
||||
r = self.radius
|
||||
|
||||
@@ -9,7 +9,29 @@ from specklepy.objects.primitive import Interval
|
||||
@dataclass(kw_only=True)
|
||||
class Box(Base, IHasUnits, IHasArea, IHasVolume, speckle_type="Objects.Geometry.Box"):
|
||||
"""
|
||||
a 3-dimensional box oriented on a plane
|
||||
A 3-dimensional box oriented on a plane.
|
||||
|
||||
This class represents a rectangular prism in 3D space, defined by a base plane and
|
||||
three intervals specifying its dimensions along the x, y, and z axes.
|
||||
|
||||
Attributes:
|
||||
basePlane: The plane on which the box is oriented
|
||||
xSize: The interval defining the box's size along the x-axis
|
||||
ySize: The interval defining the box's size along the y-axis
|
||||
zSize: The interval defining the box's size along the z-axis
|
||||
|
||||
```py title="Example"
|
||||
from specklepy.objects.geometry.plane import Plane
|
||||
from specklepy.objects.geometry.point import Point
|
||||
from specklepy.objects.primitive import Interval
|
||||
|
||||
base_plane = Plane(origin=Point(0, 0, 0), normal=Point(0, 0, 1))
|
||||
x_size = Interval(start=0, end=10)
|
||||
y_size = Interval(start=0, end=5)
|
||||
z_size = Interval(start=0, end=3)
|
||||
|
||||
box = Box(basePlane=base_plane, xSize=x_size, ySize=y_size, zSize=z_size)
|
||||
```
|
||||
"""
|
||||
|
||||
basePlane: Plane
|
||||
@@ -29,6 +51,11 @@ class Box(Base, IHasUnits, IHasArea, IHasVolume, speckle_type="Objects.Geometry.
|
||||
|
||||
@property
|
||||
def area(self) -> float:
|
||||
"""Calculates the surface area of the box.
|
||||
|
||||
Returns:
|
||||
The total surface area of the box.
|
||||
"""
|
||||
return 2 * (
|
||||
self.xSize.length * self.ySize.length
|
||||
+ self.xSize.length * self.zSize.length
|
||||
@@ -37,4 +64,9 @@ class Box(Base, IHasUnits, IHasArea, IHasVolume, speckle_type="Objects.Geometry.
|
||||
|
||||
@property
|
||||
def volume(self) -> float:
|
||||
"""Calculates the volume of the box.
|
||||
|
||||
Returns:
|
||||
The volume of the box.
|
||||
"""
|
||||
return self.xSize.length * self.ySize.length * self.zSize.length
|
||||
|
||||
Reference in New Issue
Block a user