1 # Initialization of the test
3 from GeomDataAPI import *
4 from GeomAlgoAPI import *
8 aSession = ModelAPI_Session.get()
9 aDocument = aSession.moduleDocument()
12 aSession.startOperation()
13 aPartFeature = aDocument.addFeature("Part")
14 aSession.finishOperation()
15 aPartResult = modelAPI_ResultPart(aPartFeature.firstResult())
16 aPart = aPartResult.partDoc()
19 aSession.startOperation()
20 aSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch"))
21 anOrigin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
22 anOrigin.setValue(0, 0, 0)
23 aDirX = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
24 aDirX.setValue(1, 0, 0)
25 aNorm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
26 aNorm.setValue(0, 0, 1)
30 aSketchLineFeature = aSketchFeature.addFeature("SketchLine")
31 aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint"))
32 aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint"))
33 aSketchLineStartPoint.setValue(0, 0)
34 aSketchLineEndPoint.setValue(0, 50)
35 aSketchLineFeature = aSketchFeature.addFeature("SketchLine")
36 aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint"))
37 aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint"))
38 aSketchLineStartPoint.setValue(0, 50)
39 aSketchLineEndPoint.setValue(50, 50)
40 aSketchLineFeature = aSketchFeature.addFeature("SketchLine")
41 aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint"))
42 aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint"))
43 aSketchLineStartPoint.setValue(50, 50)
44 aSketchLineEndPoint.setValue(50, 0)
45 aSketchLineFeature = aSketchFeature.addFeature("SketchLine")
46 aSketchLineStartPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("StartPoint"))
47 aSketchLineEndPoint = geomDataAPI_Point2D(aSketchLineFeature.attribute("EndPoint"))
48 aSketchLineStartPoint.setValue(50, 0)
49 aSketchLineEndPoint.setValue(0, 0)
50 aSession.finishOperation()
51 aSketchResult = aSketchFeature.firstResult()
52 aSketchShape = aSketchResult.shape()
55 aSession.startOperation()
56 aWireFeature = aPart.addFeature("Wire")
57 aBaseObjectsList = aWireFeature.selectionList("base_objects")
58 aShapeExplorer = GeomAPI_ShapeExplorer(aSketchShape, GeomAPI_Shape.EDGE)
59 while aShapeExplorer.more():
60 aBaseObjectsList.append(aSketchResult, aShapeExplorer.current())
62 aSession.finishOperation()
65 assert (len(aWireFeature.results()) > 0)