Skip to content

Commit

Permalink
DOC: update development documentation fddf1c5
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroFernandezLuces committed Mar 11, 2024
0 parents commit 438b313
Show file tree
Hide file tree
Showing 207 changed files with 55,164 additions and 0 deletions.
Empty file added .nojekyll
Empty file.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
visualizer.docs.pyansys.com
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting to https://visualizer.docs.pyansys.com/version/dev/</title>
<meta name="description" content="">
<meta http-equiv="refresh" content="0; URL=https://visualizer.docs.pyansys.com/version/dev/">
<link rel="canonical" href="https://visualizer.docs.pyansys.com/version/dev/">
</head>
</html>
4 changes: 4 additions & 0 deletions version/dev/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: eeda292c154362d640027e7f848b60ef
tags: 645f666f9bcd5a90fca523b33c5a78b7
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""
.. _ref_plain_usage:
==========================
Plain usage of the plotter
==========================
This example demonstrates how to use the plotter.
"""

###########################
# Add a mesh to the plotter
# =========================


import pyvista as pv

from ansys.visualizer import Plotter

mesh = pv.Cube()

# Create a plotter
pl = Plotter()

# Add the mesh to the plotter
pl.add(mesh)

# Show the plotter
pl.plot()


##############################################
# Alternatively, you can add a list of meshes.
# ============================================

import pyvista as pv

from ansys.visualizer import Plotter

mesh1 = pv.Cube()
mesh2 = pv.Sphere(center=(2, 0, 0))
mesh_list = [mesh1, mesh2]
# Create a plotter
pl = Plotter()

# Add the mesh to the plotter
pl.add(mesh_list)

# Show the plotter
pl.plot()
73 changes: 73 additions & 0 deletions version/dev/_downloads/30d1a9bed520481f2bd97da80c1fd06c/picker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright (C) 2023 - 2024 ANSYS, Inc. and/or its affiliates.
# SPDX-License-Identifier: MIT
#
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

"""
.. _ref_picker:
=================================================
Activate the picker
=================================================
In this example, we will show how to activate the picker. The picker is a tool that allows you
to select an object in the plotter and get its name.
"""


##############################################
# Custom class to relate with a PyVista mesh
# ==========================================
import pyvista as pv


# Note that this class must have a way to get the mesh and a name or ID
class CustomObject:
def __init__(self):
self.name = "CustomObject"
self.mesh = pv.Cube()

def get_mesh(self):
return self.mesh

def name(self):
return self.name


# Create a custom object
custom_object = CustomObject()

##############################################
# Create a MeshObjectPlot instance
# ==========================================
from ansys.visualizer import MeshObjectPlot

# Create a MeshObjectPlot instance
mesh_object = MeshObjectPlot(custom_object, custom_object.get_mesh())

############################################################
# Plot the MeshObjectPlot instance with the picker activated
# ==========================================================

from ansys.visualizer import Plotter

pl = Plotter(allow_picking=True)
pl.add(mesh_object)
pl.plot()
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n\n# Activate the picker\n\nIn this example, we will show how to activate the picker. The picker is a tool that allows you\nto select an object in the plotter and get its name.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Custom class to relate with a PyVista mesh\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pyvista as pv\n\n\n# Note that this class must have a way to get the mesh and a name or ID\nclass CustomObject:\n def __init__(self):\n self.name = \"CustomObject\"\n self.mesh = pv.Cube()\n\n def get_mesh(self):\n return self.mesh\n\n def name(self):\n return self.name\n\n\n# Create a custom object\ncustom_object = CustomObject()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create a MeshObjectPlot instance\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from ansys.visualizer import MeshObjectPlot\n\n# Create a MeshObjectPlot instance\nmesh_object = MeshObjectPlot(custom_object, custom_object.get_mesh())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot the MeshObjectPlot instance with the picker activated\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from ansys.visualizer import Plotter\n\npl = Plotter(allow_picking=True)\npl.add(mesh_object)\npl.plot()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n\n# Usage of MeshObjectPlot class\n\nThe MeshObject class is a helper class provided by PyAnsys Visualizer that relates a custom object\nwith its mesh. With this object we can seize the full potential of the Visualizer.\nThis example teaches how to use the MeshObjectPlot class to plot your custom objects.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Custom class to relate with a PyVista mesh\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pyvista as pv\n\n\n# Note that this class must have a way to get the mesh and a name or ID\nclass CustomObject:\n def __init__(self):\n self.name = \"CustomObject\"\n self.mesh = pv.Cube()\n\n def get_mesh(self):\n return self.mesh\n\n def name(self):\n return self.name\n\n\n# Create a custom object\ncustom_object = CustomObject()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Create a MeshObjectPlot instance\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from ansys.visualizer import MeshObjectPlot\n\n# Create a MeshObjectPlot instance\nmesh_object = MeshObjectPlot(custom_object, custom_object.get_mesh())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot the MeshObjectPlot instance\n\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"from ansys.visualizer import Plotter\n\npl = Plotter()\npl.add(mesh_object)\npl.plot()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"\n\n# How to use a clipping plane in PyAnsys Visualizer\n\nIn this example, we will show how to use a clipping plane in PyAnsys Visualizer to cut a mesh.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import pyvista as pv\n\nfrom ansys.visualizer import ClipPlane, Plotter\n\n# Create a mesh\nmesh = pv.Cylinder()\n\n# Create a plotter\npl = Plotter()\n\n# Create a clipping plane\n\nclipping_plane = ClipPlane(normal=(1, 0, 0), origin=(0, 0, 0))\n\n# Add the mesh to the plotter with the clipping plane\npl.add(mesh, clipping_plane=clipping_plane)\npl.plot()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.13"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading

0 comments on commit 438b313

Please sign in to comment.