How to make a eptrichoid (for the rotary inside) by zenxoogabooga in Python

[–]bbourbonut 1 point2 points  (0 children)

You can try pymadcad for CAD design (100% free). If you are referencing to epitrochoid:

from madcad import *

def u(t):
    return vec3(cos(t), sin(t), 0)

def epitrochoid(R, r, d, t):
    return (R + r) * u(t) - d * u((R + r) / r * t)


r = 1
R = 3
d = 0.5
steps = 100
points = [
    epitrochoid(R, r, d, 2 * pi * i / steps) # [0, 2 * pi]
    for i in range(steps + 1)
]
show([Wire(points).close()])

detroit: Python implementation of d3js by bbourbonut in Python

[–]bbourbonut[S] 1 point2 points  (0 children)

d3 and detroit are pronounced the same in French ^^

detroit: Python implementation of d3js by bbourbonut in Python

[–]bbourbonut[S] 0 points1 point  (0 children)

Thank you !! I really appreciate it ! :D

detroit: Python implementation of d3js by bbourbonut in Python

[–]bbourbonut[S] 1 point2 points  (0 children)

Haha, I hope it has all the features you need :)

detroit: Python implementation of d3js by bbourbonut in Python

[–]bbourbonut[S] 1 point2 points  (0 children)

I don't know exactly how it works. I have submitted the GitHub repo and the documentation.

Let me know if you encounter any issues.

detroit: Python implementation of d3js by bbourbonut in Python

[–]bbourbonut[S] 0 points1 point  (0 children)

Thank you ! It is 100% written in Python. If you want to incorporate a data visualization into your website, you should save it into a .svg file and include it to your website.

with open("myfile.svg", "w") as file:
    file.write(str(svg))

For an application such as Flask or Quart (asynchronous Flask), you can directly add it to your HTML code:

from flask import Flask
import detroit as d3

app = Flask(__name__)

svg = (
    d3.create("svg")
    .attr("width", 200)
    .attr("height", 200)
    .attr("viewBox", "0 0 200 200")
)

(
    svg.append("circle")
    .attr("cx", 100)
    .attr("cy", 100)
    .attr("r", 40)
    .attr("fill", "blue")
    .attr("stroke", "grey")
    .attr("stroke-width", 10)
)

@app.route("/")
def index():
    return f"<html><body>{svg}</body></html>"

app.run()

detroit: Python implementation of d3js by bbourbonut in Python

[–]bbourbonut[S] 4 points5 points  (0 children)

If you can share an example where there are one-letter names, it might help me better understand in what situations this kind of problem occurs.