compas-dev / compas Goto Github PK
View Code? Open in Web Editor NEWCore packages of the COMPAS framework.
Home Page: https://compas.dev/compas/
License: MIT License
Core packages of the COMPAS framework.
Home Page: https://compas.dev/compas/
License: MIT License
add example and make sure different submenus can contain the same entry. -> return nested layers!
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)
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
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
I get this error when I run my code. It refers to line 552 in datastructures/mesh/mesh.py.
If I delete "ordered=True" in the function face_vertices() it works.
@tomvanmele
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()
Given that Python 3.6 wheels are available for Pyside, and that Pyside2 has no clear release date. Suggestion is to use Pyside instead for the current Viewer, and make available support for Pyside widgets in compas and then port over to Pyside2 later.
ctypes
is not available in the ironpython version used by Rhino mac.
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?
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.
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
.
The leave vertices of a network are re-connected from their original locations.
This does not always produce the correct results.
it is unclear if the function only returns an intersection point if all lines intersect at one point, or all intersection points between pairs of lines in the set.
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.
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"?
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.
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.
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...
Should all transformation matrices be moved to compas.numerical.matrices?
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.
it throws a SystemError because it can't find libdl.so
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().
see for example:
plotters should just ignore z-coordinate...
plotters have options for generating dynamic plots, but not for saving them.
would be very useful!
“network_find_crossings” from compas.topology, returns repetitive edge pairs.
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.
Add type parameter in RhinoSurface.borders() to choose the type or border from rs.DuplicateSurfaceBorder()
0 = all
1 = exterior
2 = interior
http://developer.rhino3d.com/5/api/RhinoScriptSyntax/win/#surface-DuplicateSurfaceBorder
ordering of vertex neighbours currently relies on the presence of faces and halfedge information.
it could make sense to have a function that orders vertex neighbours based on CCW sorting in a local frame.
unlike the CAD artists, plotters have no clear function.
Missing check in edge_coordinates in datastructures._mixins.geoemtry: returns the coordinates of two vertices, even if they are not connected by an edge.
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()
The current implementation of mesh_unweld_vertices
creates a new face and deletes the old.
As a result the identifier of the unwelded face changes, and the new face identifier is not returned.
network_is_xy
complains that Network object is not iterable
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.
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)?
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
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.
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
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.
add edge constraints in delaunay_from_points
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.
move transformations to algorithms?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.