Skip to content

Instantly share code, notes, and snippets.

@akirayou
Last active October 3, 2021 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akirayou/7f621fd79703925f8d622c35c1d033ed to your computer and use it in GitHub Desktop.
Save akirayou/7f621fd79703925f8d622c35c1d033ed to your computer and use it in GitHub Desktop.
#FreeCADスパイラル六角形をだすテスト
for j in range(8):
Base=50
H=70
N=20
T=Base/4/2
R=(Base-T*j+1)/2
RTop=(Base-T*(j+1)+1)/2
Rs=[]
o=App.ActiveDocument.addObject("Part::Line","Line")
o.X1=0.00
o.Y1=0.00
o.Z1=0.00
o.X2=0.00
o.Y2=0.00
o.Z2=H
o.Placement=App.Placement(App.Vector(0.00,0.00,0.00),App.Rotation(App.Vector(0.00,0.00,1.00),0.00))
o.Label='直線'
sweep_line=o
for i in range(N+1):
o=App.ActiveDocument.addObject("Part::RegularPolygon","R6-{}".format(i))
o.Polygon=6
rate=i/N
o.Circumradius=R*(1-rate)+RTop*rate
o.Placement=App.Placement(App.Vector(0.00,0.00,i*H/N),App.Rotation(App.Vector(0.00,0.00,1.00),i*2 ))
o.Label="R6-{}".format(i)
Rs.append(o)
o=App.ActiveDocument.addObject('Part::Sweep','Sweep')
o.Sections=Rs
o.Spine=sweep_line
o.Solid=True
o.Frenet=False
sweep_obj=o
o=App.ActiveDocument.addObject("Part::Thickness","Thickness")
o.Faces = (sweep_obj,['Face8','Face7',])
o.Value = 0.8
o.Mode = 0
o.Join = 0
o.Intersection = False
o.SelfIntersection = False
Gui.ActiveDocument.hide(sweep_obj.Label)
App.ActiveDocument.recompute()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment