Salome HOME
Finalization of the sketch drawer "Create dimensions" flag implemented
authormpv <mpv@opencascade.com>
Tue, 18 Dec 2018 06:50:01 +0000 (09:50 +0300)
committermpv <mpv@opencascade.com>
Tue, 18 Dec 2018 06:50:15 +0000 (09:50 +0300)
src/SketchPlugin/Test/TestSketchDrawer.py
src/SketchPlugin/doc/images/SketchDrawer_panel.png
src/SketchPlugin/doc/sketchDrawer.rst

index b90c9489c211b0700bd1fcdbb4b569d9f0aceaf1..351adabebc8f1eb8f99528af102589410cb433b9 100644 (file)
@@ -44,19 +44,31 @@ SketchConstraintRadius_2 = Sketch_1.setRadius(SketchCircle_1.results()[1], 5)
 model.do()
 Extrusion_1 = model.addExtrusion(Part_1_doc, [model.selection("FACE", "Sketch_1/Face-SketchLine_1r-SketchArc_1_2f-SketchLine_2f-SketchLine_3f-SketchLine_4f-SketchCircle_1_2r")], model.selection(), 10, 0)
 model.do()
-# create a drawer feature of the extrusion and upper face
-Drawer = Part_1_doc.addFeature("SketchDrawer")
-Drawer.selection("base_shape").setValue(Extrusion_1.feature(), None)
+# create a drawer feature of the extrusion and upper face, without dimensions
+Drawer1 = Part_1_doc.addFeature("SketchDrawer")
+Drawer1.selection("base_shape").setValue(Extrusion_1.feature(), None)
+Drawer1.boolean("add_dimensions").setValue(False)
 PlaneSelection = model.selection("FACE", "Extrusion_1_1/To_Face")
-PlaneSelection.fillAttribute(Drawer.selection("plane"))
+PlaneSelection.fillAttribute(Drawer1.selection("plane"))
+model.do()
+# create a drawer feature of the extrusion and upper face, with dimensions
+Drawer2 = Part_1_doc.addFeature("SketchDrawer")
+Drawer2.selection("base_shape").setValue(Extrusion_1.feature(), None)
+Drawer2.boolean("add_dimensions").setValue(True)
+PlaneSelection = model.selection("FACE", "Extrusion_1_1/To_Face")
+PlaneSelection.fillAttribute(Drawer2.selection("plane"))
 model.end()
 
 # check that a sketch is created with valid elements
-assert(Part_1_doc.size("Construction") == 2) # two sketches: base of extrusion and this new one
+assert(Part_1_doc.size("Construction") == 3) # three sketches: base of extrusion and drawer's two
 
 from ModelAPI import *
 aFactory = ModelAPI_Session.get().validators()
 
-Sketch = objectToFeature(Part_1_doc.object("Features", 2)) # created sketch feature
-assert(aFactory.validate(Sketch))
-assert(len(Sketch.results()) == 1)
+Sketch1 = objectToFeature(Part_1_doc.object("Features", 2)) # the first created sketch feature
+assert(aFactory.validate(Sketch1))
+assert(len(Sketch1.results()) == 1)
+
+Sketch2 = objectToFeature(Part_1_doc.object("Features", 3)) # the second created sketch feature
+assert(aFactory.validate(Sketch2))
+assert(len(Sketch2.results()) == 1)
index 8b786503df9652695d63377c2d26db4f609c78eb..6d7db60b7163268fde92165cef8176e0155415e5 100644 (file)
Binary files a/src/SketchPlugin/doc/images/SketchDrawer_panel.png and b/src/SketchPlugin/doc/images/SketchDrawer_panel.png differ
index 20bb2eb4d53ede064cac0c49101b679cac662015..f019f472d0df458035c8ff69f7e74b3f85e71d60 100644 (file)
@@ -32,6 +32,11 @@ The following property panel appears:
 
 Click in the view once to set the whole original model, then click a second time to set the
 plane or planar face - a base of sketch. This can be plane on the original model.
+
+Flag "Create dimensions" allows to disable creation of dimensional constraints in the resulting sketch.
+So, if it is disabled, then lengths and radiuses will be omitted. It allows to avoid overconstraint
+situation and simplify work of the sketch solver.
+
 On Apply button press the new sketch will be created in the Object Browser tree.
 
 Result