Giter Site home page Giter Site logo

compas-dev / compas Goto Github PK

View Code? Open in Web Editor NEW
299.0 26.0 102.0 2.06 GB

Core packages of the COMPAS framework.

Home Page: https://compas.dev/compas/

License: MIT License

Python 100.00%
geometry datastructures data grasshopper3d rhino3d blender3d aec rpc

compas's Introduction

The COMPAS framework

build GitHub - License Conda Downloads pip downloads PyPI - Python Version PyPI - Latest Release Conda (channel only) Conda - Platform DOI Twitter Follow

The COMPAS framework is an open-source, Python-based framework for computational research and collaboration in architecture, engineering, digital fabrication and construction.

The framework consists of a general-purpose core library, written in pure Python, and a growing collection of extensions that provide easy access to peer-reviewed research, state-of-the-art external libraries such as CGAL, libigl and Triangle, and tools with specialized functionality for AEFC applications such as Abaqus, ANSYS, SOFISTIK, ROS, etc.

COMPAS has dedicated packages for working with Rhino, Grasshopper, and Blender, but it can be used in any environment that supports Python scripting. It is available on PyPI and conda-forge and can be easily installed using popular package managers on multiple platforms.

COMPAS 2.0!

We are working on a new major release of the framework, COMPAS 2.0! Therefore, be aware that the current version of the repository already contains some changes that are incompatible with the version 1 releases. The documentation of the latest stable version (COMPAS 1.17.9) is available here.

Installation

The recommended way to install COMPAS is to use Anaconda/conda:

conda config --add channels conda-forge
conda install compas

For other installation options, see the user guide

First Steps

Questions and feedback

The COMPAS framework has a forum for questions and discussions.

Issue tracker

If you find a bug, please help us solve it by filing a report.

Contributing

If you want to contribute, check out the contribution guidelines.

Changelog

See changes between releases on the changelog.

License

The main library of COMPAS is released under the MIT license.

Credits

COMPAS is developed by a small team of core developers (compas-dev) and with the support of contributers from the open source community. See the list of authors for a complete overview...

compas's People

Contributors

achillx avatar arpastrana avatar beverlylytle avatar chenkasirer avatar deviezeviking avatar duchaoyu avatar funkchaser avatar genekao avatar gonzalocasas avatar jckenny59 avatar jf--- avatar juney-lee avatar kathrindoerfler avatar licini avatar mattiskoh avatar nizartaha avatar nmaslarinos avatar petrasvestartas avatar rippmann avatar robin-gdwl avatar robin-oval avatar romanarust avatar romanavyzn avatar sam-bouten avatar tetov avatar tomvanmele avatar wenqian157 avatar worbit avatar xingxinhe avatar yck011522 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

compas's Issues

def face_corners(self, fkey):

In the heat of the moment I accidently confused it with "def face_vertices". @brgcode What are face corners? Descriptive docstring missing.

And lets give face_coordinates and optional ordered=True arg.

topology mesh examples point to wrong package

The code example on the page mesh_subdivide_catmullclark tries to import the SubdMeshViewer from the compas.plotters package, but this class is defined in the file meshviewer.py in the viewers package.
Maybe some disambiguation note about what are plotters and what are viewers and when to use which / search where would be helpful also.

mesh.from_lines import error

Message: cannot import FaceNetwork from compas.topology
Traceback:
line 412, in from_lines, "C:\Users\rippmanm\Documents\GitHub\compas\src\compas\datastructures\mesh\mesh.py"

It should be:
from compas.datastructures.network import FaceNetwork

assembly datastructure

add a data structure for assemblies by combining network and mesh to create a network of closed polygonal meshes in which the interfaces are represented by the edges of the network.

Object names in Rhino 6 do not accept braces or brackets!

Something to be aware of. Potential problems when dumping dictionary and list objects using, for example:
input = json.dumps({'type': 'f','key': fkey, 'data': mesh.facedata[fkey], 'vertices': mesh.face[fkey]})
rs.ObjectName(poly, input)

Is there already something in compas_rhino that depends on braces or brackets in object names?

See:
https://mcneel.myjetbrains.com/youtrack/issue/RH-44359

and here:
https://discourse.mcneel.com/t/rs-objectname-doesnt-work-with-strings-containing-curly-braces-in-rhino-6/55942/2

