Designing spiral or helix [SOLVED]

if you have a command line window open navigate to the folder where helix.py is located (btw, a helix is a 3d spiral :wink: )
Once you got the folder right, try to start the python script with this:

“python helix.py”

Do you see a couple of lines scroll by?
If yes, try this:

“python helix.py > helix.txt”

There then should be a helix.txt sitting next to helix.py in that same folder.

1 Like

WOW! It worked!
@Joan_Sparky Thank you!!! Thank you!!! Thank you!!!
You are right about the meaning of helix. I was using it all the time because of the Autocad tool.

Thank you again for you contribution!
Deppy

:smile:

just in case - as you said you’re not so fluent with python - you found how to manipulate the spiral (turns, track spacing, CW/CCW, etc.), by modifying the ‘helix.py’ code, yes?

1 Like

Yes, I have been modifying it since yesterday. :blush:
Your instruction where pretty clear, so from that point on I had no issues.

Thanks again Joan_Sparky

Hi, can you helpme to me please?
thanks you

I’m interested in creating a spiral but I need to know the steps one by one. I downloaded the code “KiCAD_CopperSpiral_v2.py” But I can not use it … not know how to use the original code (copy / paste) First use “Windows 10 x64bit” The file is located in C: \ KiCAD_CopperSpiral_v2.py
And I’ll kicad, I press “python scrips display console” and paste the code: siguiente…pero and appears not to do after eso…hacia where I point the mouse pointer or should I type to pop me the spiral?

execfile ( “C: \ KiCAD_CopperSpiral_v2.py”)

0 1 2 3 4 5 6

LIST_elmt = [ “(”, “(start”, “) (end”, “)”, “(layer”, “)”, “))”]
#LIST_elmt = [ “(Gr_line (start 131.571908 182.314571) (end 112.874456 120.68499) (angle 90) (layer Dwgs.User) (width 0.1))”]
#LIST_elmt = [ “(Segment (start 118.7 106.7) (119.4 end 106.7) (width 0.25) (layer B.Cu) (net 0))”]
DICT_elmt = { “s”: [ “segment”, “(width”, “(net”],
“Arc”: [ “gr_arc” “(angle”, “(width”],
“Lne”: [ “gr_line” “(angle”, “(width”],
}
DICT_lyr = { “dwg”: “Dwgs.User”
“Cmt”: “Cmts.User”
“Cut”: “Edge.Cuts”
“FCU” “F.Cu”
“BCU”: “B.Cu”
}

def FNC_string (element,
STR_start, # 1
STR_end, # 2
Angle, # 4
layer, # 5
width,
):
STR_line = “”
“” "
0 1 2 3 4 5
LIST_elmt = [ “(”, “(start”, “) (end”, “)”, “(layer”, “) (width”, “))”]
“” "
for i in range (len (LIST_elmt)):
STR_line + = LIST_elmt [i]
if i == 0:
STR_line + = DICT_elmt [element] [0]
if i == 1:
STR_line + = STR_start
if i == 2:
STR_line + = STR_end
if i == 3:
if element == “seg”:
STR_line + = DICT_elmt [element] [1]
STR_angle = “{: .1f}” format (width).

etc…[quote=“Dutsan_Rojas, post:25, topic:1745, full:true”]
Hi, can you helpme to me please?
thanks you
[/quote]

:sweat_smile:
etc…

segradius = td / sides

for i in range (turns * sides):
    # Central rings for HV and SNS
    startX = baseX + (radius + segradius * i) * math.sin (math.radians (segangle * (i) + startAngle))
    startY = baseY + (radius + segradius * i) * math.cos (math.radians (segangle * (i) + startAngle))
    EndX = baseX + (radius + segradius * (i + 1.0)) * math.sin (math.radians (segangle * (i + 1.0) + startAngle))
    Endy = baseY + (radius + segradius * (i + 1.0)) * math.cos (math.radians (segangle * (i + 1.0) + startAngle))
    STR_data + = FNC_string ( "seg", #type of line
                            "{: .6f}". Format (startX) + "" + "{: .6f}" format (startY), # start point.
                            "{: .6f}". Format (EndX) + "" + "{: .6f}" format (Endy) # end point.
                            net, or net value angle #
                            layer, layer on pcb #
                            tw, # track width
                            )
return STR_data

if name == ‘main’:

Center = [105.0,105.0] # x / y coordinates of the center of the pcb sheet
Radius = 1 # start radius in mm
Sides = 24
StartAngle = 0.0 # degrees
TrackWidth = 0.4
TrackDistance = 0.9
Turns = 8
Layer = "FCU"
Net = "1"

print FNC_spiral (Center,
                  Radius,
                  Sides,
                  StartAngle,
                  TrackWidth,
                  TrackDistance,
                  Turns,
                  Layer
                  Net,
                  )

(Segment (start 115.000000 106.100000) (end 114.708829 106.086667) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.708829 106.086667) (end 114.425000 105.995929) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.425000 105.995929) (end 114.169150 105.830850) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.169150 105.830850) (end 113.960770 105.600000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 113.960770 105.600000) (end 113.816741 105.317053) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 113.816741 105.317053) (end 113.750000 105.000000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 113.750000 105.000000) (end 113.768445 104.670006) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 113.768445 104.670006) (end 113.874167 104.350000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 113.874167 104.350000) (end 114.063084 104.063084) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.063084 104.063084) (end 114.325000 103.830866) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.325000 103.830866) (end 114.644124 103.671852) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.644124 103.671852) (end 115.000000 103.600000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 115.000000 103.600000) (end 115.368817 103.623556) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 115.368817 103.623556) (end 115.725000 103.744263) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 115.725000 103.744263) (end 116.042983 103.957017) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 116.042983 103.957017) (end 116.299038 104.250000) (width 0.4) (layer F.Cu) (net 1))

