I downloaded your new version but FreeCAD disappears after a refresh! (Vista sp2 / freecad 0.13 1828)
I would like to see the name of the selected object ex: Edge3
Code: Select all
# -*- coding: utf-8 -*-
# Liste les composantes Edge d'un objet
# List the Edge of an object components
sel = FreeCADGui.Selection.getSelection() # Sélectionnez un objet avec la souris
for j in enumerate(sel[0].Shape.Edges):
name = "Edge%d" % (j[0]+1)
#fillets.append(name)
print name
Code: Select all
# -*- coding: utf-8 -*-
# inclinaison d'un objet sélectionné
from math import sqrt, pi, sin, cos, asin, acos, atan, atan2, degrees
def angle2(vecteur_x1,vecteur_y1,vecteur_x2,vecteur_y2,mode):
# calcul de l'inclinaison d'une ligne à partir de deux Vecteurs
# si "mode" = 1 alors affichage en degrès sinon en radian
try:
deltaX = vecteur_x2 - vecteur_x1
deltaY = vecteur_y2 - vecteur_y1
if mode ==1:
angle = degrees(atan2(deltaY,deltaX)) # degrès
else:
angle = atan2(deltaY,deltaX) # radian
return angle
except:
return "-"
sel = FreeCADGui.Selection.getSelection()
mode = 1 # 1=degrès 0=radian
try:
print "Plan xy ",angle2(sel[0].Shape.Vertexes[0].Point[0],sel[0].Shape.Vertexes[0].Point[1],sel[0].Shape.Vertexes[1].Point[0],sel[0].Shape.Vertexes[1].Point[1],mode)
print "Coor xy [",sel[0].Shape.Vertexes[0].Point[0]," ",sel[0].Shape.Vertexes[0].Point[1],"] , [",sel[0].Shape.Vertexes[1].Point[0]," ",sel[0].Shape.Vertexes[1].Point[1],"]"
except:
None
print
try:
print "Plan yz ",angle2(sel[0].Shape.Vertexes[0].Point[1],sel[0].Shape.Vertexes[0].Point[2],sel[0].Shape.Vertexes[1].Point[1],sel[0].Shape.Vertexes[1].Point[2],mode)
print "Coor yz [",sel[0].Shape.Vertexes[0].Point[1]," ",sel[0].Shape.Vertexes[0].Point[2],"] , [",sel[0].Shape.Vertexes[1].Point[1]," ",sel[0].Shape.Vertexes[1].Point[2],"]"
except:
None
print
try:
print "Plan zx ",angle2(sel[0].Shape.Vertexes[0].Point[2],sel[0].Shape.Vertexes[0].Point[0],sel[0].Shape.Vertexes[1].Point[2],sel[0].Shape.Vertexes[1].Point[0],mode)
print "Coor zx [",sel[0].Shape.Vertexes[0].Point[2]," ",sel[0].Shape.Vertexes[0].Point[0],"] , [",sel[0].Shape.Vertexes[1].Point[2]," ",sel[0].Shape.Vertexes[1].Point[0],"]"
except:
None
print
I had expected also the BoundBox
PS:Why use 2 separate buttons and do not all put in the same window ?
mario