Mesh.from_points() and delaunay_from_points() mismatch in Return and inputs

Mesh.from_points() should return an object (Mesh datastructure) as in the docstring, however it calls delaunay_from_points() which currently says it returns an object, but returns mesh face indices instead.

Also delaunay_from_points() is feeding in cls, which is not needed as a Mesh() is already instantiated in the function, so an argument error currently occurs.

Fix: is to remove cls from delaunay_from_points() as an input argument, and Return the mesh that is made inside delaunay_from_points().

Problem to add mesh in Rhino after deleting some vertices

from compas.datastructures.mesh import Mesh
import compas_rhino as rhino

vertices = [[0,0,0],[1,0,0],[1,1,0],[0,1,0],[2,2,0]]
faces = [[0,1,3],[1,2,3]]
mesh = Mesh.from_vertices_and_faces(vertices, faces)

print mesh

mesh.delete_vertex(2)
mesh.delete_vertex(4)

print mesh

rhino.xdraw_mesh([mesh.vertex_coordinates(vkey) for vkey in mesh.vertices()], [mesh.face_vertices(fkey) for fkey in mesh.faces()], None, None)

mesh.from_lines boundary face does not get deleted

Strange behaviour (occurred on larger input geometries). Sometimes the boundary face does not get deleted with delete_boundary_face=True. However, another face get deleted instead.

    if delete_boundary_face:
        mesh.delete_face(0)

It seems the the boundary face is not always indexed 0.

remove "smallest" from angle function names

all functions named "angle_smallest_xxx" return the smallest angle between the specified elements. the functions named "angles_xxx" return the smallest angle and the other angle as a tuple, with the smallest angle always first.

should we rename "angle_smallest_xxx" to just "angle_xxx"?

`Point` objects don't support slicing

since point objects (compas.geomtry.Point) don't support slicing, the polygons can't be used transparently with the corresponding plotter methods.

for example, the following will throw an error because the underlying drawing function takes 2D slices of the points of the polygons to pass on to Matplotlib.

from compas.geometry import Point
from compas.plotters import Plotter

polygon = Polygon([[1, 1, 0], [0, 1, 0], [0, 0, 0], [1, 0, 0]])

plotter = Plotter(figsize=(10, 7))
plotter.draw_polygons({'points': polygon.points})
plotter.show()

vertices_on_boundary

Provide support for multiple boundaries (holes) in vertices_on_boundary(self, ordered=False). This would change the output from list to list of lists. So, this would break existing code using vertices_on_boundary.

devo_numpy import error in Rhino

When importing anything from compas.numerical in Rhino, an error is thrown saying Numpy could not be imported. It tracks down to the Differential Evolution importing its own plotter and the plotter imports Numpy without a try except. I like the idea of having the plotting be a kwarg in the optimisation function, but there is now a lot of stuff in compas.numerical that is Numpy free.

Missing check in edge_coordinates

Missing check in edge_coordinates in datastructures._mixins.geoemtry: returns the coordinates of two vertices, even if they are not connected by an edge.

Example for XFunc and CPython in docs is using develop version of XFunc, not master

A user identified the following error in the example https://compas-dev.github.io/main/tutorial/cpython.html:

"I tried to run the example from tutorial CPython in Rhino that is on the
compas web page. When I copied the code in Rhino Python Editor it gave me
back Message: need more than 4 values to unpack. Is this example working at
your computer?
"

It looks like the example is using the newer develop XFunc format, where results are returned directly, expecting xyz, q, f, l, r in this case, rather than the master version which returns the results dictionary odict.

mesh_unify_cycles does not always work

import random

from compas.geometry import distance_point_point
from compas.datastructures import Mesh
from compas.viewers import MeshViewer
from compas.topology import mesh_unify_cycles
from compas.geometry import convex_hull_numpy

radius = 5
origin = (0., 0., 0.)
count = 0
points = []

while count < 1000:
    x = (random.random() - 0.5) * radius * 2
    y = (random.random() - 0.5) * radius * 2
    z = (random.random() - 0.5) * radius * 2
    pt = x, y, z

    if distance_point_point(origin, pt) <= radius:
        points.append(pt)
        count += 1

