COMPAS 2.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- compas/__init__.py +274 -0
- compas/__main__.py +31 -0
- compas/_iotools.py +80 -0
- compas/_os.py +746 -0
- compas/colors/__init__.py +14 -0
- compas/colors/cmcrameri/acton.txt +256 -0
- compas/colors/cmcrameri/actonS.txt +100 -0
- compas/colors/cmcrameri/bam.txt +256 -0
- compas/colors/cmcrameri/bamO.txt +256 -0
- compas/colors/cmcrameri/bamako.txt +256 -0
- compas/colors/cmcrameri/bamakoS.txt +100 -0
- compas/colors/cmcrameri/batlow.txt +256 -0
- compas/colors/cmcrameri/batlowK.txt +256 -0
- compas/colors/cmcrameri/batlowS.txt +100 -0
- compas/colors/cmcrameri/batlowW.txt +256 -0
- compas/colors/cmcrameri/berlin.txt +256 -0
- compas/colors/cmcrameri/bilbao.txt +256 -0
- compas/colors/cmcrameri/bilbaoS.txt +100 -0
- compas/colors/cmcrameri/broc.txt +256 -0
- compas/colors/cmcrameri/brocO.txt +256 -0
- compas/colors/cmcrameri/buda.txt +256 -0
- compas/colors/cmcrameri/budaS.txt +100 -0
- compas/colors/cmcrameri/bukavu.txt +256 -0
- compas/colors/cmcrameri/cork.txt +256 -0
- compas/colors/cmcrameri/corkO.txt +256 -0
- compas/colors/cmcrameri/davos.txt +256 -0
- compas/colors/cmcrameri/davosS.txt +100 -0
- compas/colors/cmcrameri/devon.txt +256 -0
- compas/colors/cmcrameri/devonS.txt +100 -0
- compas/colors/cmcrameri/fes.txt +256 -0
- compas/colors/cmcrameri/grayC.txt +256 -0
- compas/colors/cmcrameri/grayCS.txt +100 -0
- compas/colors/cmcrameri/hawaii.txt +256 -0
- compas/colors/cmcrameri/hawaiiS.txt +100 -0
- compas/colors/cmcrameri/imola.txt +256 -0
- compas/colors/cmcrameri/imolaS.txt +100 -0
- compas/colors/cmcrameri/lajolla.txt +256 -0
- compas/colors/cmcrameri/lajollaS.txt +100 -0
- compas/colors/cmcrameri/lapaz.txt +256 -0
- compas/colors/cmcrameri/lapazS.txt +100 -0
- compas/colors/cmcrameri/lisbon.txt +256 -0
- compas/colors/cmcrameri/nuuk.txt +256 -0
- compas/colors/cmcrameri/nuukS.txt +100 -0
- compas/colors/cmcrameri/oleron.txt +256 -0
- compas/colors/cmcrameri/oslo.txt +256 -0
- compas/colors/cmcrameri/osloS.txt +100 -0
- compas/colors/cmcrameri/roma.txt +256 -0
- compas/colors/cmcrameri/romaO.txt +256 -0
- compas/colors/cmcrameri/tofino.txt +256 -0
- compas/colors/cmcrameri/tokyo.txt +256 -0
- compas/colors/cmcrameri/tokyoS.txt +100 -0
- compas/colors/cmcrameri/turku.txt +256 -0
- compas/colors/cmcrameri/turkuS.txt +100 -0
- compas/colors/cmcrameri/vanimo.txt +256 -0
- compas/colors/cmcrameri/vik.txt +256 -0
- compas/colors/cmcrameri/vikO.txt +256 -0
- compas/colors/color.py +1118 -0
- compas/colors/colordict.py +103 -0
- compas/colors/colormap.py +306 -0
- compas/colors/html_colors.py +149 -0
- compas/colors/mpl_colormap.py +1064 -0
- compas/data/__init__.py +31 -0
- compas/data/coercion.py +71 -0
- compas/data/conftest.py +10 -0
- compas/data/data.py +342 -0
- compas/data/encoders.py +240 -0
- compas/data/exceptions.py +2 -0
- compas/data/json.py +240 -0
- compas/data/samples/boxes.obj +250 -0
- compas/data/samples/butt_model.obj +2829 -0
- compas/data/samples/cone.stl +0 -0
- compas/data/samples/cube.off +16 -0
- compas/data/samples/cube_ascii.stl +56114 -0
- compas/data/samples/cube_binary.stl +0 -0
- compas/data/samples/cube_binary_2.stl +0 -0
- compas/data/samples/doosabin.json +1 -0
- compas/data/samples/faces.obj +63 -0
- compas/data/samples/faces_big.obj +9663 -0
- compas/data/samples/faces_reversed.obj +63 -0
- compas/data/samples/fink.obj +135 -0
- compas/data/samples/grid_irregular.obj +303 -0
- compas/data/samples/hypar.obj +148 -0
- compas/data/samples/lines.json +1 -0
- compas/data/samples/lines.obj +282 -0
- compas/data/samples/lines_big.obj +40322 -0
- compas/data/samples/lines_bigger.obj +161282 -0
- compas/data/samples/lines_noleaves.obj +422 -0
- compas/data/samples/mesh.obj +874 -0
- compas/data/samples/mesh_100_faces.json +1893 -0
- compas/data/samples/mesh_110_faces.json +2081 -0
- compas/data/samples/open_edges.obj +424 -0
- compas/data/samples/point.json +1 -0
- compas/data/samples/quadmesh.obj +183 -0
- compas/data/samples/quadmesh_planar.obj +181 -0
- compas/data/samples/saddle.obj +314 -0
- compas/data/samples/spline.obj +72 -0
- compas/data/samples/tubemesh.json +1 -0
- compas/data/samples/tubemesh.obj +378 -0
- compas/data/samples/tubemesh.off +374 -0
- compas/data/samples/tubemesh.ply +551 -0
- compas/data/schema.py +137 -0
- compas/data/validators.py +243 -0
- compas/datastructures/__init__.py +75 -0
- compas/datastructures/_mutablemapping.py +148 -0
- compas/datastructures/assembly/__init__.py +0 -0
- compas/datastructures/assembly/assembly.py +234 -0
- compas/datastructures/assembly/exceptions.py +6 -0
- compas/datastructures/assembly/part.py +228 -0
- compas/datastructures/attributes.py +85 -0
- compas/datastructures/cell_network/__init__.py +0 -0
- compas/datastructures/cell_network/cell_network.py +4190 -0
- compas/datastructures/datastructure.py +309 -0
- compas/datastructures/graph/__init__.py +0 -0
- compas/datastructures/graph/duality.py +197 -0
- compas/datastructures/graph/graph.py +2478 -0
- compas/datastructures/graph/operations/__init__.py +0 -0
- compas/datastructures/graph/operations/join.py +124 -0
- compas/datastructures/graph/operations/split.py +63 -0
- compas/datastructures/graph/planarity.py +292 -0
- compas/datastructures/graph/smoothing.py +59 -0
- compas/datastructures/mesh/__init__.py +0 -0
- compas/datastructures/mesh/conway.py +553 -0
- compas/datastructures/mesh/duality.py +104 -0
- compas/datastructures/mesh/mesh.py +5103 -0
- compas/datastructures/mesh/operations/__init__.py +0 -0
- compas/datastructures/mesh/operations/collapse.py +350 -0
- compas/datastructures/mesh/operations/extrude.py +0 -0
- compas/datastructures/mesh/operations/insert.py +120 -0
- compas/datastructures/mesh/operations/merge.py +83 -0
- compas/datastructures/mesh/operations/split.py +263 -0
- compas/datastructures/mesh/operations/substitute.py +37 -0
- compas/datastructures/mesh/operations/swap.py +62 -0
- compas/datastructures/mesh/operations/weld.py +107 -0
- compas/datastructures/mesh/remesh.py +234 -0
- compas/datastructures/mesh/slice.py +170 -0
- compas/datastructures/mesh/smoothing.py +187 -0
- compas/datastructures/mesh/subdivision.py +754 -0
- compas/datastructures/tree/__init__.py +0 -0
- compas/datastructures/tree/tree.py +504 -0
- compas/datastructures/volmesh/__init__.py +0 -0
- compas/datastructures/volmesh/volmesh.py +4203 -0
- compas/files/__init__.py +27 -0
- compas/files/_xml/__init__.py +0 -0
- compas/files/_xml/xml_cli.py +213 -0
- compas/files/_xml/xml_cpython.py +32 -0
- compas/files/_xml/xml_pre_38.py +58 -0
- compas/files/_xml/xml_shared.py +40 -0
- compas/files/gltf/__init__.py +0 -0
- compas/files/gltf/constants.py +59 -0
- compas/files/gltf/data_classes.py +657 -0
- compas/files/gltf/extensions.py +317 -0
- compas/files/gltf/gltf.py +92 -0
- compas/files/gltf/gltf_children.py +64 -0
- compas/files/gltf/gltf_content.py +615 -0
- compas/files/gltf/gltf_exporter.py +465 -0
- compas/files/gltf/gltf_mesh.py +273 -0
- compas/files/gltf/gltf_node.py +348 -0
- compas/files/gltf/gltf_parser.py +115 -0
- compas/files/gltf/gltf_reader.py +310 -0
- compas/files/gltf/gltf_scene.py +125 -0
- compas/files/gltf/helpers.py +59 -0
- compas/files/obj.py +680 -0
- compas/files/off.py +296 -0
- compas/files/ply.py +697 -0
- compas/files/stl.py +436 -0
- compas/files/xml.py +328 -0
- compas/geometry/__init__.py +772 -0
- compas/geometry/_core/__init__.py +0 -0
- compas/geometry/_core/_algebra.py +2826 -0
- compas/geometry/_core/angles.py +408 -0
- compas/geometry/_core/centroids.py +573 -0
- compas/geometry/_core/distance.py +895 -0
- compas/geometry/_core/normals.py +149 -0
- compas/geometry/_core/nurbs.py +367 -0
- compas/geometry/_core/predicates_2.py +582 -0
- compas/geometry/_core/predicates_3.py +1111 -0
- compas/geometry/_core/quaternions.py +196 -0
- compas/geometry/_core/size.py +204 -0
- compas/geometry/_core/tangent.py +56 -0
- compas/geometry/_core/transformations.py +1121 -0
- compas/geometry/_core/transformations_numpy.py +279 -0
- compas/geometry/bbox.py +145 -0
- compas/geometry/bbox_numpy.py +306 -0
- compas/geometry/bestfit.py +77 -0
- compas/geometry/bestfit_numpy.py +259 -0
- compas/geometry/booleans.py +297 -0
- compas/geometry/booleans_shapely.py +147 -0
- compas/geometry/brep/__init__.py +112 -0
- compas/geometry/brep/brep.py +1131 -0
- compas/geometry/brep/edge.py +302 -0
- compas/geometry/brep/errors.py +22 -0
- compas/geometry/brep/face.py +329 -0
- compas/geometry/brep/loop.py +87 -0
- compas/geometry/brep/trim.py +46 -0
- compas/geometry/brep/vertex.py +46 -0
- compas/geometry/contours.py +32 -0
- compas/geometry/curves/__init__.py +0 -0
- compas/geometry/curves/arc.py +429 -0
- compas/geometry/curves/bezier.py +345 -0
- compas/geometry/curves/circle.py +500 -0
- compas/geometry/curves/conic.py +16 -0
- compas/geometry/curves/curve.py +614 -0
- compas/geometry/curves/ellipse.py +408 -0
- compas/geometry/curves/hyperbola.py +336 -0
- compas/geometry/curves/line.py +431 -0
- compas/geometry/curves/nurbs.py +412 -0
- compas/geometry/curves/parabola.py +256 -0
- compas/geometry/curves/polyline.py +724 -0
- compas/geometry/frame.py +769 -0
- compas/geometry/geometry.py +296 -0
- compas/geometry/hull.py +146 -0
- compas/geometry/hull_numpy.py +82 -0
- compas/geometry/icp_numpy.py +104 -0
- compas/geometry/interpolation_barycentric.py +38 -0
- compas/geometry/interpolation_coons.py +102 -0
- compas/geometry/interpolation_tweening.py +87 -0
- compas/geometry/intersection.py +121 -0
- compas/geometry/intersections.py +1105 -0
- compas/geometry/kdtree.py +153 -0
- compas/geometry/offset.py +208 -0
- compas/geometry/pca_numpy.py +87 -0
- compas/geometry/plane.py +657 -0
- compas/geometry/point.py +664 -0
- compas/geometry/pointcloud.py +409 -0
- compas/geometry/polygon.py +473 -0
- compas/geometry/polyhedron.py +650 -0
- compas/geometry/projection.py +155 -0
- compas/geometry/quadmesh_planarize.py +30 -0
- compas/geometry/quadmesh_planarize_none.py +114 -0
- compas/geometry/quaternion.py +544 -0
- compas/geometry/reflection.py +102 -0
- compas/geometry/rotation.py +354 -0
- compas/geometry/scale.py +100 -0
- compas/geometry/shapes/__init__.py +0 -0
- compas/geometry/shapes/box.py +747 -0
- compas/geometry/shapes/capsule.py +472 -0
- compas/geometry/shapes/cone.py +309 -0
- compas/geometry/shapes/cylinder.py +355 -0
- compas/geometry/shapes/shape.py +300 -0
- compas/geometry/shapes/sphere.py +362 -0
- compas/geometry/shapes/torus.py +294 -0
- compas/geometry/shear.py +115 -0
- compas/geometry/surfaces/__init__.py +0 -0
- compas/geometry/surfaces/conical.py +166 -0
- compas/geometry/surfaces/cylindrical.py +251 -0
- compas/geometry/surfaces/extrusion.py +0 -0
- compas/geometry/surfaces/nurbs.py +380 -0
- compas/geometry/surfaces/planar.py +223 -0
- compas/geometry/surfaces/revolution.py +0 -0
- compas/geometry/surfaces/spherical.py +259 -0
- compas/geometry/surfaces/surface.py +689 -0
- compas/geometry/surfaces/toroidal.py +198 -0
- compas/geometry/transformation.py +554 -0
- compas/geometry/translation.py +104 -0
- compas/geometry/triangulation_delaunay.py +102 -0
- compas/geometry/triangulation_earclip.py +300 -0
- compas/geometry/trimesh_curvature.py +113 -0
- compas/geometry/trimesh_descent_numpy.py +26 -0
- compas/geometry/trimesh_geodistance.py +35 -0
- compas/geometry/trimesh_gradient_numpy.py +74 -0
- compas/geometry/trimesh_isolines.py +41 -0
- compas/geometry/trimesh_matrices.py +31 -0
- compas/geometry/trimesh_matrices_numpy.py +191 -0
- compas/geometry/trimesh_parametrisation.py +55 -0
- compas/geometry/trimesh_pull_points_numpy.py +216 -0
- compas/geometry/trimesh_remeshing.py +97 -0
- compas/geometry/trimesh_samplepoints_numpy.py +108 -0
- compas/geometry/trimesh_slicing.py +28 -0
- compas/geometry/trimesh_smoothing_numpy.py +34 -0
- compas/geometry/vector.py +889 -0
- compas/itertools.py +441 -0
- compas/linalg.py +634 -0
- compas/matrices.py +314 -0
- compas/plugins.py +488 -0
- compas/rpc/__init__.py +20 -0
- compas/rpc/__main__.py +77 -0
- compas/rpc/dispatcher.py +181 -0
- compas/rpc/errors.py +11 -0
- compas/rpc/proxy.py +437 -0
- compas/rpc/server.py +79 -0
- compas/rpc/services/__init__.py +0 -0
- compas/rpc/services/default.py +87 -0
- compas/rpc/services/watcher.py +43 -0
- compas/scene/__init__.py +56 -0
- compas/scene/assemblyobject.py +3 -0
- compas/scene/context.py +154 -0
- compas/scene/descriptors/__init__.py +0 -0
- compas/scene/descriptors/attribute.py +30 -0
- compas/scene/descriptors/color.py +91 -0
- compas/scene/descriptors/colordict.py +101 -0
- compas/scene/descriptors/protocol.py +12 -0
- compas/scene/exceptions.py +7 -0
- compas/scene/geometryobject.py +58 -0
- compas/scene/graphobject.py +173 -0
- compas/scene/meshobject.py +238 -0
- compas/scene/scene.py +144 -0
- compas/scene/sceneobject.py +253 -0
- compas/scene/volmeshobject.py +252 -0
- compas/tolerance.py +879 -0
- compas/topology/__init__.py +45 -0
- compas/topology/combinatorics.py +108 -0
- compas/topology/connectivity.py +129 -0
- compas/topology/orientation.py +204 -0
- compas/topology/traversal.py +567 -0
- compas/utilities/__init__.py +25 -0
- compas/utilities/azync.py +155 -0
- compas/utilities/datetime.py +40 -0
- compas/utilities/decorators.py +136 -0
- compas/utilities/remote.py +54 -0
- compas/utilities/ssh.py +169 -0
- compas-2.1.1.dist-info/AUTHORS.md +42 -0
- compas-2.1.1.dist-info/LICENSE +21 -0
- compas-2.1.1.dist-info/METADATA +132 -0
- compas-2.1.1.dist-info/RECORD +468 -0
- compas-2.1.1.dist-info/WHEEL +5 -0
- compas-2.1.1.dist-info/entry_points.txt +2 -0
- compas-2.1.1.dist-info/top_level.txt +4 -0
- compas_blender/__init__.py +250 -0
- compas_blender/collections.py +130 -0
- compas_blender/conversions/__init__.py +48 -0
- compas_blender/conversions/breps.py +0 -0
- compas_blender/conversions/colors.py +23 -0
- compas_blender/conversions/curves.py +125 -0
- compas_blender/conversions/geometry.py +161 -0
- compas_blender/conversions/meshes.py +148 -0
- compas_blender/conversions/surfaces.py +48 -0
- compas_blender/conversions/transformations.py +46 -0
- compas_blender/data.py +30 -0
- compas_blender/geometry/__init__.py +14 -0
- compas_blender/geometry/booleans.py +100 -0
- compas_blender/install.py +338 -0
- compas_blender/objects.py +326 -0
- compas_blender/print_python_path.py +18 -0
- compas_blender/scene/__init__.py +116 -0
- compas_blender/scene/boxobject.py +64 -0
- compas_blender/scene/capsuleobject.py +73 -0
- compas_blender/scene/circleobject.py +53 -0
- compas_blender/scene/coneobject.py +70 -0
- compas_blender/scene/curveobject.py +58 -0
- compas_blender/scene/cylinderobject.py +70 -0
- compas_blender/scene/frameobject.py +105 -0
- compas_blender/scene/graphobject.py +257 -0
- compas_blender/scene/lineobject.py +60 -0
- compas_blender/scene/meshobject.py +508 -0
- compas_blender/scene/planeobject.py +81 -0
- compas_blender/scene/pointcloudobject.py +67 -0
- compas_blender/scene/pointobject.py +71 -0
- compas_blender/scene/polygonobject.py +57 -0
- compas_blender/scene/polyhedronobject.py +57 -0
- compas_blender/scene/polylineobject.py +54 -0
- compas_blender/scene/sceneobject.py +249 -0
- compas_blender/scene/sphereobject.py +72 -0
- compas_blender/scene/surfaceobject.py +54 -0
- compas_blender/scene/torusobject.py +73 -0
- compas_blender/scene/vectorobject.py +69 -0
- compas_blender/scene/volmeshobject.py +475 -0
- compas_blender/utilities/__init__.py +38 -0
- compas_blender/utilities/drawing.py +768 -0
- compas_ghpython/__init__.py +124 -0
- compas_ghpython/components/Compas_FromJson/code.py +18 -0
- compas_ghpython/components/Compas_Info/code.py +15 -0
- compas_ghpython/components/Compas_RpcCall/code.py +31 -0
- compas_ghpython/components/Compas_ToJson/code.py +19 -0
- compas_ghpython/components/Compas_ToRhinoGeometry/code.py +15 -0
- compas_ghpython/components/__init__.py +99 -0
- compas_ghpython/install.py +29 -0
- compas_ghpython/scene/__init__.py +115 -0
- compas_ghpython/scene/boxobject.py +40 -0
- compas_ghpython/scene/brepobject.py +40 -0
- compas_ghpython/scene/capsuleobject.py +41 -0
- compas_ghpython/scene/circleobject.py +40 -0
- compas_ghpython/scene/coneobject.py +40 -0
- compas_ghpython/scene/curveobject.py +42 -0
- compas_ghpython/scene/cylinderobject.py +38 -0
- compas_ghpython/scene/ellipseobject.py +40 -0
- compas_ghpython/scene/frameobject.py +67 -0
- compas_ghpython/scene/graphobject.py +77 -0
- compas_ghpython/scene/lineobject.py +39 -0
- compas_ghpython/scene/meshobject.py +137 -0
- compas_ghpython/scene/planeobject.py +61 -0
- compas_ghpython/scene/pointobject.py +38 -0
- compas_ghpython/scene/polygonobject.py +48 -0
- compas_ghpython/scene/polyhedronobject.py +48 -0
- compas_ghpython/scene/polylineobject.py +39 -0
- compas_ghpython/scene/sceneobject.py +12 -0
- compas_ghpython/scene/sphereobject.py +39 -0
- compas_ghpython/scene/surfaceobject.py +42 -0
- compas_ghpython/scene/torusobject.py +39 -0
- compas_ghpython/scene/vectorobject.py +51 -0
- compas_ghpython/scene/volmeshobject.py +154 -0
- compas_ghpython/sets.py +83 -0
- compas_ghpython/timer.py +36 -0
- compas_ghpython/uninstall.py +31 -0
- compas_ghpython/utilities/__init__.py +33 -0
- compas_ghpython/utilities/drawing.py +457 -0
- compas_rhino/__init__.py +607 -0
- compas_rhino/conduits/__init__.py +16 -0
- compas_rhino/conduits/base.py +121 -0
- compas_rhino/conduits/faces.py +91 -0
- compas_rhino/conduits/labels.py +102 -0
- compas_rhino/conduits/lines.py +109 -0
- compas_rhino/conduits/points.py +111 -0
- compas_rhino/conversions/__init__.py +168 -0
- compas_rhino/conversions/breps.py +122 -0
- compas_rhino/conversions/curves.py +453 -0
- compas_rhino/conversions/docobjects.py +0 -0
- compas_rhino/conversions/exceptions.py +7 -0
- compas_rhino/conversions/extrusions.py +80 -0
- compas_rhino/conversions/geometry.py +187 -0
- compas_rhino/conversions/meshes.py +281 -0
- compas_rhino/conversions/shapes.py +291 -0
- compas_rhino/conversions/surfaces.py +355 -0
- compas_rhino/conversions/transformations.py +45 -0
- compas_rhino/geometry/__init__.py +44 -0
- compas_rhino/geometry/booleans.py +118 -0
- compas_rhino/geometry/brep/__init__.py +40 -0
- compas_rhino/geometry/brep/brep.py +554 -0
- compas_rhino/geometry/brep/builder.py +184 -0
- compas_rhino/geometry/brep/edge.py +202 -0
- compas_rhino/geometry/brep/face.py +285 -0
- compas_rhino/geometry/brep/loop.py +129 -0
- compas_rhino/geometry/brep/trim.py +99 -0
- compas_rhino/geometry/brep/vertex.py +76 -0
- compas_rhino/geometry/curves/__init__.py +43 -0
- compas_rhino/geometry/curves/curve.py +382 -0
- compas_rhino/geometry/curves/nurbs.py +298 -0
- compas_rhino/geometry/surfaces/__init__.py +50 -0
- compas_rhino/geometry/surfaces/nurbs.py +370 -0
- compas_rhino/geometry/surfaces/surface.py +407 -0
- compas_rhino/geometry/trimesh_curvature.py +344 -0
- compas_rhino/geometry/trimesh_slicing.py +65 -0
- compas_rhino/install.py +382 -0
- compas_rhino/install_plugin.py +169 -0
- compas_rhino/install_with_pip.py +20 -0
- compas_rhino/layers.py +347 -0
- compas_rhino/objects.py +1141 -0
- compas_rhino/print_python_path.py +18 -0
- compas_rhino/scene/__init__.py +123 -0
- compas_rhino/scene/boxobject.py +44 -0
- compas_rhino/scene/brepobject.py +41 -0
- compas_rhino/scene/capsuleobject.py +45 -0
- compas_rhino/scene/circleobject.py +43 -0
- compas_rhino/scene/coneobject.py +43 -0
- compas_rhino/scene/curveobject.py +43 -0
- compas_rhino/scene/cylinderobject.py +43 -0
- compas_rhino/scene/ellipseobject.py +44 -0
- compas_rhino/scene/frameobject.py +99 -0
- compas_rhino/scene/graphobject.py +364 -0
- compas_rhino/scene/helpers.py +33 -0
- compas_rhino/scene/lineobject.py +43 -0
- compas_rhino/scene/meshobject.py +673 -0
- compas_rhino/scene/planeobject.py +71 -0
- compas_rhino/scene/pointobject.py +43 -0
- compas_rhino/scene/polygonobject.py +45 -0
- compas_rhino/scene/polyhedronobject.py +45 -0
- compas_rhino/scene/polylineobject.py +43 -0
- compas_rhino/scene/sceneobject.py +123 -0
- compas_rhino/scene/sphereobject.py +43 -0
- compas_rhino/scene/surfaceobject.py +42 -0
- compas_rhino/scene/torusobject.py +43 -0
- compas_rhino/scene/vectorobject.py +49 -0
- compas_rhino/scene/volmeshobject.py +518 -0
- compas_rhino/ui.py +114 -0
- compas_rhino/uninstall.py +243 -0
- compas_rhino/uninstall_plugin.py +91 -0
- compas_rhino/utilities/__init__.py +37 -0
- compas_rhino/utilities/constructors.py +71 -0
- compas_rhino/utilities/drawing.py +1081 -0
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
import importlib
|
|
2
|
+
import itertools
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
import compas._os
|
|
7
|
+
import compas.plugins
|
|
8
|
+
import compas_blender
|
|
9
|
+
|
|
10
|
+
INSTALLED_VERSION = None
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def install(version=None, packages=None, clean=False):
|
|
14
|
+
"""Install COMPAS for Blender.
|
|
15
|
+
|
|
16
|
+
Parameters
|
|
17
|
+
----------
|
|
18
|
+
version : str, optional
|
|
19
|
+
The version number of Blender.
|
|
20
|
+
Default is ``'4.0'``.
|
|
21
|
+
packages : list of str, optional
|
|
22
|
+
List of packages to install or None to use default package list.
|
|
23
|
+
Default is the result of ``installable_blender_packages``,
|
|
24
|
+
which collects all installable packages in the current environment.
|
|
25
|
+
clean : bool, optional
|
|
26
|
+
If True, this will clean up the site packages folder and remove
|
|
27
|
+
also existing symlinks that are not importable in the current environment.
|
|
28
|
+
|
|
29
|
+
Examples
|
|
30
|
+
--------
|
|
31
|
+
.. code-block:: python
|
|
32
|
+
|
|
33
|
+
import compas_blender.install
|
|
34
|
+
|
|
35
|
+
compas_blender.install.install()
|
|
36
|
+
|
|
37
|
+
.. code-block:: bash
|
|
38
|
+
|
|
39
|
+
python -m compas_blender.install
|
|
40
|
+
|
|
41
|
+
"""
|
|
42
|
+
version = compas_blender._check_blender_version(version)
|
|
43
|
+
|
|
44
|
+
# We install COMPAS packages in the site packages folder
|
|
45
|
+
sitepackages_path = compas_blender._get_default_blender_sitepackages_path(version)
|
|
46
|
+
|
|
47
|
+
# Filter the provided list of packages
|
|
48
|
+
# If no packages are provided
|
|
49
|
+
# this first collects all installable packages from the environment.
|
|
50
|
+
packages = _filter_installable_packages(version, packages)
|
|
51
|
+
|
|
52
|
+
results = []
|
|
53
|
+
symlinks_to_install = []
|
|
54
|
+
symlinks_to_uninstall = []
|
|
55
|
+
exit_code = 0
|
|
56
|
+
|
|
57
|
+
# check all installable packages
|
|
58
|
+
# add the packages that can't be imported from the current env to the list of symlinks to uninstall
|
|
59
|
+
# and remove the package name from the list of installable packages
|
|
60
|
+
# make a copy of the list to avoid problems with removing items
|
|
61
|
+
# note: perhaps this should already happen in the filter function...
|
|
62
|
+
for name in packages[:]:
|
|
63
|
+
try:
|
|
64
|
+
importlib.import_module(name)
|
|
65
|
+
except ImportError:
|
|
66
|
+
path = os.path.join(sitepackages_path, name)
|
|
67
|
+
symlinks_to_uninstall.append(dict(name=name, link=path))
|
|
68
|
+
packages.remove(name)
|
|
69
|
+
|
|
70
|
+
# Also remove all broken symlinks from the scripts folder
|
|
71
|
+
# because ... they're broken!
|
|
72
|
+
# If it is an actual folder or a file, leave it alone
|
|
73
|
+
# because probably someone put it there on purpose.
|
|
74
|
+
for name in os.listdir(sitepackages_path):
|
|
75
|
+
path = os.path.join(sitepackages_path, name)
|
|
76
|
+
if os.path.islink(path):
|
|
77
|
+
if not os.path.exists(path):
|
|
78
|
+
symlinks_to_uninstall.append(dict(name=name, link=path))
|
|
79
|
+
try:
|
|
80
|
+
importlib.import_module(name)
|
|
81
|
+
except ImportError:
|
|
82
|
+
pass
|
|
83
|
+
else:
|
|
84
|
+
if name not in packages:
|
|
85
|
+
packages.append(name)
|
|
86
|
+
|
|
87
|
+
# If the scripts folder is supposed to be cleaned
|
|
88
|
+
# also remove all existing symlinks that cannot be imported
|
|
89
|
+
# and reinstall symlinks that can be imported
|
|
90
|
+
if clean:
|
|
91
|
+
for name in os.listdir(sitepackages_path):
|
|
92
|
+
path = os.path.join(sitepackages_path, name)
|
|
93
|
+
if os.path.islink(path):
|
|
94
|
+
if os.path.exists(path):
|
|
95
|
+
try:
|
|
96
|
+
importlib.import_module(name)
|
|
97
|
+
except ImportError:
|
|
98
|
+
path = os.path.join(sitepackages_path, name)
|
|
99
|
+
symlinks_to_uninstall.append(dict(name=name, link=path))
|
|
100
|
+
else:
|
|
101
|
+
if name not in packages:
|
|
102
|
+
packages.append(name)
|
|
103
|
+
|
|
104
|
+
# add all of the packages in the list of installable packages
|
|
105
|
+
# to the list of symlinks to uninstall
|
|
106
|
+
# and to the list of symlinks to install
|
|
107
|
+
for package in packages:
|
|
108
|
+
symlink_path = os.path.join(sitepackages_path, package)
|
|
109
|
+
symlinks_to_uninstall.append(dict(name=package, link=symlink_path))
|
|
110
|
+
|
|
111
|
+
package_path = compas_blender._get_package_path(importlib.import_module(package))
|
|
112
|
+
symlinks_to_install.append(dict(name=package, source_path=package_path, link=symlink_path))
|
|
113
|
+
|
|
114
|
+
# -------------------------
|
|
115
|
+
# Uninstall first
|
|
116
|
+
# -------------------------
|
|
117
|
+
|
|
118
|
+
symlinks = [link["link"] for link in symlinks_to_uninstall]
|
|
119
|
+
uninstall_results = compas._os.remove_symlinks(symlinks)
|
|
120
|
+
|
|
121
|
+
# Let the user know if some symlinks could not be removed.
|
|
122
|
+
for uninstall_data, success in zip(symlinks_to_uninstall, uninstall_results):
|
|
123
|
+
if not success:
|
|
124
|
+
results.append(
|
|
125
|
+
(
|
|
126
|
+
uninstall_data["name"],
|
|
127
|
+
"ERROR: Cannot remove symlink, try to run as administrator.",
|
|
128
|
+
)
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
# -------------------------
|
|
132
|
+
# Ready to start installing
|
|
133
|
+
# -------------------------
|
|
134
|
+
|
|
135
|
+
# create new symlinks and register the results
|
|
136
|
+
symlinks = [(link["source_path"], link["link"]) for link in symlinks_to_install]
|
|
137
|
+
install_results = compas._os.create_symlinks(symlinks)
|
|
138
|
+
|
|
139
|
+
# set the exit code based on the installation results
|
|
140
|
+
if not all(install_results):
|
|
141
|
+
exit_code = -1
|
|
142
|
+
|
|
143
|
+
# make a list of installed packages
|
|
144
|
+
# based on the installation results
|
|
145
|
+
# and update the general results list
|
|
146
|
+
installed_packages = []
|
|
147
|
+
for install_data, success in zip(symlinks_to_install, install_results):
|
|
148
|
+
if success:
|
|
149
|
+
installed_packages.append(install_data["name"])
|
|
150
|
+
result = "OK"
|
|
151
|
+
else:
|
|
152
|
+
result = "ERROR: Cannot create symlink, try to run as administrator."
|
|
153
|
+
results.append((install_data["name"], result))
|
|
154
|
+
|
|
155
|
+
# finalize the general results list with info about the bootstrapper
|
|
156
|
+
if exit_code == -1:
|
|
157
|
+
results.append(
|
|
158
|
+
(
|
|
159
|
+
"compas_bootstrapper",
|
|
160
|
+
"WARNING: One or more packages failed, will not install bootstrapper, try uninstalling first",
|
|
161
|
+
)
|
|
162
|
+
)
|
|
163
|
+
else:
|
|
164
|
+
try:
|
|
165
|
+
_update_bootstrapper(sitepackages_path, packages)
|
|
166
|
+
results.append(("compas_bootstrapper", "OK"))
|
|
167
|
+
except: # noqa: E722
|
|
168
|
+
results.append(
|
|
169
|
+
(
|
|
170
|
+
"compas_bootstrapper",
|
|
171
|
+
"ERROR: Could not create compas_bootstrapper to auto-determine Python environment",
|
|
172
|
+
)
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
# output the outcome of the installation process
|
|
176
|
+
# perhaps we should more info here
|
|
177
|
+
print("\nInstalling COMPAS packages to Blender {0} site-packages folder:".format(version))
|
|
178
|
+
print("{}\n".format(sitepackages_path))
|
|
179
|
+
|
|
180
|
+
for package, status in results:
|
|
181
|
+
print(" {} {}".format(package.ljust(20), status))
|
|
182
|
+
if status != "OK":
|
|
183
|
+
exit_code = -1
|
|
184
|
+
|
|
185
|
+
if exit_code == 0 and len(installed_packages):
|
|
186
|
+
print("\nRunning post-installation steps...\n")
|
|
187
|
+
if not _run_post_execution_steps(after_blender_install(installed_packages)):
|
|
188
|
+
exit_code = -1
|
|
189
|
+
|
|
190
|
+
print("\nInstall completed.")
|
|
191
|
+
if exit_code != 0:
|
|
192
|
+
sys.exit(exit_code)
|
|
193
|
+
|
|
194
|
+
global INSTALLED_VERSION
|
|
195
|
+
INSTALLED_VERSION = version
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def _run_post_execution_steps(steps_generator):
|
|
199
|
+
all_steps_succeeded = True
|
|
200
|
+
post_execution_errors = []
|
|
201
|
+
|
|
202
|
+
for result in steps_generator:
|
|
203
|
+
if isinstance(result, Exception):
|
|
204
|
+
post_execution_errors.append(result)
|
|
205
|
+
continue
|
|
206
|
+
|
|
207
|
+
for item in result:
|
|
208
|
+
try:
|
|
209
|
+
package, message, success = item
|
|
210
|
+
status = "OK" if success else "ERROR"
|
|
211
|
+
if not success:
|
|
212
|
+
all_steps_succeeded = False
|
|
213
|
+
print(" {} {}: {}".format(package.ljust(20), status, message))
|
|
214
|
+
except ValueError:
|
|
215
|
+
post_execution_errors.append(ValueError("Step ran without errors but result is wrongly formatted: {}".format(str(item))))
|
|
216
|
+
|
|
217
|
+
if post_execution_errors:
|
|
218
|
+
print("\nOne or more errors occurred:\n")
|
|
219
|
+
for error in post_execution_errors:
|
|
220
|
+
print(" - {}".format(repr(error)))
|
|
221
|
+
|
|
222
|
+
all_steps_succeeded = False
|
|
223
|
+
|
|
224
|
+
return all_steps_succeeded
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
@compas.plugins.plugin(category="install", pluggable_name="installable_blender_packages", tryfirst=True)
|
|
228
|
+
def default_installable_blender_packages():
|
|
229
|
+
# While this list could obviously be hard-coded, I think
|
|
230
|
+
# eating our own dogfood and using plugins to define this, just like
|
|
231
|
+
# any other extension/plugin would be is a better way to ensure consistent behavior.
|
|
232
|
+
return compas_blender.INSTALLABLE_PACKAGES
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
@compas.plugins.pluggable(category="install", selector="collect_all")
|
|
236
|
+
def installable_blender_packages():
|
|
237
|
+
"""Provide a list of packages to make available inside Blender.
|
|
238
|
+
|
|
239
|
+
Extensions providing Blender features
|
|
240
|
+
can implement this pluggable interface to automatically
|
|
241
|
+
have their packages made available inside Blender when
|
|
242
|
+
COMPAS is installed into it.
|
|
243
|
+
|
|
244
|
+
Examples
|
|
245
|
+
--------
|
|
246
|
+
>>> import compas.plugins
|
|
247
|
+
>>> @compas.plugins.plugin(category="install")
|
|
248
|
+
... def installable_blender_packages():
|
|
249
|
+
... return ["compas_fab"]
|
|
250
|
+
|
|
251
|
+
Returns
|
|
252
|
+
-------
|
|
253
|
+
:obj:`list` of :obj:`str`
|
|
254
|
+
List of package names to make available inside Blender.
|
|
255
|
+
"""
|
|
256
|
+
pass
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
@compas.plugins.pluggable(category="install", selector="collect_all")
|
|
260
|
+
def after_blender_install(installed_packages):
|
|
261
|
+
"""Allows extensions to execute actions after install to Blender is done.
|
|
262
|
+
|
|
263
|
+
Extensions providing Blender features
|
|
264
|
+
can implement this pluggable interface to perform
|
|
265
|
+
additional steps after an installation to Blender has
|
|
266
|
+
been completed.
|
|
267
|
+
|
|
268
|
+
Parameters
|
|
269
|
+
----------
|
|
270
|
+
installed_packages : :obj:`list` of :obj:`str`
|
|
271
|
+
List of packages that have been installed successfully.
|
|
272
|
+
|
|
273
|
+
Examples
|
|
274
|
+
--------
|
|
275
|
+
>>> import compas.plugins
|
|
276
|
+
>>> @compas.plugins.plugin(category="install")
|
|
277
|
+
... def after_blender_install(installed_packages):
|
|
278
|
+
... # Do something after package is installed to Blender, e.g. install the COMPAS UI, etc
|
|
279
|
+
... return [("compas_blender", "COMPAS Blender UI installed", True)]
|
|
280
|
+
|
|
281
|
+
Returns
|
|
282
|
+
-------
|
|
283
|
+
:obj:`list` of 3-tuple (str, str, bool)
|
|
284
|
+
List containing a 3-tuple with component name, message and True/False success flag.
|
|
285
|
+
|
|
286
|
+
"""
|
|
287
|
+
pass
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def _update_bootstrapper(install_path, packages):
|
|
291
|
+
# Take either the CONDA environment directory or the current Python executable's directory
|
|
292
|
+
python_directory = os.environ.get("CONDA_PREFIX", None) or os.path.dirname(sys.executable)
|
|
293
|
+
environment_name = os.environ.get("CONDA_DEFAULT_ENV", "")
|
|
294
|
+
conda_exe = os.environ.get("CONDA_EXE", "")
|
|
295
|
+
|
|
296
|
+
compas_bootstrapper = compas_blender._get_bootstrapper_path(install_path)
|
|
297
|
+
|
|
298
|
+
bootstrapper_data = compas_blender._get_bootstrapper_data(compas_bootstrapper)
|
|
299
|
+
installed_packages = bootstrapper_data.get("INSTALLED_PACKAGES", [])
|
|
300
|
+
installed_packages = list(set(installed_packages + list(packages)))
|
|
301
|
+
|
|
302
|
+
with open(compas_bootstrapper, "w") as f:
|
|
303
|
+
f.write('ENVIRONMENT_NAME = r"{}"\n'.format(environment_name))
|
|
304
|
+
f.write('PYTHON_DIRECTORY = r"{}"\n'.format(python_directory))
|
|
305
|
+
f.write('CONDA_EXE = r"{}"\n'.format(conda_exe))
|
|
306
|
+
f.write("INSTALLED_PACKAGES = {}".format(repr(installed_packages)))
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
def _filter_installable_packages(version, packages):
|
|
310
|
+
if not packages:
|
|
311
|
+
# Flatten list of results (resulting from collect_all pluggable)
|
|
312
|
+
packages = sorted(set(itertools.chain.from_iterable(installable_blender_packages()))) # type: ignore
|
|
313
|
+
return packages
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
# ==============================================================================
|
|
317
|
+
# Main
|
|
318
|
+
# ==============================================================================
|
|
319
|
+
|
|
320
|
+
if __name__ == "__main__":
|
|
321
|
+
import argparse
|
|
322
|
+
|
|
323
|
+
parser = argparse.ArgumentParser()
|
|
324
|
+
|
|
325
|
+
parser.add_argument(
|
|
326
|
+
"-v",
|
|
327
|
+
"--version",
|
|
328
|
+
choices=compas_blender.SUPPORTED_VERSIONS,
|
|
329
|
+
default=compas_blender.DEFAULT_VERSION,
|
|
330
|
+
help="The version of Blender to install the packages in.",
|
|
331
|
+
)
|
|
332
|
+
parser.add_argument("-p", "--packages", nargs="+", help="The packages to install.")
|
|
333
|
+
parser.add_argument("-c", "--clean", default=False, action="store_true", help="Clean up the installation directory")
|
|
334
|
+
|
|
335
|
+
args = parser.parse_args()
|
|
336
|
+
compas_blender.INSTALLATION_ARGUMENTS = args
|
|
337
|
+
|
|
338
|
+
install(version=args.version, packages=args.packages, clean=args.clean)
|
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
from typing import Iterable
|
|
2
|
+
from typing import List
|
|
3
|
+
from typing import Text
|
|
4
|
+
|
|
5
|
+
import bpy # type: ignore
|
|
6
|
+
|
|
7
|
+
from compas_blender.data import delete_unused_data
|
|
8
|
+
|
|
9
|
+
# ==============================================================================
|
|
10
|
+
# Delete
|
|
11
|
+
# ==============================================================================
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def delete_all_objects(purge_data: bool = True):
|
|
15
|
+
"""Delete all mesh and curve scene objects, and the attached mesh and curve data blocks.
|
|
16
|
+
|
|
17
|
+
Parameters
|
|
18
|
+
----------
|
|
19
|
+
purge_data : bool, optional
|
|
20
|
+
If True, also delete the underlying data blocks.
|
|
21
|
+
|
|
22
|
+
Returns
|
|
23
|
+
-------
|
|
24
|
+
None
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
bpy.ops.object.select_all(action="SELECT")
|
|
28
|
+
bpy.ops.object.delete(use_global=True, confirm=False)
|
|
29
|
+
if purge_data:
|
|
30
|
+
delete_unused_data()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def delete_object(obj: bpy.types.Object, purge_data: bool = True):
|
|
34
|
+
"""Delete a scene object.
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
obj : :blender:`bpy.types.Object`
|
|
39
|
+
The Blender scene object.
|
|
40
|
+
purge_data : bool, optional
|
|
41
|
+
If True, also delete the underlying data blocks.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
None
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
bpy.data.objects.remove(obj)
|
|
49
|
+
if purge_data:
|
|
50
|
+
delete_unused_data()
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def delete_objects(objects: Iterable[bpy.types.Object], purge_data: bool = True):
|
|
54
|
+
"""Delete multiple scene objects.
|
|
55
|
+
|
|
56
|
+
Parameters
|
|
57
|
+
----------
|
|
58
|
+
objects : list[:blender:`bpy.types.Object`]
|
|
59
|
+
A list of scene objects.
|
|
60
|
+
purge_data : bool, optional
|
|
61
|
+
If True, also delete the underlying data blocks.
|
|
62
|
+
|
|
63
|
+
Returns
|
|
64
|
+
-------
|
|
65
|
+
None
|
|
66
|
+
|
|
67
|
+
"""
|
|
68
|
+
for obj in objects:
|
|
69
|
+
delete_object(obj, purge_data=False)
|
|
70
|
+
if purge_data:
|
|
71
|
+
delete_unused_data()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def delete_object_by_name(name: str):
|
|
75
|
+
"""Delete the scene object corresponding to the given name.
|
|
76
|
+
|
|
77
|
+
Parameters
|
|
78
|
+
----------
|
|
79
|
+
name : str
|
|
80
|
+
The name of the Blender scene object.
|
|
81
|
+
|
|
82
|
+
Returns
|
|
83
|
+
-------
|
|
84
|
+
None
|
|
85
|
+
|
|
86
|
+
"""
|
|
87
|
+
obj = get_object_by_name(name)
|
|
88
|
+
delete_object(obj)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def delete_objects_by_names(names: Iterable[Text]):
|
|
92
|
+
"""Delete the scene objects corresponding to the list of names.
|
|
93
|
+
|
|
94
|
+
Parameters
|
|
95
|
+
----------
|
|
96
|
+
names : list[str]
|
|
97
|
+
The names of the Blender scene object.
|
|
98
|
+
|
|
99
|
+
Returns
|
|
100
|
+
-------
|
|
101
|
+
None
|
|
102
|
+
|
|
103
|
+
"""
|
|
104
|
+
objects = get_objects_by_names(names)
|
|
105
|
+
delete_objects(objects)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# ==============================================================================
|
|
109
|
+
# Get
|
|
110
|
+
# ==============================================================================
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def get_object_by_name(name: str) -> bpy.types.Object:
|
|
114
|
+
"""Get the object with the given name.
|
|
115
|
+
|
|
116
|
+
Parameters
|
|
117
|
+
----------
|
|
118
|
+
name : str
|
|
119
|
+
The name of the Blender scene object.
|
|
120
|
+
|
|
121
|
+
Returns
|
|
122
|
+
-------
|
|
123
|
+
:blender:`bpy.types.Object`
|
|
124
|
+
|
|
125
|
+
"""
|
|
126
|
+
return bpy.data.objects[name]
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def get_objects_by_names(names: Iterable[str]) -> List[bpy.types.Object]:
|
|
130
|
+
"""Get the objects corresponding to the given names.
|
|
131
|
+
|
|
132
|
+
Parameters
|
|
133
|
+
----------
|
|
134
|
+
names : list[str]
|
|
135
|
+
The names of the Blender scene object.
|
|
136
|
+
|
|
137
|
+
Returns
|
|
138
|
+
-------
|
|
139
|
+
list[:blender:`bpy.types.Object`]
|
|
140
|
+
|
|
141
|
+
"""
|
|
142
|
+
return [bpy.data.objects[name] for name in names]
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
# def get_objects(names=None, color=None, layer=None, type=None):
|
|
146
|
+
# if names:
|
|
147
|
+
# objects = get_objects_by_names(names)
|
|
148
|
+
# elif color:
|
|
149
|
+
# raise NotImplementedError
|
|
150
|
+
# elif layer:
|
|
151
|
+
# objects = list(bpy.data.collections[layer].objects)
|
|
152
|
+
# elif type:
|
|
153
|
+
# objects = [obj for obj in bpy.data.objects if obj.type == type.upper()]
|
|
154
|
+
# else:
|
|
155
|
+
# objects = list(bpy.data.objects)
|
|
156
|
+
# return objects
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
# def get_object_name(obj):
|
|
160
|
+
# return obj.name
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
# def get_objects_names(objects):
|
|
164
|
+
# return [get_object_name(obj) for obj in objects]
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
# def get_objects_layers(objects):
|
|
168
|
+
# return [obj.users_collection for obj in objects]
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
# def get_objects_types(objects):
|
|
172
|
+
# return [obj.type for obj in objects]
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
# def get_objects_coordinates(objects):
|
|
176
|
+
# return [list(obj.location) for obj in objects]
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
# def get_object_property(obj, property_name):
|
|
180
|
+
# return obj.get(property_name)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
# def get_objects_property(objects, property_name):
|
|
184
|
+
# return [get_object_property(obj, property_name) for obj in objects]
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
# def select_object(message="Select an object."):
|
|
188
|
+
# raise NotImplementedError
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
# def select_objects(message="Select objects."):
|
|
192
|
+
# raise NotImplementedError
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
# ==============================================================================
|
|
196
|
+
# Points
|
|
197
|
+
# ==============================================================================
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
# def get_points(layer=None):
|
|
201
|
+
# return [obj for obj in get_objects(layer=layer) if obj.type == "EMPTY"]
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# def get_points_coordinates(objects=None):
|
|
205
|
+
# if objects is None:
|
|
206
|
+
# objects = get_points()
|
|
207
|
+
# return [list(obj.location) for obj in objects if obj.type == "EMPTY"]
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
# def select_point(message="Select a point."):
|
|
211
|
+
# raise NotImplementedError
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
# def select_points(message="Select points."):
|
|
215
|
+
# raise NotImplementedError
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
# ==============================================================================
|
|
219
|
+
# Curves
|
|
220
|
+
# ==============================================================================
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
# def select_curve(message="Select curve."):
|
|
224
|
+
# raise NotImplementedError
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
# def select_curves(message="Select curves."):
|
|
228
|
+
# raise NotImplementedError
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
# def get_curves(layer=None):
|
|
232
|
+
# return [obj for obj in get_objects(layer=layer) if obj.type == "CURVE"]
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
# def get_curves_coordinates(objects):
|
|
236
|
+
# raise NotImplementedError
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
# ==============================================================================
|
|
240
|
+
# Meshes
|
|
241
|
+
# ==============================================================================
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
# def select_mesh(message="Select a mesh."):
|
|
245
|
+
# raise NotImplementedError
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
# def select_meshes(message="Select meshes."):
|
|
249
|
+
# raise NotImplementedError
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
# def get_meshes(layer=None):
|
|
253
|
+
# return [obj for obj in get_objects(layer=layer) if obj.type == "MESH"]
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
# def mesh_from_bmesh(bmesh):
|
|
257
|
+
# vertices = [list(vertex.co) for vertex in bmesh.data.vertices]
|
|
258
|
+
# faces = [list(face.vertices) for face in bmesh.data.polygons]
|
|
259
|
+
# return Mesh.from_vertices_and_faces(vertices=vertices, faces=faces)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
# ==============================================================================
|
|
263
|
+
# Surfaces
|
|
264
|
+
# ==============================================================================
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
# ==============================================================================
|
|
268
|
+
# Set
|
|
269
|
+
# ==============================================================================
|
|
270
|
+
|
|
271
|
+
# def set_select(objects=None):
|
|
272
|
+
# if objects:
|
|
273
|
+
# for obj in objects:
|
|
274
|
+
# obj.select_set(state=True)
|
|
275
|
+
# else:
|
|
276
|
+
# bpy.ops.object.select_all(action="SELECT")
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
# def set_deselect(objects=None):
|
|
280
|
+
# if objects:
|
|
281
|
+
# for obj in objects:
|
|
282
|
+
# obj.select_set(state=False)
|
|
283
|
+
# else:
|
|
284
|
+
# bpy.ops.object.select_all(action="DESELECT")
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
# def set_objects_layer(objects, layer):
|
|
288
|
+
# collection_new = bpy.data.collections.get(layer) or bpy.data.collections.new(layer)
|
|
289
|
+
# for obj in objects:
|
|
290
|
+
# for collection_old in obj.users_collection:
|
|
291
|
+
# collection_old.objects.unlink(obj)
|
|
292
|
+
# collection_new.objects.link(obj)
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
# def set_objects_coordinates(objects, coords):
|
|
296
|
+
# for obj, xyz in zip(objects, coords):
|
|
297
|
+
# obj.location = xyz
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
# def set_objects_rotations(objects, rotations):
|
|
301
|
+
# for obj, r in zip(objects, rotations):
|
|
302
|
+
# obj.rotation_euler = r
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
# def set_objects_scales(objects, scales):
|
|
306
|
+
# for obj, s in zip(objects, scales):
|
|
307
|
+
# obj.scale = s
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
# def set_objects_show_names(objects, show=True):
|
|
311
|
+
# for obj in objects:
|
|
312
|
+
# obj.show_name = show
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
# def set_objects_visible(objects, visible=True):
|
|
316
|
+
# for obj in objects:
|
|
317
|
+
# obj.hide_viewport = not visible
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
# def set_object_property(obj, property_name, property_value):
|
|
321
|
+
# obj[property_name] = property_value
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
# def set_objects_property(objects, property_name, property_value):
|
|
325
|
+
# for obj in objects:
|
|
326
|
+
# obj[property_name] = property_value
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import compas_blender
|
|
2
|
+
|
|
3
|
+
if __name__ == "__main__":
|
|
4
|
+
import argparse
|
|
5
|
+
|
|
6
|
+
parser = argparse.ArgumentParser()
|
|
7
|
+
|
|
8
|
+
parser.add_argument(
|
|
9
|
+
"-v",
|
|
10
|
+
"--version",
|
|
11
|
+
choices=compas_blender.SUPPORTED_VERSIONS,
|
|
12
|
+
default=compas_blender.DEFAULT_VERSION,
|
|
13
|
+
help="The version of Blender.",
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
args = parser.parse_args()
|
|
17
|
+
|
|
18
|
+
print(compas_blender._get_default_blender_python_path(args.version))
|