(1)正十二面体(Regular dodecahedron)をsympyとFreeCADでやってみたい。(厳密値で)

①回転する方法を教えて下さい。
②sympyでPointの配列?リストの使い方を教えて下さい。

![png2.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/109698/5cc75ba6-70e8-e4e7-97d3-37f6367d128e.png)

# ①マクロを使って厳密値でやってみた。
### 前略
私は、厳密値の計算ができないので、@ikiuo様の計算結果を使わせてもらいました。
ありがとうございました。

https://qiita.com/ikiuo/items/0292a58993c4e6d14f2d

https://qiita.com/ikiuo/items/d7486f40f2378af15288

### FreeCADのマクロで
マクロからsympyを使っています。

```python
import FreeCAD
import Part
import Draft
import Mesh
from sympy import *
var('p q t')
r2 = sqrt(2)
r3 = sqrt(3)
r5 = sqrt(5)
x1 = 2/3
x2 = 1/3
x3 = r5/3
x4 = (3-r5)/6
x5 = (3+r5)/6
y1 = 1/r3;
y2 = sqrt((3+r5)/6)
y3 = sqrt((3-r5)/6)
z1 = r5/3
z2 =  1/3
A01=Point(  0,  0,  1)
A02=Point( x1,  0, z1)
A03=Point(-x2, y1, z1)
A04=Point(-x2,-y1, z1)
A05=Point( x3, y1, z2)
A06=Point( x3,-y1, z2)
A07=Point( x4, y2, z2)
A08=Point( x4,-y2, z2)
A09=Point(-x5, y3, z2)
A10=Point(-x5,-y3, z2)
A11=Point( x5,-y3,-z2)
A12=Point( x5, y3,-z2)
A13=Point(-x4,-y2,-z2)
A14=Point(-x4, y2,-z2)
A15=Point(-x3,-y1,-z2)
A16=Point(-x3, y1,-z2)
A17=Point( x2,-y1,-z1)
A18=Point( x2, y1,-z1)
A19=Point(-x1,  0,-z1)
A20=Point(  0,  0, -1)
def myTaisekiGyouretuSiki(PTO,PTA,PTB,PTC):
    return Matrix([[PTA.x-PTO.x, PTA.y-PTO.y, PTA.z-PTO.z], \
                   [PTB.x-PTO.x, PTB.y-PTO.y, PTB.z-PTO.z], \
                   [PTC.x-PTO.x, PTC.y-PTO.y, PTC.z-PTO.z]]).det()/6
def myMensekiVector3D(P,Q):
    return Rational(1, 2) * sqrt(P.distance(Point(0, 0, 0)) ** 2 * Q.distance(Point(0, 0, 0)) ** 2 \
                                 - P.dot(Q) ** 2)
def myXYZ2Txt(A):
    return '(' + str(A.x) + ',' + str(A.y) + ',' + str(A.z) + ')'
def myTxtXYZ(A,myWedgei):
    P5x=float(A.x)
    P5y=float(A.y)
    P5z=float(A.z)
    p5 = FreeCAD.Vector(P5x, P5y, P5z)
    myText = Draft.makeText("  "+myWedgei, p5)
    myText.Label = myWedgei
    #FreeCADGui.ActiveDocument.ActiveObject.FontSize = '0.05 mm'
    FreeCADGui.ActiveDocument.ActiveObject.FontSize = '0.1 mm'
def myTxtXYZ_S(*xy_tx):
    for i in range(1,int(len(xy_tx)/2)+1):
        myTxtXYZ(xy_tx[2*i-2],xy_tx[2*i-1]+myXYZ2Txt(xy_tx[2*i-2]) )
def myLine(A,B):
    Ax,Ay,Az=float(A.x),float(A.y),float(A.z)
    Bx,By,Bz=float(B.x),float(B.y),float(B.z)
    pl = FreeCAD.Placement()
    pl.Rotation.Q = (0.4247081540122249, 0.17592004639554645, 0.33985110062924484, 0.8204732460821097)
    pl.Base = FreeCAD.Vector(-3.9166066876399563, -2.1670824762243774, 1.7495260956243028)
    points = [FreeCAD.Vector(Ax,Ay,Az), FreeCAD.Vector(Bx,By,Bz)]
    line = Draft.make_wire(points, placement=pl, closed=False, face=True, support=None)
    Draft.autogroup(line)
def myLine_S(*args):
    for i in range(1,len(args)):
        myLine(args[i-1],args[i])
def mymake_wire(n,*args):
    p12345=[]
    for i in range(0,len(args)):
        p12345=p12345+[App.Vector(args[i].x, args[i].y, args[i].z)]
    wire1 = Draft.make_wire(p12345,closed=True)
myTxtXYZ_S(A01,"A01",A02,"A02",A03,"A03",A04,"A04",A05,"A05",
           A06,"A06",A07,"A07",A08,"A08",A09,"A09",A10,"A10",
           A11,"A11",A12,"A12",A13,"A13",A14,"A14",A15,"A15",
           A16,"A16",A17,"A17",A18,"A18",A19,"A19",A20,"A20"
          )
mymake_wire(" 01",A01,A03,A07,A05,A02)    #1
mymake_wire(" 02",A14,A18,A20,A19,A16)    #2
mymake_wire(" 03",A06,A08,A04,A01,A02)    #3
mymake_wire(" 04",A02,A06,A11,A12,A05)    #4
mymake_wire(" 05",A07,A03,A09,A16,A14)    #5
mymake_wire(" 06",A05,A07,A14,A18,A12)    #6
mymake_wire(" 07",A04,A08,A13,A15,A10)    #7
mymake_wire(" 08",A08,A13,A17,A11,A06)    #8 
mymake_wire(" 09",A09,A10,A15,A19,A16)    #9 
mymake_wire(" 10",A11,A12,A18,A20,A17)    #10
mymake_wire(" 11",A13,A15,A19,A20,A17)    #11
mymake_wire(" 12",A10,A09,A03,A01,A04)    #12

#import FreeCAD
FreeCADGui.getDocument('Unnamed').getObject('Wire'   ).ShapeColor = (255/255,255/255,255/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire001').ShapeColor = (255/255,255/255,  0/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire002').ShapeColor = (192/255,192/255,192/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire003').ShapeColor = (  0/255,255/255,255/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire004').ShapeColor = (  0/255,255/255,  0/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire005').ShapeColor = (128/255,128/255,128/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire006').ShapeColor = (128/255,128/255,  0/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire007').ShapeColor = (255/255,  0/255,255/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire008').ShapeColor = (  0/255,128/255,128/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire009').ShapeColor = (128/255,  0/255,  0/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire010').ShapeColor = (  0/255,128/255,  0/255)
FreeCADGui.getDocument('Unnamed').getObject('Wire011').ShapeColor = (128/255,  0/255,128/255)
doc = App.activeDocument()
App.ActiveDocument.addObject("App::Origin", "Origin")
App.ActiveDocument.getObject('Origin').Visibility = True
App.ActiveDocument.recompute()
Gui.activeDocument().activeView().viewAxonometric()
Gui.SendMsgToActiveView("ViewFit")
```

# ②マウス操作で作成する方法をみつけました。

https://www.youtube.com/watch?v=vLvJ7oUQ1Ps

# ③Addon Manageでやってみた。

![png.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/109698/de1e68b7-173b-b528-84af-fa23b02fbeef.png)

https://wiki.freecadweb.org/Macro_Polyhedrons


# 参考
1辺の長さが1の正十二面体＜

https://mathexamtest.web.fc2.com/2021/202110000/2021100000200mj.html#top-0208

https://qiita.com/mrrclb48z/items/b7742bd57151dc35fdf6

http://itdoc.hitachi.co.jp/manuals/3020/30203S0933/AJSV0206.HTM


https://ja.wikipedia.org/wiki/%E6%AD%A3%E5%8D%81%E4%BA%8C%E9%9D%A2%E4%BD%93

https://en.wikipedia.org/wiki/Regular_dodecahedron



# (2)は、できていません。
つづく。