440 lines
25 KiB
HTML
440 lines
25 KiB
HTML
<html><head><title>Macro FCInfoToMouse/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 FCInfoToMouse/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_FCInfoToMouse"><a href="https://www.freecadweb.org/wiki/index.php?title=File:FCInfoToMouse.png" class="image"><img alt="FCInfoToMouse.png" src="32px-FCInfoToMouse.png" width="32" height="32" srcset="/wiki/images/thumb/1/10/FCInfoToMouse.png/48px-FCInfoToMouse.png 1.5x, FCInfoToMouse.png 2x" /></a> Macro FCInfoToMouse</span></h3>
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Description
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven left">Donne les informations des coordonnées , longueur et angles en temps réel sur la souris
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Auteur
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven"><a href="https://www.freecadweb.org/wiki/index.php?title=User:Mario52" title="User:Mario52">Mario52</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">00.04
|
|
</td></tr>
|
|
<tr>
|
|
<th class="ctOdd">Date dernière modification
|
|
</th></tr>
|
|
<tr>
|
|
<td class="ctEven macro-date">2018-03-27
|
|
</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_FCInfoToMouse"><span class="tocnumber">1</span> <span class="toctext">Macro FCInfoToMouse</span></a></li>
|
|
<li class="toclevel-1 tocsection-1"><a href="#Utilisation"><span class="tocnumber">2</span> <span class="toctext">Utilisation</span></a></li>
|
|
<li class="toclevel-1 tocsection-2"><a href="#Script"><span class="tocnumber">3</span> <span class="toctext">Script</span></a></li>
|
|
<li class="toclevel-1 tocsection-3"><a href="#Limitation"><span class="tocnumber">4</span> <span class="toctext">Limitation</span></a></li>
|
|
<li class="toclevel-1 tocsection-4"><a href="#Liens"><span class="tocnumber">5</span> <span class="toctext">Liens</span></a></li>
|
|
<li class="toclevel-1 tocsection-5"><a href="#Versions"><span class="tocnumber">6</span> <span class="toctext">Versions</span></a></li>
|
|
</ul>
|
|
</div>
|
|
|
|
</td></tr>
|
|
</table>
|
|
<p><br />
|
|
Donne les informations des coordonnées , longueur et angles en temps réel sur la souris dans une bulle annotation affiché dans l'écran 3D.
|
|
</p><p><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_FCInfoToMouse_00.png" class="image" title="FCInfoToMouse"><img alt="FCInfoToMouse" src="480px-Macro_FCInfoToMouse_00.png" width="480" height="360" srcset="/wiki/images/5/58/Macro_FCInfoToMouse_00.png 1.5x" /></a>
|
|
</p>
|
|
<div style="clear:both"></div>
|
|
<h3><span class="mw-headline" id="Utilisation">Utilisation</span></h3>
|
|
<p>Après avoir installé la macro dans votre répertoire de macros, exécutez la macro une annotation est créée et les informations de coordonnées de la souris sont affichées en temps réel
|
|
</p>
|
|
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_FCInfoToMouse_01.png" class="image" title="FCInfoToMouse"><img alt="FCInfoToMouse" src="Macro_FCInfoToMouse_01.png" width="240" height="42" /></a></div>
|
|
<ul><li> <b>X, Y, Z</b> : Les coordonnées XYZ affichées dans la bulle annotation (Le mode "Single" utilise uniquement cet affichage)</li></ul>
|
|
<div style="clear:both"></div>
|
|
<p>Après le premier clic, d'autre informations sont affichées (Le mode "Force" utilise uniquement cet affichage)
|
|
</p>
|
|
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_FCInfoToMouse_02.png" class="image" title="FCInfoToMouse"><img alt="FCInfoToMouse" src="Macro_FCInfoToMouse_02.png" width="240" height="82" /></a></div>
|
|
<ul><li> <b>X1, Y1, Z1</b> : premières coordonnées du clic de la souris</li>
|
|
<li> <b>X2, Y2, Z2</b> : deuxième coordonnée suivant le déplacement actuel de la souris</li>
|
|
<li> <b>L</b> : longueur entre le premier clic de souris et le déplacement actuel de la souris</li>
|
|
<li> <b>XY, YZ, XZ</b> :angles en degrés entre le premier point et le déplacement de la souris dans les plans <b>XY, YZ, XZ</b></li></ul>
|
|
<div style="clear:both"></div>
|
|
<p>si la souris survole un objet, le nom de l'objet est affiché en haut de l'annotation
|
|
</p>
|
|
<div class="floatleft"><a href="https://www.freecadweb.org/wiki/index.php?title=File:Macro_FCInfoToMouse_03.png" class="image" title="FCInfoToMouse"><img alt="FCInfoToMouse" src="240px-Macro_FCInfoToMouse_03.png" width="240" height="148" srcset="/wiki/images/9/98/Macro_FCInfoToMouse_03.png 1.5x" /></a></div>
|
|
<div style="clear:both"></div>
|
|
<p>Touches utilisées :
|
|
</p><p><b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">SHIFT</span> + <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">Q</span></b> : pour quitter FCInfoToMouse, si vous quittez la macro l'annotation reste à l'emplacement actuel de la souris pour maintenir l'annotation sur et à l'emplacement voulu sur l'objet. Si vous désirez effacer l'annotation il faudra le faire manuellement.
|
|
</p><p><b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">SHIFT</span> + <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">M</span></b> : pour forcer l'<b>affichage complet</b> , mode <b>single</b>, mode <b>normal</b>.
|
|
</p>
|
|
<ul><li> Le mode <b>single</b> affiche uniquement les coordonnées de la souris. </li></ul>
|
|
<p><b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">SHIFT</span> + <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">C</span></b> : pour <b>cacher / rendre visible</b> l'annotation.
|
|
</p><p><b><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">SHIFT</span> + <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">D</span></b> : for "<b>open / close</b>" a spreadSheet in document the coordinate saved to:
|
|
</p><p><span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">cell <b>A</b></span> : x, y, z <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">cell <b>B</b></span> : x <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">cell <b>C</b></span> : y <span style="background: #DDDDDD; border: 1px solid #888888; padding: 0px 5px 1px 5px;">cell <b>D</b></span> : z
|
|
</p><p><br />
|
|
A tout moment ,vous pouvez changer les propriétés d'affichage de l'annotation en cliquant sur l'objet FCInfoToMouse puis dans la Vue combinée cliquez sur l'onglet Vue pour accéder à toutes les options offertes.
|
|
</p><p>Si vous voulez changer le nombre de décimales à afficher, modifiez la valeur de la ligne 42 (défaut 4)
|
|
</p><p>Exemple pour obtenir 6 décimales:
|
|
</p><p>valeur originale
|
|
</p>
|
|
<pre>global arrondi  ; arrondi = 4 </pre>
|
|
<p>à remplacer par
|
|
</p>
|
|
<pre>global arrondi  ; arrondi = 6 </pre>
|
|
<p>Pour rendre la configuration de l'annotation permanente vous pouvez modifier les valeurs dans la section configuration lignes <b>104 to 122</b>
|
|
</p>
|
|
<h3><span class="mw-headline" id="Script">Script</span></h3>
|
|
<p>L'icône <b>FCInfoToMouse.png</b> <a href="https://www.freecadweb.org/wiki/index.php?title=File:FCInfoToMouse.png" class="image" title="FCInfoToMouse"><img alt="FCInfoToMouse" src="FCInfoToMouse.png" width="64" height="64" /></a> pour votre <a rel="nofollow" class="external text" href="https://www.freecadweb.org/wiki/index.php?title=Customize_ToolsBar/fr">barre d'outils</a>
|
|
</p><p><b>Macro_FCInfoToMouse.FCMacro</b>
|
|
</p>
|
|
<pre># -*- coding: utf-8 -*-
|
|
"""
|
|
***************************************************************************
|
|
* Copyright (c) 2016 <mario52> *
|
|
* *
|
|
* This file is a supplement to the FreeCAD CAx development system. *
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU Lesser General Public License (LGPL) *
|
|
* as published by the Free Software Foundation; either version 2 of *
|
|
* the License, or (at your option) any later version. *
|
|
* for detail see the LICENCE text file. *
|
|
* *
|
|
* This software is distributed in the hope that it will be useful, *
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
* GNU Library General Public License for more details. *
|
|
* *
|
|
* You should have received a copy of the GNU Library General Public *
|
|
* License along with this macro; if not, write to the Free Software *
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
|
* USA *
|
|
***************************************************************************
|
|
* WARNING! All changes in this file will be lost and *
|
|
* may cause malfunction of the program *
|
|
***************************************************************************
|
|
"""
|
|
# http://forum.freecadweb.org/viewtopic.php?f=22&t=9215
|
|
# FCInfoToMouse
|
|
|
|
__title__ = "FCInfoToMouse"
|
|
__author__ = "Mario52"
|
|
__url__ = "https://www.freecadweb.org/wiki/Macro_FCInfoToMouse"
|
|
__version__ = "00.04"
|
|
__date__ = "27/03/2018"
|
|
#
|
|
import Draft, Part
|
|
import math,FreeCAD
|
|
from FreeCAD import Base
|
|
import time
|
|
App = FreeCAD
|
|
|
|
global arrondi  ; arrondi = 4
|
|
|
|
global objectAnn  ; objectAnn = ""
|
|
global positionX1 ; positionX1 = 0.0
|
|
global positionY1 ; positionY1 = 0.0
|
|
global positionZ1 ; positionZ1 = 0.0
|
|
global force  ; force = 0
|
|
global hidden  ; hidden = 0
|
|
global coorBegin  ; coorBegin = ""
|
|
global pas  ; pas = 0
|
|
|
|
global spreadSheet; spreadSheet= 0
|
|
global compteur  ; compteur = 0
|
|
global spread  ; spread = ""
|
|
|
|
from math import sqrt, pi, sin, cos, asin, acos, atan, atan2, degrees
|
|
|
|
def angle2(vecteur_x1,vecteur_y1,vecteur_x2,vecteur_y2,mode): #tester getAngle ( Vector )
|
|
# calcul de l'inclinaison d'une ligne a partir de deux Vecteurs
|
|
# si "mode" = 1 alors affichage en degres sinon en radian
|
|
try:
|
|
deltaX = vecteur_x2 - vecteur_x1
|
|
deltaY = vecteur_y2 - vecteur_y1
|
|
if mode ==1:
|
|
angle = degrees(atan2(float(deltaY),float(deltaX))) # degres (mode = 1)
|
|
else:
|
|
angle = atan2(float(deltaY),float(deltaX)) # radian (mode = 0)
|
|
return round(angle,arrondi)
|
|
except Exception:
|
|
None
|
|
|
|
def sub(first, other):
|
|
"sub(Vector,Vector) - subtracts second vector from first one"
|
|
if isinstance(first,FreeCAD.Vector) and isinstance(other,FreeCAD.Vector):
|
|
return FreeCAD.Vector(first.x-other.x, first.y-other.y, first.z-other.z)
|
|
|
|
def length(first):
|
|
"lengh(Vector) - gives vector length"
|
|
if isinstance(first,FreeCAD.Vector):
|
|
return math.sqrt(first.x*first.x + first.y*first.y + first.z*first.z)
|
|
|
|
def dist(first, other):
|
|
"dist(Vector,Vector) - returns the distance between both points/vectors"
|
|
if isinstance(first,FreeCAD.Vector) and isinstance(other,FreeCAD.Vector):
|
|
return length(sub(first,other))
|
|
|
|
def codeColor(color):
|
|
try:
|
|
rgb = float((float(color)/255.0))
|
|
except Exception:
|
|
rgb = 0.0
|
|
return rgb
|
|
|
|
|
|
doc = FreeCAD.ActiveDocument
|
|
if doc == None:
|
|
doc = FreeCAD.newDocument()
|
|
|
|
# for modify the configuration : line 104 to 122
|
|
# PS: if DisplayMode = "Line" and Frame = False the annotation is transparent
|
|
#
|
|
##### Configuration Modify here # Begin #######################################
|
|
#
|
|
#BackgroundColor : #
|
|
red_B = 0.0 # 0.0 to 255.0 #
|
|
green_B = 84.0 # 0.0 to 255.0 #
|
|
blue_B = 255.0 # 0.0 to 255.0 #
|
|
#
|
|
displayMode = "Line" # "Line" or "Object" #
|
|
fontName = "MS Shell Dlg 2" # "MS Shell Dlg 2" for Windows #
|
|
fontSize = 8.0 # Font size #
|
|
frame = False # "False" or "True" #
|
|
justification = "Left" # "Left", "Right", "Center" #
|
|
#
|
|
#TextColor  : #
|
|
red_T = 255.0 # 0.0 to 255.0 #
|
|
green_T = 255.0 # 0.0 to 255.0 #
|
|
blue_T = 255.0 # 0.0 to 255.0 #
|
|
#
|
|
##### Configuration End End ###################################################
|
|
|
|
v=Gui.activeDocument().activeView()
|
|
objectAnn = App.ActiveDocument.addObject("App::AnnotationLabel","FCInfoToMouse")# create work annotation
|
|
objectAnn.LabelText=["Hello FreeCAD World"]
|
|
|
|
FreeCADGui.getDocument(doc.Name).getObject(objectAnn.Label).BackgroundColor = (codeColor(red_B),codeColor(green_B),codeColor(blue_B)) #
|
|
FreeCADGui.getDocument(doc.Name).getObject(objectAnn.Label).DisplayMode = displayMode #
|
|
FreeCADGui.getDocument(doc.Name).getObject(objectAnn.Label).FontName = fontName #
|
|
FreeCADGui.getDocument(doc.Name).getObject(objectAnn.Label).FontSize = fontSize #
|
|
FreeCADGui.getDocument(doc.Name).getObject(objectAnn.Label).Frame = frame #
|
|
FreeCADGui.getDocument(doc.Name).getObject(objectAnn.Label).Justification = justification #
|
|
FreeCADGui.getDocument(doc.Name).getObject(objectAnn.Label).TextColor = (codeColor(red_T),codeColor(green_T),codeColor(blue_T)) #
|
|
|
|
import os, sys, platform
|
|
global PolicePath; PolicePath = ""
|
|
|
|
#if platform.system() == "Windows" :
|
|
# PolicePath = "C:/Windows/Fonts/ARIAL.TTF"
|
|
#elif platform.system() == "Linux" :
|
|
# PolicePath = "/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-M.ttf"
|
|
#elif platform.system() == "Darwin":
|
|
# PolicePath = "/Library/Fonts/Arial.ttf"
|
|
#else:
|
|
# PolicePath = "C:/Windows/Fonts/ARIAL.TTF"
|
|
|
|
p=FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Draft")
|
|
PolicePath = p.GetString("FontFile")
|
|
|
|
class ViewObserver:
|
|
def __init__(self, view):
|
|
self.view = view
|
|
|
|
def logPosition(self, info):
|
|
global objectAnn
|
|
global positionX1, positionY1, positionZ1
|
|
global pas, arrondi
|
|
global coorBegin
|
|
global force
|
|
global hidden
|
|
global PolicePath
|
|
global spreadSheet
|
|
global compteur
|
|
global spread
|
|
|
|
######## for testing key ############
|
|
# try: #
|
|
# print info["Key"] #
|
|
# print info["State"] #
|
|
## print ord(info["Key"]) #
|
|
# except Exception: #
|
|
# None #
|
|
#####################################
|
|
|
|
Button1 = 0
|
|
|
|
try:
|
|
if (info["Key"] == "Q") and (info["State"] == "DOWN"): # SHIFT + Q for quit
|
|
v.removeEventCallback("SoEvent",c) # close event observation
|
|
FreeCAD.Console.PrintMessage( "End FCInfoToMouse" + "\n")
|
|
except Exception:
|
|
None
|
|
|
|
try:
|
|
if (info["Key"] == "M") and (info["State"] == "DOWN"): # SHIFT + M for force display
|
|
if force == 0:
|
|
force = 1
|
|
FreeCAD.Console.PrintMessage( "Forced " + "\n")
|
|
elif force == 1:
|
|
force = 2
|
|
FreeCAD.Console.PrintMessage( "Single " + "\n")
|
|
elif force == 2:
|
|
force = 0
|
|
FreeCAD.Console.PrintMessage( "Normal " + "\n")
|
|
except Exception:
|
|
None
|
|
|
|
try:
|
|
if (info["Key"] == "C") and (info["State"] == "DOWN"): # SHIFT + C for hidden / visible annotation OK
|
|
if hidden == 0:
|
|
hidden = 1
|
|
FreeCADGui.getDocument(doc.Name).getObject(objectAnn.Label).Visibility = False
|
|
FreeCAD.Console.PrintMessage( "concealed " + "\n")
|
|
else:
|
|
hidden = 0
|
|
FreeCADGui.getDocument(doc.Name).getObject(objectAnn.Label).Visibility = True
|
|
FreeCAD.Console.PrintMessage( "visible " + "\n")
|
|
except Exception:
|
|
None
|
|
|
|
try:
|
|
if (info["Key"] == "D") and (info["State"] == "DOWN"): # SHIFT + S for Open spreadSheet
|
|
if spreadSheet == 0:
|
|
#spread = FreeCAD.ActiveDocument.getObjectsByLabel(spread.Name)[0] # for append in existant SpreadSheet
|
|
spread = App.activeDocument().addObject('Spreadsheet::Sheet','MySpreedSheett')
|
|
spreadSheet = 1
|
|
FreeCAD.Console.PrintMessage("SpreadSheet open : " + spread.Name + "\n")
|
|
else:
|
|
spreadSheet = 0
|
|
FreeCAD.Console.PrintMessage("SpreadSheet closed" + "\n")
|
|
compteur = 0
|
|
except Exception:
|
|
None
|
|
|
|
try:
|
|
object2 = ""
|
|
object = v.getObjectInfo(v.getCursorPos()) # here for object preselected
|
|
object2 = object["Object"] + "." + object["Component"] # object + component
|
|
pnt = FreeCAD.Vector(float(object["x"]),float(object["y"]),float(object["z"]))# vector on position mouse to object
|
|
# print "pnt ",pnt
|
|
except Exception:
|
|
pos = info["Position"] # if mouse in 3D view
|
|
pnt = self.view.getPoint(pos) # vector detect on mouse position 3D view
|
|
# print "pnt ",pnt
|
|
|
|
try:
|
|
if (info["Button"] == "BUTTON1") and (info["State"] == "DOWN"): # coordinates clic to mouse
|
|
positionX1 = round(pnt[0],arrondi)
|
|
positionY1 = round(pnt[1],arrondi)
|
|
positionZ1 = round(pnt[2],arrondi)
|
|
|
|
coorBegin = ""
|
|
coorBegin = "X1: "+str(positionX1)+" Y1: "+str(positionY1)+" Z1: "+str(positionZ1)
|
|
if pas == 0:
|
|
pas = 1
|
|
else:
|
|
pas = 0
|
|
|
|
try: # spreadSheet
|
|
if spreadSheet == 1:
|
|
compteur += 1
|
|
spread.set("A"+str(compteur) , str(positionX1) + ", " + str(positionY1) + ", " + str(positionZ1))
|
|
spread.set("B"+str(compteur) , str(positionX1))
|
|
spread.set("C"+str(compteur) , str(positionY1))
|
|
spread.set("D"+str(compteur) , str(positionZ1))
|
|
App.ActiveDocument.recompute()
|
|
FreeCAD.Console.PrintMessage(str(compteur) + " : " + str(positionX1) + ", " + str(positionY1) + ", " + str(positionZ1) + "\n")
|
|
except Exception:
|
|
None
|
|
|
|
except Exception:
|
|
None
|
|
|
|
try:
|
|
objectAnn.BasePosition = (pnt[0], pnt[1], pnt[2])
|
|
if force == 2:
|
|
objectAnn.LabelText = ["X: " + str(round(pnt[0],arrondi)) + " Y: " + str(round(pnt[1],arrondi)) + " Z: " + str(round(pnt[2],arrondi))]
|
|
else:
|
|
if ((pas == 1) or (force == 1)):
|
|
coorEnd = longueur = angles = ""
|
|
coorEnd = "X2: " + str(round(pnt[0],arrondi)) + " Y2: " + str(round(pnt[1],arrondi)) + " Z2: " + str(round(pnt[2],arrondi))
|
|
longueur = "L: " + str(round(dist(FreeCAD.Vector(positionX1,positionY1,positionZ1), FreeCAD.Vector(pnt[0], pnt[1], pnt[2])),12)) # around to 12 decimales
|
|
alphaXY = alphaXY = alphaXZ = 0.0
|
|
alphaXY = str(round(angle2(positionX1,positionY1,pnt[0],pnt[1],1),arrondi))
|
|
alphaYZ = str(round(angle2(positionY1,positionZ1,pnt[1],pnt[2],1),arrondi))
|
|
alphaXZ = str(round(angle2(positionX1,positionZ1,pnt[0],pnt[2],1),arrondi))
|
|
|
|
angles = "XY: " + alphaXY + unichr(176) + " YZ: " + alphaYZ + unichr(176) + " XZ: " + alphaXZ + unichr(176) # unichr(176) = degrees character
|
|
|
|
if object2 == "":
|
|
objectAnn.LabelText = [coorBegin, coorEnd, longueur, angles,]
|
|
else:
|
|
objectAnn.LabelText = [object2, coorBegin, coorEnd, longueur, angles,]
|
|
else:
|
|
if object2 == "":
|
|
objectAnn.LabelText = ["X: " + str(round(pnt[0],arrondi)) + " Y: " + str(round(pnt[1],arrondi)) + " Z: " + str(round(pnt[2],arrondi)),]
|
|
else:
|
|
objectAnn.LabelText = [object2, "X: " + str(round(pnt[0],arrondi)) + " Y: " + str(round(pnt[1],arrondi)) + " Z: " + str(round(pnt[2],arrondi))]
|
|
|
|
except Exception:
|
|
FreeCAD.Console.PrintError("End FCInfoToMouse by an error" + "\n")
|
|
v.removeEventCallback("SoEvent",c) # close event observation
|
|
|
|
##### Begin ######
|
|
FreeCAD.Console.PrintMessage("__Welcome to FCInfoToMouse__" + "\n")
|
|
FreeCAD.Console.PrintMessage("SHIFT + Q : for quit" + "\n")
|
|
FreeCAD.Console.PrintMessage("SHIFT + M : for force display, mode single, mode normal" + "\n")
|
|
FreeCAD.Console.PrintMessage("SHIFT + C : for concealed / visible" + "\n")
|
|
FreeCAD.Console.PrintMessage("SHIFT + D : for create spreadSheet / close spreadSheet" + "\n")
|
|
FreeCAD.Console.PrintMessage("____________________________" + "\n")
|
|
|
|
pas = 0
|
|
o = ViewObserver(v)
|
|
try:
|
|
c = v.addEventCallback("SoEvent",o.logPosition)
|
|
except Exception:
|
|
App.ActiveDocument.removeObject(objectAnn.Label)
|
|
FreeCAD.Console.PrintMessage( "Not GUI End FCInfoToMouse" + "\n") </pre>
|
|
<p>ou sur Gists <a rel="nofollow" class="external text" href="https://gist.github.com/mario52a/974214c4b83beaa41495">Macro_FCInfoToMouse.FCMacro</a> ou le fichier zip <a rel="nofollow" class="external text" href="https://gist.github.com/mario52a/974214c4b83beaa41495/archive/d62630049d4663369fc80519a7655ee4c32c8711.zip">Macro_FCInfoToMouse.FCMacro.zip</a>
|
|
</p>
|
|
<h3><span class="mw-headline" id="Limitation">Limitation</span></h3>
|
|
<p>Il est possible que la macro ne reconnaisse pas certaines touches du clavier.
|
|
</p>
|
|
<h3><span class="mw-headline" id="Liens">Liens</span></h3>
|
|
<p>La discussion sur le forum <a rel="nofollow" class="external text" href="http://forum.freecadweb.org/viewtopic.php?f=3&t=13592">From autocad to freecad</a>
|
|
</p><p>Mes macros sur <a rel="nofollow" class="external text" href="https://gist.github.com/mario52a">mario52a </a> Gists
|
|
</p>
|
|
<h3><span class="mw-headline" id="Versions">Versions</span></h3>
|
|
<p>27/03/2018 ver 00.04 : add function "Save the coordinate in a spreadSheet key "D" flip/flop on,off
|
|
</p><p>24/01/2016 ver 00.03 : ajout de la section configuration et remplacer la touche "C" par "M"
|
|
</p><p>23/01/2016 ver 00.02 : ajout de la fonction "single", replacé la touche "H" par la "C" et correction de bug d'affichage ( , par + )
|
|
</p><p>02/01/2016 : ver 0.1
|
|
</p>
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div><div class="printfooter">
|
|
Online version: "<a dir="ltr" href="https://www.freecadweb.org/wiki/index.php?title=Macro_FCInfoToMouse/fr&oldid=270691">http://www.freecadweb.org/wiki/index.php?title=Macro_FCInfoToMouse/fr&oldid=270691</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> |