etc…
:sweat_smile:

(Segment (start 110.484539 103.129635) (end 110.756476 102.550000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 110.756476 102.550000) (end 111.102652 102.009459) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 111.102652 102.009459) (end 111.517499 101.517499) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 111.517499 101.517499) (end 111.994240 101.082818) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 111.994240 101.082818) (end 112.525000 100.713174) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 112.525000 100.713174) (end 113.100933 100.415248) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 113.100933 100.415248) (end 113.712375 100.194519) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 113.712375 100.194519) (end 114.349001 100.055169) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.349001 100.055169) (end 115.000000 100.000000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 115.000000 100.000000) (end 115.654263 100.030383) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 115.654263 100.030383) (end 116.300566 100.146223) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 116.300566 100.146223) (end 116.927768 100.345957) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 116.927768 100.345957) (end 117.525000 100.626572) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 117.525000 100.626572) (end 118.081855 100.983649) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 118.081855 100.983649) (end 118.588567 101.411433) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 118.588567 101.411433) (end 119.036185 101.902926) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 119.036185 101.902926) (end 119.416730 102.450000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 119.416730 102.450000) (end 119.723334 103.043531) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 119.723334 103.043531) (end 119.950370 103.673552) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 119.950370 103.673552) (end 120.093548 104.329422) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 120.093548 104.329422) (end 120.150000 105.000000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 120.150000 105.000000) (end 120.118334 105.673841) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 120.118334 105.673841) (end 119.998666 106.339389) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 119.998666 106.339389) (end 119.792625 106.985170) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 119.792625 106.985170) (end 119.503332 107.600000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 119.503332 107.600000) (end 119.135354 108.173169) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 119.135354 108.173169) (end 118.694633 108.694633) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 118.694633 108.694633) (end 118.188388 109.155188) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 118.188388 109.155188) (end 117.625000 109.546633) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 117.625000 109.546633) (end 117.013872 109.861916) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 117.013872 109.861916) (end 116.365270 110.095259) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 116.365270 110.095259) (end 115.690157 110.242265) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 115.690157 110.242265) (end 115.000000 110.300000) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 115.000000 110.300000) (end 114.359765 110.272811) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.359765 110.272811) (end 113.726104 110.168398) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 113.726104 110.168398) (end 113.108319 109.987952) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 113.108319 109.987952) (end 112.515518 109.733784) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 112.515518 109.733784) (end 111.956484 109.409294) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 111.956484 109.409294) (end 111.439541 109.018927) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 111.439541 109.018927) (end 110.972436 108.568110) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 110.972436 108.568110) (end 110.562218 108.063180) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 110.562218 108.063180) (end 110.215132 107.511293) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 110.215132 107.511293) (end 109.936527 106.920322) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 109.936527 106.920322) (end 109.730773 106.298748) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 109.730773 106.298748) (end 109.601191 105.655534) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 109.601191 105.655534) (end 109.550000 105.000000) (width 0.4) (layer F.Cu) (net 1))

I really think that writing on the front line “execute …” is unnecessary …
because of the way I hit the code to the console without changing anything
I do not know
sorry for my bad English
many thanks :sweat:

Those last lines of output… you need to put that into a .kicad_pcb file pretty much at the end.
Create a project with schematic and then create a track in pcbnew for that.
Save everything.
Then open the .kicad_pcb file in a text editor.
Study where the track element is and then add the output of the python script at that place.
Save the file.
Open in pcbnew again and the spiral should be there.

