Ich habe mal den ersten Prototypen eines Skriptes, der diese Schnittflächen berechnet.
- bp_579.png (36.44 KiB) Viewed 1857 times
Es braucht noch die Feinarbeit, aber so könnte man das hinbekommen.
Alle Punkte berechnen, bei denen der Flächennormalenvektor horizontal ist. Davon die Kurven und dann die Normalenrichtung drauf.
Code: Select all
#obj=App.ActiveDocument.Nurbs
#obj=App.ActiveDocument.Poles
#bs=obj.Shape.Face1.Surface
face=App.ActiveDocument.Fillet.Shape.Face2
Part.show(face)
bs=face.Surface
f=0.01
ui=bs.uIso(0.5)
vc=int(round(ui.length()/f))
vi=bs.vIso(0.5)
uc=int(round(vi.length()/f))
uc
vc
uc=3600
vc=360
sila=[]
silb=[]
pts=[]
tarc=0.0
#tarc=0.5
#tarc=-0.1
#tarc=-0.15
#tarc=0.15
#tarc=0.1
ptsa=[]
uper=bs.UPeriod()
vper=bs.VPeriod()
for u in range(uc):
aa=0
for v in range(vc):
nv=bs.normal(uper/uc*u,vper/vc*v)
nv2=bs.normal(uper/uc*(u+1),vper/vc*(v+1))
ptsa.append(bs.value(uper/uc*(u),vper/vc*(v)))
#print ((u,v), "all ------------------------#",nv.z,nv2.z)
#if nv.z * nv2.z<=0:
#if (nv.z-tarc) * (nv2.z-tarc)<=0 or abs(nv.z-tarc)< 0.0001 or abs(nv2.z-tarc)< 0.0001:
# sonderlocke in y-richtung
# if (nv.y-tarc) * (nv2.y-tarc)<=0 or abs(nv.y-tarc)< 0.0001 or abs(nv2.y-tarc)< 0.0001:
if (nv.y-tarc) * (nv2.y-tarc)<=0 :
print ((u,v), "------------------------#",round(nv.z,3),round(nv2.z,3))
aa +=1
#print ((u,v))
pts.append(bs.value(uper/uc*(u+0.5),vper/vc*(v+0.5)))
sila += [(u,v)]
#
print
import Points
Points.show(Points.Points(pts))
# Points.show(Points.Points(ptsa))
def dist(a,b):
(u,v)=a
(u2,v2)=b
return abs(u-u2)+abs(v-v2)
def erzeugefaden(sila):
tra=[sila[0]]
rest=[]
for p in sila[1:]:
if dist(p,tra[-1])<10:
tra.append(p)
else:
rest.append(p)
print ("erztuegne faden",len(sila),len(rest),len(tra))
return (rest,tra)
import Draft
def kette(uvl):
pts=[]
npts=[]
for p in uvl:
(u,v)=p
pt=bs.value(uper/uc*(u+0.5),vper/vc*(v+0.5))
pts.append(pt)
n=bs.normal(uper/uc*(u+0.5),vper/vc*(v+0.5))
npts.append(pt-10*n)
if len(pts)==1 : return
w1=Draft.makeWire(pts)
w2=Draft.makeWire(npts)
# ff=App.ActiveDocument.addObject('Part::Loft','Loft')
# ff.Sections=[w1,w2]
ff=App.ActiveDocument.addObject('Part::RuledSurface', 'Ruled Surface')
ff.Curve1=(w1,[''])
ff.Curve2=(w2,[''])
#Points.show(Points.Points(pts))
(rest,tra)=erzeugefaden(sila)
kette(tra)
ct=0
while rest<>[] and ct<10:
ct += 1
sila=rest
(rest,tra)=erzeugefaden(sila)
kette(tra)
App.activeDocument().recompute()
Die vorläufige Datei ist hier:
https://www.dropbox.com/s/hehvz4vj3e1os ... fcstd?dl=0