1 <!doctype HTML public "-//W3C//DTD HTML 4.0 Frameset//EN">
\r
6 <title>Repairing Operations</title>
\r
7 <meta http-equiv="content-type" content="text/html; charset=windows-1252">
\r
8 <meta name="generator" content="RoboHelp by eHelp Corporation www.ehelp.com">
\r
9 <link rel="stylesheet" href="default_ns.css"><script type="text/javascript" language="JavaScript" title="WebHelpSplitCss">
\r
11 if (navigator.appName !="Netscape")
\r
12 { document.write("<link rel='stylesheet' href='default.css'>");}
\r
15 <style type="text/css">
\r
17 p.whs1 { font-family:'Lucida Console' , monospace; }
\r
18 p.whs2 { font-family:'Times New Roman' , serif; }
\r
20 </style><script type="text/javascript" language="JavaScript" title="WebHelpInlineScript">
\r
23 if (innerWidth != origWidth || innerHeight != origHeight)
\r
26 if ((parseInt(navigator.appVersion) == 4) && (navigator.appName == "Netscape")) {
\r
27 origWidth = innerWidth;
\r
28 origHeight = innerHeight;
\r
34 <style type="text/css">
\r
36 div.WebHelpPopupMenu { position:absolute; left:0px; top:0px; z-index:4; visibility:hidden; }
\r
38 </style><script type="text/javascript" language="javascript1.2" src="whmsg.js"></script>
\r
39 <script type="text/javascript" language="javascript" src="whver.js"></script>
\r
40 <script type="text/javascript" language="javascript1.2" src="whproxy.js"></script>
\r
41 <script type="text/javascript" language="javascript1.2" src="whutils.js"></script>
\r
42 <script type="text/javascript" language="javascript1.2" src="whtopic.js"></script>
\r
44 <body><script type="text/javascript" language="javascript1.2">
\r
46 if (window.gbWhTopic)
\r
48 if (window.addTocInfo)
\r
50 addTocInfo("GEOM module\nTUI Scripts\nTransformation\nRepairing Operations");
\r
51 addButton("show",BTN_TEXT,"Show","","","","",0,0,"","","");
\r
54 if (window.writeBtnStyle)
\r
57 if (window.writeIntopicBar)
\r
60 if (window.setRelStartPage)
\r
62 setRelStartPage("geom.htm");
\r
71 document.location.reload();
\r
74 <h1>Repairing Operations</h1>
\r
76 <h3><a name=bookmark>Shape Processing</a></h3>
\r
78 <p class="whs1">import geompy</p>
\r
80 <p class="whs1">import salome</p>
\r
82 <p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
\r
86 <p># create vertices, edge, arc, wire, face and prism</p>
\r
88 <p class="whs1">p1 = geompy.MakeVertex(0,0,0)</p>
\r
90 <p class="whs1">p2 = geompy.MakeVertex(200,0,0)</p>
\r
92 <p class="whs1">p3 = geompy.MakeVertex(100,150,0)</p>
\r
94 <p class="whs1">edge = geompy.MakeEdge(p1,p2)</p>
\r
96 <p class="whs1">arc =
\r
97 geompy.MakeArc(p1,p3,p2)</p>
\r
99 <p class="whs1">wire = geompy.MakeWire([edge,arc])</p>
\r
101 <p class="whs1">face = geompy.MakeFace(wire,
\r
104 <p class="whs1">theShape = geompy.MakePrismVecH(face,
\r
109 <p># check shape at the beginning</p>
\r
111 <p class="whs1">print "Before
\r
112 ProcessShape:"</p>
\r
114 <p class="whs1">isValid = geompy.CheckShape(theShape)</p>
\r
116 <p class="whs1">if isValid == 0:</p>
\r
118 <p class="whs1"> print
\r
119 "The shape is not valid"</p>
\r
121 <p class="whs1">else:</p>
\r
123 <p class="whs1"> print
\r
124 "The shape seems to be valid"</p>
\r
126 <p class="whs1"> </p>
\r
128 <p># process Shape</p>
\r
130 <p class="whs1">Operators = ["FixShape"]</p>
\r
132 <p class="whs1">Parameters = ["FixShape.Tolerance3d"]</p>
\r
134 <p class="whs1">Values = ["1e-7"]</p>
\r
136 <p class="whs1">PS = geompy.ProcessShape(theShape,
\r
137 Operators, Parameters, Values)</p>
\r
141 <p># check shape at the end</p>
\r
143 <p class="whs1">print "After
\r
144 ProcessShape:"</p>
\r
146 <p class="whs1">isValid = geompy.CheckShape(PS)</p>
\r
148 <p class="whs1">if isValid == 0:</p>
\r
150 <p class="whs1"> print
\r
151 "The shape is not valid"</p>
\r
153 <p class="whs1"> raise
\r
154 RuntimeError, "It seems, that the ProcessShape() has failed"</p>
\r
156 <p class="whs1">else:</p>
\r
158 <p class="whs1"> print
\r
159 "The shape seems to be valid"</p>
\r
163 <p># add in study and display</p>
\r
165 <p class="whs1">Id_Shape = geompy.addToStudy(theShape,
\r
166 "Invalid Shape")</p>
\r
168 <p class="whs1">Id_PS =
\r
169 geompy.addToStudy(PS, "Processed Shape")</p>
\r
171 <p class="whs1">gg.createAndDisplayGO(Id_Shape)</p>
\r
173 <p class="whs1">gg.setDisplayMode(Id_Shape,1)</p>
\r
175 <p class="whs1">gg.createAndDisplayGO(Id_PS)</p>
\r
177 <p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(Id_PS,1)</span>
\r
182 <h3><a name=bookmark1>Suppress Faces</a></h3>
\r
184 <p class="whs1">import geompy</p>
\r
186 <p class="whs1">import salome</p>
\r
188 <p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
\r
192 <p># create box</p>
\r
194 <p class="whs1">box = geompy.MakeBoxDXDYDZ(200,
\r
199 <p># IDList for suppress faces</p>
\r
201 <p class="whs1">sup_faces = []</p>
\r
203 <p class="whs1">sup_faces = geompy.SubShapeAllSorted(box,
\r
204 geompy.ShapeType["FACE"])</p>
\r
208 <p># get sub-shape indexes</p>
\r
210 <p class="whs1">f1_id = geompy.GetSubShapeID(box,
\r
215 <p># remove faces from the given object (shape)</p>
\r
217 <p class="whs1">result = geompy.SuppressFaces(box,
\r
222 <p># add objects in study</p>
\r
224 <p class="whs1">id_box = geompy.addToStudy(box,
\r
225 "Box")</p>
\r
227 <p class="whs1">id_result = geompy.addToStudy(result,
\r
228 "Result")</p>
\r
232 <p># display results</p>
\r
234 <p class="whs1">gg.createAndDisplayGO(id_box)</p>
\r
236 <p class="whs1">gg.setDisplayMode(id_box,1)</p>
\r
238 <p class="whs1">gg.createAndDisplayGO(id_result)</p>
\r
240 <p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_result,1)</span>
\r
245 <h3><a name=bookmark2>Close Contour</a></h3>
\r
247 <p class="whs1">import geompy</p>
\r
249 <p class="whs1">import salome</p>
\r
251 <p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
\r
255 <p># create vertices and vectors</p>
\r
257 <p class="whs1">p0 =
\r
258 geompy.MakeVertex( 0.,
\r
260 0.)</p>
\r
262 <p class="whs1">px =
\r
263 geompy.MakeVertex(100., 0.,
\r
264 0.)</p>
\r
266 <p class="whs1">py =
\r
267 geompy.MakeVertex( 0.,
\r
268 100., 0.)</p>
\r
270 <p class="whs1">py1 = geompy.MakeVertex(
\r
272 0.)</p>
\r
274 <p class="whs1">pz =
\r
275 geompy.MakeVertex( 0.,
\r
279 <p class="whs1">vxy = geompy.MakeVector(px,
\r
282 <p> </p>
\r
284 <p># create arc</p>
\r
286 <p class="whs1">arc = geompy.MakeArc(py1,
\r
291 <p># create wire</p>
\r
293 <p class="whs1">wire = geompy.MakeWire([vxy,
\r
298 <p># close an open wire by creation of an edge between ends</p>
\r
300 <p class="whs1">wire_close = geompy.CloseContour(wire,
\r
305 <p># add objects in study</p>
\r
307 <p class="whs1">id_wire = geompy.addToStudy(wire,
\r
308 "Wire")</p>
\r
310 <p class="whs1">id_wire_close = geompy.addToStudy(wire_close,
\r
311 "Wire close")</p>
\r
315 <p># display results</p>
\r
317 <p class="whs1">gg.createAndDisplayGO(id_wire)</p>
\r
319 <p><span style="font-family: 'Lucida Console', monospace;">gg.createAndDisplayGO(id_wire_close)</span>
\r
324 <h3><a name=bookmark3>Suppress Internal Wires</a></h3>
\r
326 <p class="whs1">import geompy</p>
\r
328 <p class="whs1">import salome</p>
\r
330 <p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
\r
334 <p># create vertex and vector</p>
\r
336 <p class="whs1">p1 = geompy.MakeVertex(55,
\r
339 <p class="whs1">p2 = geompy.MakeVertex(55,
\r
342 <p class="whs1">v = geompy.MakeVector(p1,
\r
347 <p># create cylinder</p>
\r
349 <p class="whs1">height = 100</p>
\r
351 <p class="whs1">radius1 = 40</p>
\r
353 <p class="whs1">cylinder = geompy.MakeCylinder(p1,
\r
354 v, radius1, height)</p>
\r
358 <p># create box</p>
\r
360 <p class="whs1">box = geompy.MakeBoxDXDYDZ(100,
\r
367 <p class="whs1">cut = geompy.MakeCut(box,
\r
372 <p># suppress all internal wires</p>
\r
374 <p class="whs1">result = geompy.SuppressInternalWires(cut,
\r
379 <p># add objects in study</p>
\r
381 <p class="whs1">id_cut = geompy.addToStudy(cut,
\r
382 "Cut")</p>
\r
384 <p class="whs1">id_result = geompy.addToStudy(result,
\r
385 "Result")</p>
\r
389 <p># display results</p>
\r
391 <p class="whs1">gg.createAndDisplayGO(id_cut)</p>
\r
393 <p class="whs1">gg.setDisplayMode(id_cut,1)</p>
\r
395 <p class="whs1">gg.createAndDisplayGO(id_result)</p>
\r
397 <p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_result,1)</span>
\r
402 <h3><a name=bookmark4>Suppress Holes</a></h3>
\r
404 <p class="whs1">import geompy</p>
\r
406 <p class="whs1">import salome</p>
\r
408 <p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
\r
412 <p># create vertex and vector</p>
\r
414 <p class="whs1">p1 = geompy.MakeVertex(35,
\r
417 <p class="whs1">p2 = geompy.MakeVertex(35,
\r
420 <p class="whs1">v = geompy.MakeVector(p1,
\r
425 <p># create cylinder</p>
\r
427 <p class="whs1">height = 20</p>
\r
429 <p class="whs1">radius1 = 20</p>
\r
431 <p class="whs1">cylinder = geompy.MakeCylinder(p1,
\r
432 v, radius1, height)</p>
\r
436 <p># create cone</p>
\r
438 <p class="whs1">cone = geompy.MakeCone(p1,
\r
445 <p class="whs1">cut = geompy.MakeCut(cone,
\r
450 <p># get faces as sub-shapes</p>
\r
452 <p class="whs1">faces = []</p>
\r
454 <p class="whs1">faces = geompy.SubShapeAllSorted(cut,
\r
455 geompy.ShapeType["FACE"])</p>
\r
457 <p class="whs1">f_2 = geompy.GetSubShapeID(cut,
\r
462 <p># remove one face from the shape</p>
\r
464 <p class="whs1">cut_without_f_2 =
\r
465 geompy.SuppressFaces(cut, [f_2])</p>
\r
469 <p># get wires as sub-shapes</p>
\r
471 <p class="whs1">wires = []</p>
\r
473 <p class="whs1">wires = geompy.SubShapeAllSorted(cut_without_f_2,
\r
474 geompy.ShapeType["WIRE"])</p>
\r
476 <p class="whs1">w_0 = geompy.GetSubShapeID(cut_without_f_2,
\r
481 <p># suppress the selected wire</p>
\r
483 <p class="whs1">result = geompy.SuppressHoles(cut_without_f_2,
\r
488 <p># add objects in study</p>
\r
490 <p class="whs1">id_cut = geompy.addToStudy(cut,
\r
491 "Cut")</p>
\r
493 <p class="whs1">id_cut_without_f_2
\r
494 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")</p>
\r
496 <p class="whs1">id_result = geompy.addToStudy(result,
\r
497 "Result")</p>
\r
501 <p># display results</p>
\r
503 <p class="whs1">gg.createAndDisplayGO(id_cut)</p>
\r
505 <p class="whs1">gg.setDisplayMode(id_cut,1)</p>
\r
507 <p class="whs1">gg.createAndDisplayGO(id_cut_without_f_2)</p>
\r
509 <p class="whs1">gg.setDisplayMode(id_cut_without_f_2,1)</p>
\r
511 <p class="whs1">gg.createAndDisplayGO(id_result)</p>
\r
513 <p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_result,1)</span>
\r
518 <h3><a name=bookmark5>Sewing</a></h3>
\r
520 <p class="whs1">import geompy</p>
\r
522 <p class="whs1">import salome</p>
\r
524 <p class="whs1">import math</p>
\r
526 <p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
\r
530 <p># create base points</p>
\r
532 <p class="whs1">px = geompy.MakeVertex(100.,
\r
535 <p class="whs1">py = geompy.MakeVertex(0.,
\r
538 <p class="whs1">pz = geompy.MakeVertex(0.,
\r
543 <p># create base geometry 2D & 3D</p>
\r
545 <p class="whs1">vector = geompy.MakeVector(px,
\r
548 <p class="whs1">arc = geompy.MakeArc(py,
\r
553 <p># create base objects</p>
\r
555 <p class="whs1">angle = 45. * math.pi
\r
558 <p class="whs1">WantPlanarFace = 1
\r
561 <p class="whs1">wire = geompy.MakeWire([vector,
\r
564 <p class="whs1">face = geompy.MakeFace(wire,
\r
565 WantPlanarFace)</p>
\r
567 <p class="whs1">face_rot = geompy.MakeRotation(face,
\r
572 <p># make sewing</p>
\r
574 <p class="whs1">precision = 0.00001</p>
\r
576 <p class="whs1">sewing = geompy.MakeSewing([face,
\r
577 face_rot], precision)</p>
\r
581 <p># add objects in study</p>
\r
583 <p class="whs1">id_face = geompy.addToStudy(face,
\r
584 "Face")</p>
\r
586 <p class="whs1">id_face_rot = geompy.addToStudy(face_rot,
\r
587 "Face rotation")</p>
\r
589 <p class="whs1">id_sewing = geompy.addToStudy(sewing,
\r
590 "Sewing")</p>
\r
594 <p># display results</p>
\r
596 <p class="whs1">gg.createAndDisplayGO(id_face)</p>
\r
598 <p class="whs1">gg.setDisplayMode(id_face,1)</p>
\r
600 <p class="whs1">gg.createAndDisplayGO(id_face_rot)</p>
\r
602 <p class="whs1">gg.setDisplayMode(id_face_rot,1)</p>
\r
604 <p class="whs1">gg.createAndDisplayGO(id_sewing)</p>
\r
606 <p class="whs1">gg.setDisplayMode(id_sewing,1)
\r
609 <p class="whs1"> </p>
\r
611 <h3><a name=bookmark6>Glue Faces</a></h3>
\r
613 <p class="whs1">import geompy</p>
\r
615 <p class="whs1">import salome</p>
\r
617 <p class="whs1">import math</p>
\r
619 <p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
\r
621 <p class="whs1"> </p>
\r
623 <p class="whs2"># create base points</p>
\r
625 <p class="whs1">px = geompy.MakeVertex(100.,
\r
628 <p class="whs1">py = geompy.MakeVertex(0.,
\r
631 <p class="whs1">pz = geompy.MakeVertex(0.,
\r
634 <p class="whs1"> </p>
\r
636 <p class="whs2"># create base geometry
\r
639 <p class="whs1">vector = geompy.MakeVector(px,
\r
642 <p class="whs1">arc = geompy.MakeArc(py,
\r
645 <p class="whs1"> </p>
\r
647 <p class="whs2"># create base objects</p>
\r
649 <p class="whs1">angle = 45. * math.pi
\r
652 <p class="whs1">WantPlanarFace = 1
\r
655 <p class="whs1">wire = geompy.MakeWire([vector,
\r
658 <p class="whs1">face = geompy.MakeFace(wire,
\r
659 WantPlanarFace)</p>
\r
661 <p class="whs1">face_rot = geompy.MakeRotation(face,
\r
664 <p class="whs1"> </p>
\r
666 <p class="whs2"># make sewing</p>
\r
668 <p class="whs1">precision = 0.00001</p>
\r
670 <p class="whs1">sewing = geompy.MakeSewing([face,
\r
671 face_rot], precision)</p>
\r
673 <p class="whs1"> </p>
\r
675 <p class="whs2"># add objects in study</p>
\r
677 <p class="whs1">id_face = geompy.addToStudy(face,
\r
678 "Face")</p>
\r
680 <p class="whs1">id_face_rot = geompy.addToStudy(face_rot,
\r
681 "Face rotation")</p>
\r
683 <p class="whs1">id_sewing = geompy.addToStudy(sewing,
\r
684 "Sewing")</p>
\r
686 <p class="whs1"> </p>
\r
688 <p class="whs2"># display results</p>
\r
690 <p class="whs1">gg.createAndDisplayGO(id_face)</p>
\r
692 <p class="whs1">gg.setDisplayMode(id_face,1)</p>
\r
694 <p class="whs1">gg.createAndDisplayGO(id_face_rot)</p>
\r
696 <p class="whs1">gg.setDisplayMode(id_face_rot,1)</p>
\r
698 <p class="whs1">gg.createAndDisplayGO(id_sewing)</p>
\r
700 <p class="whs1">gg.setDisplayMode(id_sewing,1)
\r
703 <p class="whs1"> </p>
\r
705 <h3><a name=bookmark7>Add Point on Edge</a></h3>
\r
707 <p class="whs1"><span style="font-family: 'Lucida Console', monospace;">import
\r
710 <p class="whs1">import salome</p>
\r
712 <p class="whs1"> </p>
\r
714 <p class="whs2"># create vertices</p>
\r
716 <p class="whs1">p1 = geompy.MakeVertex(0,0,50)</p>
\r
718 <p class="whs1">p2 = geompy.MakeVertex(60,0,50)</p>
\r
720 <p class="whs1"> </p>
\r
722 <p class="whs2"># make edge</p>
\r
724 <p class="whs1">edge = geompy.MakeEdge(p1,
\r
725 p2) #geompy.GetSubShape(box, edge_ind)</p>
\r
727 <p class="whs1"> </p>
\r
729 <p class="whs2"># divide edge</p>
\r
731 <p class="whs1">divide = geompy.DivideEdge(edge,
\r
734 <p class="whs1"> </p>
\r
736 <p class="whs2"># add objects in study</p>
\r
738 <p class="whs1">id_edge = geompy.addToStudy(edge,
\r
739 "Edge")</p>
\r
741 <p class="whs1">edge_points = geompy.SubShapeAllSorted(edge,
\r
742 geompy.ShapeType["VERTEX"])</p>
\r
744 <p class="whs1">for point in edge_points:</p>
\r
746 <p class="whs1"> geompy.addToStudyInFather(edge,
\r
747 point, "Edge's point")</p>
\r
749 <p class="whs1"> </p>
\r
751 <p class="whs1">id_divide = geompy.addToStudy(divide,
\r
752 "Divided edge")</p>
\r
754 <p class="whs1">edge_points = geompy.SubShapeAllSorted(divide,
\r
755 geompy.ShapeType["VERTEX"])</p>
\r
757 <p class="whs1">for point in edge_points:</p>
\r
759 <p class="whs1"> geompy.addToStudyInFather(divide,
\r
760 point, "Edge's point after divide")</p>
\r
762 <p class="whs1"> </p>
\r
764 <p class="whs1">salome.sg.updateObjBrowser(1)
\r
767 <p class="whs2"> </p>
\r
769 <h3><a name=bookmark8>Check Free Boundaries</a></h3>
\r
771 <p class="whs1">import geompy</p>
\r
773 <p class="whs1">import salome</p>
\r
775 <p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
\r
777 <p class="whs2"> </p>
\r
779 <p class="whs2"># create boxes</p>
\r
781 <p class="whs1">box1 = geompy.MakeBox(0,0,0,100,50,100)</p>
\r
783 <p class="whs1">box2 = geompy.MakeBox(100,0,0,250,50,100)</p>
\r
785 <p class="whs2"> </p>
\r
787 <p class="whs2"># make compound</p>
\r
789 <p class="whs1">compound = geompy.MakeCompound([box1,
\r
792 <p class="whs2"> </p>
\r
794 <p class="whs2"># import from *.brep</p>
\r
796 <p class="whs1">ImportBREP = geompy.ImportBREP("/tmp/flight_solid.brep")</p>
\r
798 <p class="whs2"> </p>
\r
800 <p class="whs2"># get face</p>
\r
802 <p class="whs1">faces = geompy.SubShapeAllSorted(ImportBREP,
\r
803 geompy.ShapeType["FACE"])</p>
\r
805 <p class="whs2"> </p>
\r
807 <p class="whs2"># get free boundary for
\r
810 <p class="whs1">Res = geompy.GetFreeBoundary(faces[32])</p>
\r
812 <p class="whs1">isSuccess =
\r
815 <p class="whs1">ClosedWires = Res[1]</p>
\r
817 <p class="whs1">OpenWires =
\r
820 <p class="whs2"> </p>
\r
822 <p class="whs2">i<span style="font-family: 'Lucida Console', monospace;">f
\r
823 isSuccess == 1 :</span></p>
\r
825 <p class="whs1"> print
\r
826 "Checking free boudaries is OK."</p>
\r
828 <p class="whs1">else :</p>
\r
830 <p class="whs1"> print
\r
831 "Checking free boudaries is KO!"</p>
\r
833 <p class="whs1">print "len(ClosedWires)
\r
834 = ", len(ClosedWires)</p>
\r
836 <p class="whs1">i = 0</p>
\r
838 <p class="whs1">for wire in ClosedWires
\r
841 <p class="whs1"> wire_name
\r
842 = "Face 32 -> Close wires : WIRE %d"%(i+1)</p>
\r
844 <p class="whs1"> geompy.addToStudy(ClosedWires[i],
\r
847 <p class="whs1"> if
\r
848 i < len(ClosedWires) :</p>
\r
850 <p class="whs1"> i
\r
853 <p class="whs1">print "len(OpenWires)
\r
854 = ", len(OpenWires)</p>
\r
856 <p class="whs1">i = 0</p>
\r
858 <p class="whs1">for wire in OpenWires
\r
861 <p class="whs1"> wire_name
\r
862 = "Face 32 -> Open wires : WIRE %d"%(i+1)</p>
\r
864 <p class="whs1"> geompy.addToStudy(OpenWires[i],
\r
867 <p class="whs1"> if
\r
868 i < len(OpenWires) :</p>
\r
870 <p class="whs1"> i
\r
873 <p class="whs2"> </p>
\r
875 <p class="whs2"># get free boundary for
\r
878 <p class="whs1">Res = geompy.GetFreeBoundary(faces[41])</p>
\r
880 <p class="whs1">isSuccess =
\r
883 <p class="whs1">ClosedWires = Res[1]</p>
\r
885 <p class="whs1">OpenWires =
\r
888 <p class="whs1"> </p>
\r
890 <p class="whs1">if isSuccess == 1
\r
893 <p class="whs1"> print
\r
894 "Checking free boudaries is OK."</p>
\r
896 <p class="whs1">else :</p>
\r
898 <p class="whs1"> print
\r
899 "Checking free boudaries is KO!"</p>
\r
901 <p class="whs1">print "len(ClosedWires)
\r
902 = ", len(ClosedWires)</p>
\r
904 <p class="whs1">i = 0</p>
\r
906 <p class="whs1">for wire in ClosedWires
\r
909 <p class="whs1"> wire_name
\r
910 = "Face 41 -> Close wires : WIRE %d"%(i+1)</p>
\r
912 <p class="whs1"> geompy.addToStudy(ClosedWires[i],
\r
915 <p class="whs1"> if
\r
916 i < len(ClosedWires) :</p>
\r
918 <p class="whs1"> i
\r
921 <p class="whs1">print "len(OpenWires)
\r
922 = ", len(OpenWires)</p>
\r
924 <p class="whs1">i = 0</p>
\r
926 <p class="whs1">for wire in OpenWires
\r
929 <p class="whs1"> wire_name
\r
930 = "Face 41 -> Open wires : WIRE %d"%(i+1)</p>
\r
932 <p class="whs1"> geompy.addToStudy(OpenWires[i],
\r
935 <p class="whs1"> if
\r
936 i < len(OpenWires) :</p>
\r
938 <p class="whs1"> i
\r
941 <p class="whs2"> </p>
\r
943 <p class="whs2"># add imported object
\r
946 <p class="whs1">id_ImportBREP = geompy.addToStudy(ImportBREP,
\r
947 "ImportBREP")</p>
\r
949 <p class="whs2"><span style="font-family: 'Lucida Console', monospace;">salome.sg.updateObjBrowser(1)</span>
\r
952 <p class="whs2"> </p>
\r
954 <h3><a name=bookmark9>Check Free Faces</a></h3>
\r
956 <p class="whs1">import geompy</p>
\r
958 <p class="whs1">import salome</p>
\r
960 <p class="whs1">gg = salome.ImportComponentGUI("GEOM")</p>
\r
964 <p># create vertex and vector</p>
\r
966 <p class="whs1">p1 = geompy.MakeVertex(35,
\r
969 <p class="whs1">p2 = geompy.MakeVertex(35,
\r
972 <p class="whs1">v = geompy.MakeVector(p1,
\r
977 <p># create cylinder</p>
\r
979 <p class="whs1">cylinder = geompy.MakeCone(p1,
\r
984 <p># create cone</p>
\r
986 <p class="whs1">cone = geompy.MakeCone(p1,
\r
993 <p class="whs1">cut = geompy.MakeCut(cone,
\r
998 <p># get faces as sub-shapes</p>
\r
1000 <p class="whs1">faces = []</p>
\r
1002 <p class="whs1">faces = geompy.SubShapeAllSorted(cut,
\r
1003 geompy.ShapeType["FACE"])</p>
\r
1005 <p class="whs1">f_2 = geompy.GetSubShapeID(cut,
\r
1010 <p># remove one face from the shape</p>
\r
1012 <p class="whs1">cut_without_f_2 =
\r
1013 geompy.SuppressFaces(cut, [f_2])</p>
\r
1017 <p># suppress specified wire</p>
\r
1019 <p class="whs1">result = geompy.GetFreeFacesIDs(cut_without_f_2)</p>
\r
1021 <p class="whs1">print "A number
\r
1022 of free faces is ", len(result)</p>
\r
1026 <p># add objects in study</p>
\r
1028 <p class="whs1">all_faces = geompy.SubShapeAllSorted(cut_without_f_2,
\r
1029 geompy.ShapeType["FACE"])</p>
\r
1031 <p class="whs1">for face in all_faces
\r
1034 <p class="whs1"> sub_shape_id
\r
1035 = geompy.GetSubShapeID(cut_without_f_2, face)</p>
\r
1037 <p class="whs1"> if
\r
1038 result.count(sub_shape_id) > 0 :</p>
\r
1040 <p class="whs1"> face_name
\r
1041 = "Free face %d"%(sub_shape_id)</p>
\r
1043 <p class="whs1"> geompy.addToStudy(face,
\r
1048 <p># in this example all faces from cut_without_f_2 are free</p>
\r
1050 <p class="whs1">id_cut_without_f_2
\r
1051 = geompy.addToStudy(cut_without_f_2, "Cut without f_2")</p>
\r
1055 <p># display results</p>
\r
1057 <p class="whs1">gg.createAndDisplayGO(id_cut_without_f_2)</p>
\r
1059 <p><span style="font-family: 'Lucida Console', monospace;">gg.setDisplayMode(id_cut_without_f_2,1)</span>
\r
1062 <script type="text/javascript" language="javascript1.2">
\r
1064 if (window.writeIntopicBar)
\r
1065 writeIntopicBar(0);
\r