Macro FlattenWire3Points/it: Difference between revisions
(Updating to match new version of source page) |
(Updating to match new version of source page) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
<languages/> |
||
<div class="mw-translate-fuzzy"> |
|||
{{Macro/it |
{{Macro/it |
||
|Name=FlattenWire3Points |
|Name=FlattenWire3Points |
||
|Icon=Macro_FlattenWire3Points.png |
|||
|Translate=Wire appiattita su piano da 3 punti |
|Translate=Wire appiattita su piano da 3 punti |
||
|Description=Appiattisce contorni non planari su un piano definito da 3 punti |
|Description=Appiattisce contorni non planari su un piano definito da 3 punti |
||
Line 8: | Line 8: | ||
|Version=1.0 |
|Version=1.0 |
||
|Date=2016-02-06 |
|Date=2016-02-06 |
||
|FCVersion=All |
|||
|Download=[https://www.freecadweb.org/wiki/images/1/1e/Macro_FlattenWire3Points.png ToolBar Icon] |
|||
}} |
}} |
||
</div> |
|||
==Descrizione== |
==Descrizione== |
||
Line 22: | Line 23: | ||
'''Macro_FlattenWire3Points.FCMacro''' |
'''Macro_FlattenWire3Points.FCMacro''' |
||
{{ |
{{MacroCode|code= |
||
import FreeCAD,FreeCADGui,Draft |
import FreeCAD,FreeCADGui,Draft |
Revision as of 10:47, 23 May 2020
Descrizione |
---|
Appiattisce contorni non planari su un piano definito da 3 punti Versione macro: 1.0 Ultima modifica: 2016-02-06 Versione FreeCAD: All Download: ToolBar Icon Autore: Yorik |
Autore |
Yorik |
Download |
ToolBar Icon |
Link |
Raccolta di macro Come installare le macro Personalizzare la toolbar |
Versione macro |
1.0 |
Data ultima modifica |
2016-02-06 |
Versioni di FreeCAD |
All |
Scorciatoia |
Nessuna |
Vedere anche |
Nessuno |
Descrizione
Questa macro appiattisce i contorni non planari su un piano definito da 3 punti. Per utilizzare questa macro, selezionare primi 3 vertici da una unica polilinea di Draft.
Script
Macro_FlattenWire3Points.FCMacro
import FreeCAD,FreeCADGui,Draft # check selection sel = FreeCADGui.Selection.getSelectionEx() ok = True if len(sel) != 1: FreeCAD.Console.PrintError("Please select 3 vertices from one Draft wire\n") ok = False sel = sel[0] if Draft.getType(sel.Object) not in ["Wire","BSpline"]: FreeCAD.Console.PrintError("Please select 3 vertices from one Draft wire\n") ok = False if len(sel.SubElementNames) != 3: FreeCAD.Console.PrintError("Please select 3 vertices from one Draft wire\n") ok = False for e in sel.SubElementNames: if not "Vertex" in e: FreeCAD.Console.PrintError("Please select 3 vertices from one Draft wire\n") ok = False if ok: # define a plane p1 = getattr(sel.Object.Shape,sel.SubElementNames[0]).Point p2 = getattr(sel.Object.Shape,sel.SubElementNames[1]).Point p3 = getattr(sel.Object.Shape,sel.SubElementNames[2]).Point p4 = p2.sub(p1).cross(p3.sub(p1)) # project wire points points = [] for p in sel.Object.Points: points.append(p.projectToPlane(p1,p4)) sel.Object.Points = points