1 Like

Just curious as to what you are using the spiral for, inductor, antenna, …?

Why not create a module that can be saved to a library and manipulated like any other footprint, associated with a schematic symbol and be DRC friendly?

for inductor …
need create a spiral but…is so hard follow the steps when the english is not my strong

Have you considered a square inductor?

because, the pcb is neccesary circle form

second image:

h___erase.this___ttp://subefotos.com/ver/?f6ce983103d2811299cdd38c8941e1f2o.jpg

ammm … I did not succeed … something I need and I can not figure …
This is what I do: I explain better in the pictures with respective order of numbers and letters …
previously I tried to paste the original code at the end of spiral outline text, then save your changes, and does not appear Pcbnew opened spiral
Is it necessary to have the “KiCAD_CopperSpiral_v2” file in c :?


or in addition also I paste the same code in the console window kicad?
Thank you very much for your patience again

Do you have python installed?

When you open a command line interface and type this:

> python

What happens?
If it is installed you should see something similar to this in that window:

Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:40:30) [MSC v.1500 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
>>>

If that’s the case you should be able to run the python script for the spiral directly in the command line (type exit()) to get out of the python interpreter:

> copper_spiral.py

And you should see something like this scroll by in the command line window:

(Segment (start 115.000000 106.100000) (end 114.708829 106.086667) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.708829 106.086667) (end 114.425000 105.995929) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 114.425000 105.995929) (end 114.169150 105.830850) (width 0.4) (layer F.Cu) (net 1))


(Segment (start 110.215132 107.511293) (end 109.936527 106.920322) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 109.936527 106.920322) (end 109.730773 106.298748) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 109.730773 106.298748) (end 109.601191 105.655534) (width 0.4) (layer F.Cu) (net 1))
(Segment (start 109.601191 105.655534) (end 109.550000 105.000000) (width 0.4) (layer F.Cu) (net 1))

If that works collect the output of that script in a file. Under windows the command line for that would be:

> copper_spiral.py >> spiral.txt

Now onto the .kicad_pcb file.
Get something like https://notepad-plus-plus.org/ and open a simple project like with what you got up there.
Navigate to the folder and open the .kicad_pcb file of it. Scroll down to the bottom of that file. Should look something like this:

The red circled area marks where to put the content of spiral.txt. Save the kicad_pcb file and restart kicad.

If that doesn’t work for you I have no idea how to help you further.

3 Likes

Attached is a minimal header needed, for File.Append Board to work, to import the Spiral.
(saves the user file edit steps)
Example has (net 0), if the net number inserted is > 0 & not valid, PcbNew spits an error code.
Normally, you would find the specific design ‘attach-net’ number, then use that in the script.

MinimalSpiralAppend.kicad_pcb (1.7 KB)

2 Likes

Maybe, a mini videotutorial jejeje n.n

Maybe, a mini videotutorial jejeje n.n

Well, it is not my intention to disturb or something like that. I do not want cause extensive repost the question that has already been resolved. I apologize for the misunderstanding is that sincerely to create the spiral that need it slipped from my hands light years.
Perhaps if Joan, or otrousuario friend of charitable soul could create me the zip file so as not to continue taking away your valuable time, you would appreciate forever.
Specifications are
for a circular PCB; = 15.5 mm perimeter
Spiral top thickness (the minimum allowed) 0,2 mm
separation of spiral lines (0.1 mm) or 0,3
number of turns: 8 spirals
sense of turns and direction of a clock (sa the same)
It is also important to start from the outside in
separating the perimeter of the PCB with respect to the first line of the spiral: 0.2 mm or 0,4
Well, thank you very much for all the information they have provided both community and also thank you confidence management forum.
A sketch:

when I get to finish the prototype in approximately 20 days I will send you real images of the physical creation of this thanks to you who are the only ones who can get me out of this mud swamp move that leaves me like water flowing in the rivers. I’m really stuck :frowning:
beforehand an affectionate greeting and again apologize for the time that this entails. thanks infinity

The layout file…
spiral.kicad_pcb (46.5 KB)

The script file to get the layout content for the spiral with your dimensions…
KiCAD_CopperSpiral_v3.py (6.3 KB)

1 Like

Really wonderful, wonderful, sublime! only detalle…voy to try to change the format of the spiral that is not copper (should not be yellow)
I think I should edit the file py right?
You do not know how much I appreciate your dedication and passion for kicad. You’re great !!, you have a good day full of good vibes