vertices, faces = convex_hull_numpy(points)

i_index   = {i: index for index, i in enumerate(vertices)}
vertices = [points[index] for index in vertices]
faces     = [[i_index[i] for i in face] for face in faces]

mesh = Mesh.from_vertices_and_faces(vertices, faces)

mesh_unify_cycles(mesh)

viewer = MeshViewer(mesh)

viewer.axes_on = False
viewer.grid_on = False

viewer.setup()
viewer.show()

Displays a hull with variable colors for the faces, which means that some faces are seen from the back and others from the front.

ssh com client relies on paramiko

the ssh implementation relies on paramiko, which is not part of the standard library.
import errors should be handled properly (and with instructions for the user), otherwise it can't be even be included in the docs...

a possible solution can be found in the implementation of the matlab engine...

Python 3 cStringIO

ImportError: No module named 'cStringIO' will occur for Python 3, as this is now:

"The StringIO and cStringIO modules are gone. Instead, import the io module and use io.StringIO or io.BytesIO for text and data respectively."

Affects functions such as XFunc()

bug in compas.geometry orient_points

from compas.geometry import orient_points

pts = [(1, 1, 0), (-1, 1, 0), (-1, -1, 0), (1, -1, 0)]
ref_plane = [(0, 0, 0),(0, 0, 1)]
print orient_points(pts, ref_plane)

The result of the above code is the same as the input pts as expected, since the default target plane is the global xy plane, or [(0,0,0), (0,0,1)], which in this case is the same as the reference plane. However, the function complains when the ref_plane is facing downward in negative z direction:

from compas.geometry import orient_points

pts = [(1, 1, 0), (-1, 1, 0), (-1, -1, 0), (1, -1, 0)]
ref_plane = [(0, 0, 0),(0, 0, -1)]
print orient_points(pts, ref_plane)

The expected result should be a reversed list of pts. However, it raises the following error:

"Message: Attempted to divide by zero.

Traceback:
line 354, in normalize_vector, "C:\compas-dev\compas\src\compas\geometry\basic.py"
line 279, in rotation_matrix, "C:\compas-dev\compas\src\compas\geometry\transformations.py"
line 414, in rotate_points, "C:\compas-dev\compas\src\compas\geometry\transformations.py"
line 684, in orient_points, "C:\compas-dev\compas\src\compas\geometry\transformations.py"

It seems like it's complaining because the normals of the reference and target planes are pointing in opposite directions, which means the length of the vector is zero, and therefore cannot be normalized (divide by zero)?

def command_line_menu(interface):

add example and make sure different submenus can contain the same entry. -> return nested layers!

  • consider to convert this into an command object. Would make the initialisation of menus a lot easier.

Wrong call of FaceNetwork in Mesh.from_lines()

Cannot import FaceNetwork from compas.topology at line 412, in from_lines, "...\compAS\core\src\compas\datastructures\mesh\mesh.py"

Should be called from compas.datastructures.network

finding the first neighbour of bottom left vertex sometimes fails

the function is supposed to return the first CW neighbour wrt a virtual vertex that is further down and to the left of the most bottom left vertex of the network.

it computes the angles between the virtual edge and all other edges connected to the bottom left vertex and then returns the neighbour with the smallest angle.

this is only correct if at least one of the neighbours forms a CW angle around the bottom left vertex wrt to the virtual vertex.

normalisation of zero vectors fails

the function for normalising vectors fails if the vector has zero length, i.e. in the case where the vector is [0, 0, 0].

the function should check the length of the vector, before dividing the components through the length, to avoid division-through-zero errors being raised.

Face modifications

Functions to modify the vertices of a face ([a, b, c, d] -> [a, b, c, e] or [a, b, c, d] -> [a, b, c, d, e] for instance) that combines delete_face and add_face or that modifies directly the face vertices while updating the halfedges.

planarity SyntaxError

line 415
vectors = [[pos[n][axis] - pos[nbr][axis] for axis in 0, 1] for n in nbrs if n != key]
Returns SyntaxError under Python 3

Viewer doesnt close properly for Mac users

When using the compas Viewer, once finished, the window does not show red cross button and so cannot be easily closed. Need to resort to force closing of windows.

Confirmed problem for MacOS 10.13.2 and Python 2.7

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.