How to array object with pyhon script ?

How to array object with pyhon script ?

traiduong014969
Collaborator Collaborator
634 Views
5 Replies
Message 1 of 6

How to array object with pyhon script ?

traiduong014969
Collaborator
Collaborator

Hi all, I am using python to create a custom tank for me, but when I create the leg for tank, I don't know that array the leg of  the tank like as array in autocad. Anyone can help me fix that. 

Many thanks to your help

This is my code. Anyone can help me write some code to complete a tank that have 4 legs.

traiduong014969_0-1634828871568.png

 

0 Likes
635 Views
5 Replies
Replies (5)
Message 2 of 6

rajendra.prajapat
Advisor
Advisor

@traiduong014969 you need to copy the leg line four times in python script and use rotate function.

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).
0 Likes
Message 3 of 6

kepinski
Contributor
Contributor

no, there is no array implementation in p3d python API, but you can use python command "while" e.g.

 

Angle=0

AngleStep=90

 

while Angle==270:

    Z=CYLINDER(*).rotate(Angle).translate(*)

   Angle=Angle+AngleStep

Message 4 of 6

李榕华|Ronghua.LI
Advisor
Advisor

You can use "while" and "for" to implement the ring array function.


李榕华

13489140049@qq.com




0 Likes
Message 5 of 6

kepinski
Contributor
Contributor

When you  take "for" , you have to know how many  loops stops function execution. 

0 Likes
Message 6 of 6

李榕华|Ronghua.LI
Advisor
Advisor

For a fixed number of scenes like this, I prefer "for".


李榕华

13489140049@qq.com




0 Likes