#standard header
author = 'IDSLK '
scriptname = 'AutoFillet '
#script_version = 0.1 # initial
#script_version = 0.2 # adepted to V23
script_version = 0.3 # adepted to V23 SP1 and corrected "win not defined"
script_version = 0.4 # adepted to V27
minor = 'a'
build_date = 20211005
made_with = 347013
made_with_Alibreversion = 'PRODUCTVERSION 27,0,0,27038'
try:
enviroment = CurrentAssembly()
enviroment_obj = enviroment._Assembly
except:
enviroment = CurrentPart()
enviroment_obj = enviroment._Part
def scriptversion(made_with):
if AlibreScriptVersion <> made_with:
infotext='Sorry, your AlibreScriptVersion '+str(AlibreScriptVersion)+'\ndoes not match the installed Version '+str(made_with)+'\nThe script function might be influenced!!!'
win.InfoDialog(infotext,'error')
else:
print 'The installed AlibreScriptVersion equals '+str(AlibreScriptVersion)+' as expected!'
def alibreversion(made_with_Alibreversion):
if Vers <> made_with_Alibreversion:
infotext='Sorry, your AlibreVersion '+str(Vers)+'\ndoes not match the needed Version! '+str(made_with_Alibreversion)+'\nThe script function might be influenced!!!'
win.InfoDialog(infotext,'error')
#sys.exit()
else:
print 'The installed AlibreVersion equals '+str(Vers)+' as expected!'
from System import Enum
Root = Global.Root
ThisSession = Root.TopmostSession
Vers = Root.Version
win = Windows()
options = []
values = []
scriptversion(made_with)
alibreversion(made_with_Alibreversion)
choose = 0
chosen = 0
chosen = enviroment.Selections.Count
while choose == 0:
shure = win.QuestionDialog('You have selected '+str(chosen)+' faces.\n\nPlease select three meaningful faces for the fillet\n(using SHIFT + LMB) and then press Yes',author + scriptname + 'V'+str(script_version)+minor)
if shure == False:
sys.exit()
if enviroment.Selections.Count == 3:
choose = 1
chosen = enviroment.Selections.Count
#start of individual
three_faces = []
for i in enviroment.Selections:
temp_face = i
three_faces.append(temp_face)
fillet_dia = 0
parallel_faces =[]
if three_faces[0].DistanceTo(three_faces[1]) > 0:
fillet_dia = three_faces[0].DistanceTo(three_faces[1])
parallel_faces = [0,1]
fillet_face = 2
elif three_faces[1].DistanceTo(three_faces[2]) > 0:
fillet_dia = three_faces[1].DistanceTo(three_faces[2])
parallel_faces = [1,2]
fillet_face = 0
elif three_faces[0].DistanceTo(three_faces[2]) > 0:
fillet_dia = three_faces[0].DistanceTo(three_faces[2])
parallel_faces = [0,2]
fillet_face = 1
elif fillet_dia == 0:
print 'Sorry, no parallel faces...'
sys.exit()
fillet_radius = fillet_dia/2
a=[]
for n in three_faces[0].Edges:
a.append(n.Name)
b=[]
for m in three_faces[1].Edges:
b.append(m.Name)
c=[]
for o in three_faces[2].Edges:
c.append(o.Name)
edgelist = []
edgelist.append(set(a).intersection(b))
edgelist.append(set(b).intersection(c))
edgelist.append(set(a).intersection(c))
fillet_edges = []
for e in edgelist:
try:
fillet_edges.append(enviroment.GetEdge(list(e)[0]))
except:
pass#print 'end of set'
enviroment.AddFillet('AutoFillet',fillet_edges,fillet_radius,0)