Array with python for double component

Array with python for double component

traiduong014969
Collaborator Collaborator
664 Views
6 Replies
Message 1 of 7

Array with python for double component

traiduong014969
Collaborator
Collaborator

Hi guy,

Recenly, Im trying create a plastic flange. In this have two componet I need make with array feature.

This is number 1 and 2. You can see snapshot below. Howerver, both number 1 and 2 in the same place or  created  unequal angle

Here is piecs of code to make them. Somone can help me fix that.

Thank you !

 

traiduong014969_0-1669728689480.png

traiduong014969_1-1669728804863.png

traiduong014969_2-1669729271318.png

 phi1=360/N
    FirstAngle1= phi1/2
    InAngle1= FirstAngle1

    phi2=360/N
    FirstAngle2= phi2/4
    InAngle2= FirstAngle2
    No = 0  
    while (No<N😞

        number1 =  CYLINDER(s, R=D2/2, H=T, O=0.0).rotateY(90).translate((0,D1/2,0)).rotateX(InAngle1)
        number2 =  CYLINDER(s, R=D2/2, H=T, O=0.0).rotateY(90).translate((0,D1/2,0)).rotateX(InAngle2)
        InAngle= InAngle+ phi
        InAngle2= InAngle2+ phi2
        No= No+1

 

 

 

0 Likes
Accepted solutions (1)
665 Views
6 Replies
Replies (6)
Message 2 of 7

matt.worland
Advisor
Advisor
It looks like your FirstAngle1 = 36, but should be 90 - 36 = 54
Keep playing with the FirstAngles until you get them in the correct start position.
If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
0 Likes
Message 3 of 7

traiduong014969
Collaborator
Collaborator

Thank for your answer. I have just test with your formular. Howerver,  it seems the angle dont follow any rules. You can see snapshot that i test with N=3, N=5,  N=6

traiduong014969_0-1669741358509.png

 

 

0 Likes
Message 4 of 7

matt.worland
Advisor
Advisor

Your cylinders look correct, change the brace FirstAngle to 90

If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
0 Likes
Message 5 of 7

traiduong014969
Collaborator
Collaborator

I attach file to test. please help me fix that. I trying replace some fomular, but Its not work

0 Likes
Message 6 of 7

matt.worland
Advisor
Advisor
Accepted solution

The attached should be working.

If my reply was helpful, please give a "Thumbs Up" or "Accept as Solution"
0 Likes
Message 7 of 7

traiduong014969
Collaborator
Collaborator

Thank you @matt.worland  to spent time to help me. I have just check your code and it worked fine now.

0 Likes