97 lines
4.3 KiB
HTML
97 lines
4.3 KiB
HTML
<html><head><title>Macro Extract Wires from Mesh/fr</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link type='text/css' href='wiki.css' rel='stylesheet'></head><body><h1>Macro Extract Wires from Mesh/fr</h1></div>
|
|
|
|
<div id="mw-content-text" lang="fr" dir="ltr" class="mw-content-ltr"><hr/><div class="mw-parser-output"><table class="fcinfobox wikitable ct" width="100%" style="float: right; width: 230px; margin-left: 10px;">
|
|
<tr>
|
|
<td class="ctTitle">
|
|
<h3><span class="mw-headline" id="Macro_Extract_Wires_from_Mesh"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Text-x-python.png" class="image"><img alt="Text-x-python.png" src="32px-Text-x-python.png" width="32" height="32" srcset="/wiki/images/2/2c/Text-x-python.png 1.5x" /></a> Macro Extract Wires from Mesh</span></h3>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Description
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven left">Extrait les fils constituants les bords des mailles sélectionnées
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Auteur
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Yorik" title="User:Yorik">Yorik</a>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Liens
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=Macros_recipes/fr" title="Macros recipes/fr">Recettes macros</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=How_to_install_macros/fr" title="How to install macros/fr">Comment installer une macro</a><br /><a href="https://www.freecadweb.org/wiki/index.php?title=Customize_Toolbars/fr" title="Customize Toolbars/fr">Comment ajouter une barre d'outils</a>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Version
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-version">1
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Date dernière modification
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-date">2016-12-17
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctToc"><br /><div id="toc" class="toc"><div class="toctitle"><h2>Contents</h2></div>
|
|
<ul>
|
|
<li class="toclevel-1"><a href="#Macro_Extract_Wires_from_Mesh"><span class="tocnumber">1</span> <span class="toctext">Macro Extract Wires from Mesh</span></a></li>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Description"><span class="tocnumber">2</span> <span class="toctext">Description</span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#Script"><span class="tocnumber">3</span> <span class="toctext">Script</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
</td></tr>
|
|
</table>
|
|
<p><br />
|
|
</p>
|
|
<h2><span class="mw-headline" id="Description">Description</span></h2>
|
|
<p>Cherche les bords dans les objets de maillage sélectionnés. Les bords recherchés sont les bords formés à partir de tous les bords trouvés et partagés par une seule face, c'est-à-dire, les bords "frontière". Les fils trouvés sont ajoutés au document (un composant par objet maillé), tandis que le maillage est masqué.
|
|
</p>
|
|
<h2><span class="mw-headline" id="Script">Script</span></h2>
|
|
<pre>#!/usr/bin/python
|
|
|
|
# This macro will extract wires from selected meshes
|
|
# The result is a new Part Compound containing wires, one per original mesh object
|
|
# The selected meshes will be hidden but still selected after the operation.
|
|
# Warning, it takes a bit of time...
|
|
|
|
import FreeCAD,FreeCADGui,Part,Draft,DraftGeomUtils,Mesh
|
|
for obj in FreeCADGui.Selection.getSelection():
|
|
if obj.isDerivedFrom("Mesh::Feature"):
|
|
shape = Part.Shape()
|
|
shape.makeShapeFromMesh(obj.Mesh.Topology,0.1)
|
|
edges = []
|
|
lut = {}
|
|
for f in shape.Faces:
|
|
for e in f.Edges:
|
|
lut.setdefault(e.hashCode(),[]).append(e)
|
|
for k,v in lut.items():
|
|
if len(v) == 1:
|
|
edges.extend(v)
|
|
if edges:
|
|
wires = DraftGeomUtils.findWires(edges)
|
|
if wires:
|
|
Part.show(Part.makeCompound(wires))
|
|
obj.ViewObject.hide() </pre>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div><div class="printfooter">
|
|
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Macro_Extract_Wires_from_Mesh/fr&oldid=240070">http://www.freecadweb.org/wiki/index.php?title=Macro_Extract_Wires_from_Mesh/fr&oldid=240070</a>"</div>
|
|
<div id="catlinks" class="catlinks" data-mw="interface"></div><div class="visualClear"></div>
|
|
</div>
|
|
</div>
|
|
<div id="mw-navigation">
|
|
<h2>Navigation menu</h2>
|
|
|
|
</body></html> |