# Commit the transaction
model.do()
# Check the result
- dot_product = (l1.endPointData().x() - l1.startPointData().x()) * \
- (l2.endPointData().x() - l2.startPointData().x()) + \
- (l1.endPointData().y() - l1.startPointData().y()) * \
- (l2.endPointData().y() - l2.startPointData().y())
+ dot_product = (l1.endPoint().x() - l1.startPoint().x()) * \
+ (l2.endPoint().x() - l2.startPoint().x()) + \
+ (l1.endPoint().y() - l1.startPoint().y()) * \
+ (l2.endPoint().y() - l2.startPoint().y())
norm_1 = math.sqrt(
- math.pow((l1.endPointData().x() - l1.startPointData().x()), 2) +
- math.pow((l1.endPointData().y() - l1.startPointData().y()), 2)
+ math.pow((l1.endPoint().x() - l1.startPoint().x()), 2) +
+ math.pow((l1.endPoint().y() - l1.startPoint().y()), 2)
)
norm_2 = math.sqrt(
- math.pow((l2.endPointData().x() - l2.startPointData().x()), 2) +
- math.pow((l2.endPointData().y() - l2.startPointData().y()), 2)
+ math.pow((l2.endPoint().x() - l2.startPoint().x()), 2) +
+ math.pow((l2.endPoint().y() - l2.startPoint().y()), 2)
)
angle = math.acos(dot_product / (norm_1 * norm_2))
self.assertAlmostEqual(
def test_set_coincident(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
l2 = self.sketch.addLine(0, 1, 1, 1)
- self.sketch.setCoincident(l1.endPointData(), l2.startPointData())
+ self.sketch.setCoincident(l1.endPoint(), l2.startPoint())
model.do()
def test_none_type_arguments(self):
l2 = self.sketch.addLine(0, 1, 1, 1)
with self.assertRaises(TypeError):
- self.sketch.setCoincident(None, l2.startPointData())
+ self.sketch.setCoincident(None, l2.startPoint())
def test_empty_arguments(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
with self.assertRaises(TypeError):
- self.sketch.setCoincident(l1.endPointData())
+ self.sketch.setCoincident(l1.endPoint())
if __name__ == "__main__":
unittest.main(verbosity=2)
\ No newline at end of file
model.do()
# Check the result
length_1 = math.sqrt(
- math.pow((l1.endPointData().x() - l1.startPointData().x()), 2) +
- math.pow((l1.endPointData().y() - l1.startPointData().y()), 2)
+ math.pow((l1.endPoint().x() - l1.startPoint().x()), 2) +
+ math.pow((l1.endPoint().y() - l1.startPoint().y()), 2)
)
length_2 = math.sqrt(
- math.pow((l2.endPointData().x() - l2.startPointData().x()), 2) +
- math.pow((l2.endPointData().y() - l2.startPointData().y()), 2)
+ math.pow((l2.endPoint().x() - l2.startPoint().x()), 2) +
+ math.pow((l2.endPoint().y() - l2.startPoint().y()), 2)
)
self.assertAlmostEqual(length_1, length_2, delta=TestSketcher.DELTA)
def runTest(self):
l1 = self.sketch.addLine(0, 0, 0, 1)
l2 = self.sketch.addLine(0, 1, 1, 1)
- self.sketch.setCoincident(l1.endPointData(), l2.startPointData())
+ self.sketch.setCoincident(l1.endPoint(), l2.startPoint())
self.sketch.setFillet(l1.result(), l2.result(), 10.0)
model.do()
line = self.sketch.addLine(0, 0, 1, 1)
self.sketch.setHorizontal(line.result())
model.do()
- self.assertEqual(line.startPointData().y(), line.endPointData().y())
+ self.assertEqual(line.startPoint().y(), line.endPoint().y())
if __name__ == "__main__":
unittest.main()
\ No newline at end of file
model.do()
# Check the result
length = math.sqrt(
- math.pow((line.endPointData().x() - line.startPointData().x()), 2) +
- math.pow((line.endPointData().y() - line.startPointData().y()), 2)
+ math.pow((line.endPoint().x() - line.startPoint().x()), 2) +
+ math.pow((line.endPoint().y() - line.startPoint().y()), 2)
)
self.assertAlmostEqual(length, 25.0, delta=TestSketcher.DELTA)
self.sketch.setPerpendicular(l1.result(), l2.result())
model.do()
- dot_product = (l1.endPointData().x() - l1.startPointData().x()) * \
- (l2.endPointData().x() - l2.startPointData().x()) + \
- (l1.endPointData().y() - l1.startPointData().y()) * \
- (l2.endPointData().y() - l2.startPointData().y())
+ dot_product = (l1.endPoint().x() - l1.startPoint().x()) * \
+ (l2.endPoint().x() - l2.startPoint().x()) + \
+ (l1.endPoint().y() - l1.startPoint().y()) * \
+ (l2.endPoint().y() - l2.startPoint().y())
self.assertAlmostEqual(dot_product, 0.0, delta=TestSketcher.DELTA)
if __name__ == "__main__":
self.line = self.sketch.addLine(0, 0, 0, 1)
self.arc = self.sketch.addArc(0, 1, 0, 0, 1, 1)
self.sketch.setCoincident(
- self.line.endPointData(), self.arc.startPoint()
+ self.line.endPoint(), self.arc.startPoint()
)
def test_set_tangent(self):
line = self.sketch.addLine(0, 0, 1, 1)
self.sketch.setVertical(line.result())
model.do()
- self.assertEqual(line.startPointData().x(), line.endPointData().x())
+ self.assertEqual(line.startPoint().x(), line.endPoint().x())
if __name__ == "__main__":
unittest.main()
\ No newline at end of file
l3 = mybase.addLine(1, 1, 1, 0)
l4 = mybase.addLine(1, 0, 0, 0)
-mybase.setCoincident(l1.endPointData(), l2.startPointData())
-mybase.setCoincident(l2.endPointData(), l3.startPointData())
-mybase.setCoincident(l3.endPointData(), l4.startPointData())
-mybase.setCoincident(l4.endPointData(), l1.startPointData())
+mybase.setCoincident(l1.endPoint(), l2.startPoint())
+mybase.setCoincident(l2.endPoint(), l3.startPoint())
+mybase.setCoincident(l3.endPoint(), l4.startPoint())
+mybase.setCoincident(l4.endPoint(), l1.startPoint())
mybase.setParallel(l1.result(), l3.result())
mybase.setParallel(l2.result(), l4.result())
mybase.setPerpendicular(l1.result(), l4.result())
mywidth = mybase.setLength(l1.result(), 50)
-mylength = mybase.setDistance(l1.startPointData(), l3.result(), 50)
+mylength = mybase.setDistance(l1.startPoint(), l3.result(), 50)
# Creating the extrusion
mybase.setPerpendicular(line[0].result(), line[3].result())
mywidth = mybase.setLength(line[0].result(), 50)
-mylength = mybase.setDistance(line[0].startPointData(), line[2].result(), 50)
+mylength = mybase.setDistance(line[0].startPoint(), line[2].result(), 50)
# Creating the extrusion
left, top, right, bottom = sketch.addPolygon(*geom_points)
# Set constraints
- sketch.setRigid(left.startPointData())
+ sketch.setRigid(left.startPoint())
sketch.setHorizontal(bottom.result())
sketch.setHorizontal(top.result())
sketch.setLength(top.result(), "L")
sketch.setLength(left.result(), "L")
- sketch.setFillet(left.endPointData(), 32)
+ sketch.setFillet(left.endPoint(), 32)
model.do() #!!!
sketch.setLength(h2.result(), 20)
sketch.setCoincident(arc.center(), v1.result())
- sketch.setCoincident(arc.startPoint(), h2.endPointData())
- sketch.setCoincident(arc.endPoint(), h1.startPointData())
+ sketch.setCoincident(arc.startPoint(), h2.endPoint())
+ sketch.setCoincident(arc.endPoint(), h1.startPoint())
# Binding
left_e = sketch.addLine("Extrusion_1_1/LateralFace_2|Extrusion_1_1/ToFace_1")
- sketch.setCoincident(left_e.startPointData(), left.endPointData())
- sketch.setCoincident(left_e.endPointData(), left.startPointData())
+ sketch.setCoincident(left_e.startPoint(), left.endPoint())
+ sketch.setCoincident(left_e.endPoint(), left.startPoint())
model.do() #!!!
sketch.setLength(top_left.result(), l)
sketch.setCoincident(top_middle.result(), arc.center())
- sketch.setCoincident(top_middle.endPointData(), arc.startPoint())
- sketch.setCoincident(top_middle.startPointData(), arc.endPoint())
+ sketch.setCoincident(top_middle.endPoint(), arc.startPoint())
+ sketch.setCoincident(top_middle.startPoint(), arc.endPoint())
sketch.setRadius(arc.result(), r)
# Binding
bottom_e = sketch.addLine("Boolean_1_1/Modified_1|Boolean_1_1/Modified_3")
- sketch.setCoincident(bottom_e.result(), bottom.startPointData())
- sketch.setCoincident(bottom_e.startPointData(), bottom.endPointData())
+ sketch.setCoincident(bottom_e.result(), bottom.startPoint())
+ sketch.setCoincident(bottom_e.startPoint(), bottom.endPoint())
model.do() #!!!
# Binding
bottom_e = sketch.addLine("Boolean_2_1/Modified_8|Boolean_2_1/Modified_7")
- sketch.setCoincident(bottom_e.endPointData(), bottom.startPointData())
- sketch.setCoincident(bottom_e.startPointData(), left.startPointData())
+ sketch.setCoincident(bottom_e.endPoint(), bottom.startPoint())
+ sketch.setCoincident(bottom_e.startPoint(), left.startPoint())
left_e = sketch.addLine("Boolean_2_1/Modified_3|Boolean_2_1/Modified_2")
- sketch.setCoincident(left_e.startPointData(), left.endPointData())
+ sketch.setCoincident(left_e.startPoint(), left.endPoint())
model.do() #!!!
# TODO : methods below will be removed.
# Kept until all tests have been updated
- def startPointData(self):
+ def startPoint(self):
return self._start_point
- def endPointData(self):
+ def endPoint(self):
return self._end_point
def setExternal(self, name):
>>> plane = model.defaultPlane("XOY")
>>> sketch = model.addSketch(part, plane)
>>> line = sketch.addLine(0, 0, 0, 1)
- >>> line.endPointData().x()
+ >>> line.endPoint().x()
0.0
- >>> line.endPointData().y()
+ >>> line.endPoint().y()
1.0
"""
# Adding and connecting next lines
for c2 in coords[2:]:
line_2 = self.addLine(c1, c2)
- self.setCoincident(line_1.endPointData(), line_2.startPointData())
+ self.setCoincident(line_1.endPoint(), line_2.startPoint())
polyline.append(line_2)
c1 = c2
line_1 = line_2
cn = coords[len(coords) - 1]
ln = self.addLine(cn, c0)
self.setCoincident(
- pg[len(coords) - 2].endPointData(), ln.startPointData()
+ pg[len(coords) - 2].endPoint(), ln.startPoint()
)
self.setCoincident(
- ln.endPointData(), pg[0].startPointData()
+ ln.endPoint(), pg[0].startPoint()
)
pg.append(ln)
return pg