fix ordering in naming arguments and help

add commands TclCommandAddPolygon(add_poly, add_polygon) and TclCommandAddPolyline(add_polyline)

implement add_polyline in camlib.py
This commit is contained in:
Kamil Sopko
2016-03-17 12:14:12 +01:00
parent 2e51c1e9cd
commit 78854f7fe0
7 changed files with 209 additions and 40 deletions

View File

@@ -136,6 +136,27 @@ class Geometry(object):
log.error("Failed to run union on polygons.")
raise
def add_polyline(self, points):
"""
Adds a polyline to the object (by union)
:param points: The vertices of the polyline.
:return: None
"""
if self.solid_geometry is None:
self.solid_geometry = []
if type(self.solid_geometry) is list:
self.solid_geometry.append(LineString(points))
return
try:
self.solid_geometry = self.solid_geometry.union(LineString(points))
except:
#print "Failed to run union on polygons."
log.error("Failed to run union on polylines.")
raise
def subtract_polygon(self, points):
"""
Subtract polygon from the given object. This only operates on the paths in the original geometry, i.e. it converts polygons into paths.