Ciao a tutti, qualcuno ha elaborato uno script per rilevare le coordinate esatte in cui due rette si intersecano?
un'altra richiesta: esiste un comando python per valutare se un punto appartiene ad una retta?
grazie mille!
intersezione fra rette
Forum rules
regole del forum e le informazioni utili
Importante: PRIMA di chiedere aiuto leggete qui!
regole del forum e le informazioni utili
Importante: PRIMA di chiedere aiuto leggete qui!
-
- Veteran
- Posts: 2611
- Joined: Tue Feb 21, 2012 8:07 pm
- Location: Torino - Italy
Re: intersezione fra rette
Ciao.
La soluzione per lo script sembra essere in questi due post:
https://forum.freecadweb.org/viewtopic.php?t=26650
https://forum.freecadweb.org/viewtopic.php?t=19698
io però n Windows ottengo sempre un errore 'DraftGeomUtils' is not defined anche con FreeCAD 0.19
non ho ancora provato in Ubuntu.
Puoi vedere altri post in inglese cercando con Script intersection
La soluzione per lo script sembra essere in questi due post:
https://forum.freecadweb.org/viewtopic.php?t=26650
https://forum.freecadweb.org/viewtopic.php?t=19698
io però n Windows ottengo sempre un errore 'DraftGeomUtils' is not defined anche con FreeCAD 0.19
non ho ancora provato in Ubuntu.
Puoi vedere altri post in inglese cercando con Script intersection
Re: intersezione fra rette
saluti
prova cosi:
seleziona le due linee
intersection between two lines
mario
prova cosi:
seleziona le due linee
Code: Select all
import DraftGeomUtils
sel=Gui.Selection.getSelection()
print(DraftGeomUtils.findIntersection(sel[0].Shape.Edges[0],sel[1].Shape.Edges[0]))
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
-
- Veteran
- Posts: 2611
- Joined: Tue Feb 21, 2012 8:07 pm
- Location: Torino - Italy
Re: intersezione fra rette
Grazie Mario, funziona:
OS: Windows 8.1
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16117 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: dbb4cc6415bac848a294f03b80f65e888d531742
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)
Code: Select all
pl = FreeCAD.Placement()
>>> pl.Rotation.Q = (0.0,0.0,0.0,1.0)
>>> pl.Base = FreeCAD.Vector(0.0,0.0,0.0)
>>> points = [FreeCAD.Vector(0.0,0.0,0.0),FreeCAD.Vector(0.0,-40.0,0.0)]
>>> line = Draft.makeWire(points,placement=pl,closed=False,face=True,support=None)
>>> Draft.autogroup(line)
>>> pl = FreeCAD.Placement()
>>> pl.Rotation.Q = (0.0,0.0,0.0,1.0)
>>> pl.Base = FreeCAD.Vector(-20.0,-20.0,0.0)
>>> points = [FreeCAD.Vector(-20.0,-20.0,0.0),FreeCAD.Vector(20.0,-20.0,0.0)]
>>> line = Draft.makeWire(points,placement=pl,closed=False,face=True,support=None)
>>> Draft.autogroup(line)
>>> import DraftGeomUtils
>>> sel=Gui.Selection.getSelection()
>>> print(DraftGeomUtils.findIntersection(sel[0].Shape.Edges[0],sel[1].Shape.Edges[0]))
[Vector (0.0, -20.0, 0.0)]
>>>
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.16117 (Git)
Build type: Release
Branch: releases/FreeCAD-0-18
Hash: dbb4cc6415bac848a294f03b80f65e888d531742
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)