Notifications
Clear all

[Solved] Blender automation

11 Posts
3 Users
0 Likes
3,887 Views
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

Yesterday I created this wheel with chunky tyres.

chunkytyre

Using the boolean modifier I combined a cylinder with a torus. To make the tread I made up two cutting tools. The cutting of the transverse pieces was quite repetitive. Rotate the wheel though 15° then use modifier/boolean/apply and repeat another 23 times.

I was wondering if this process could be automated/scripted. Despite having no Applescript library, my guess is that I could pass the necessary keystrokes with Applescript to rotate the wheel but the rest is achieved with mouse clicks.


   
Quote
Topic Tags
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @pugwash

I was wondering if this process could be automated/scripted.

One quick way to do it would be to make an circular array of the parts you want to subtract from the tire, and then just subtract them all at once.  That would only be 2 steps instead of 23 steps. 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@robo-pi

Thanks but I found out how to do it with the script. By isolating the rotate command (I have left out the modifier), and packing it into a while loop like this:

import bpy
count = 0

while count < 24:
bpy.ops.transform.rotate(value=0.261799, orient_axis='X', orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
count += 1

This just rotates the object through 0.261799 radians 24 times.

Applescript, I was really barking up the wrong tree ? 

 

How many more times am I going to edit this post!  Grrrrrh!


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@robo-pi

Do you know what is really cool about this discovery?

Imagine you are modelling a gear with dozens of teeth!

Manually, I guess that 100 teeth would probably take about an hour, with this technique a couple on minutes.


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @pugwash

Manually, I guess that 100 teeth would probably take about an hour, with this technique a couple on minutes.

Blender already has features built into it to do all these things.  But yes, you can also program your own scripts if you like.  It's a very flexible software to be sure.

 

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@pugwash

Posted by: @pugwash

Imagine you are modelling a gear with dozens of teeth!

Manually, I guess that 100 teeth would probably take about an hour, with this technique a couple on minutes.

No, not really... Blender has an addon for creating gears very easily, but even if you want to create a specialised gear that the addon cannot create, it's simple enough to use an Array Modifier and would take but seconds.


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@robo-pi, @frogandtoad

Thank you both for your wise words. Considering that I thought that Blender was too overwhelming three weeks ago and in a chat with Bill, who told me that he had looked into Blender, but dropped the idea, I am nevertheless quite chuffed when I discover something new.

Blender has an addon for creating gears very easily

I am sure it has but I haven't specifically looked into it, I was merely using it as an example.

Array Modifier

This is obviously something I will look into very soon. Thanks for the suggestion!

Bill reminded me in a PM, that takes 10000 hours to become an expert, so working on 2 hours a day, 5 days a week, I probably don't have enough days left on this planet. ? 

I obviously can't hold a candle up to you guys, so I guess I should shut up! But you're out of luck, I am not going to! ? ? ? ? ? 

As @robo-pi puts it: "So much to play with and not enough time!"


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @frogandtoad

Blender has an addon for creating gears very easily

Those add-on gears are just "Fake Gears".   By that I mean they are only good for visual art, but not if you want to use the drawings for making actual gears.  There are YouTube videos that explain how to make actual gears.  You could use the fake gears if you are making really crude gears that will only be turned by hand and precision is not required.  But if you're going to make gears for motors, don't use the Blender gear add-on to make them.  Seek out better instructions for making real gears.

Posted by: @pugwash

Bill reminded me in a PM, that takes 10000 hours to become an expert

It may even take much longer than that if you're going to get into animations and movie making.   You could devote a lifetime to trying to make a single movie. ? 

Keep in mind that most blender movies are made by teams of people who have a lot of experience using Blender.   And when a single individual does it, that's most likely all they do.  They dedicate all their time to create their artwork.

I'm no expert at using Blender to be sure.  In fact, I only just started with it myself.  But I do have a lot of 3D CAD experience under my belt from using other 3D CAD programs.   I'm not planning on creating any animations.  I might dabble in that on a very rudimentary level some day.  But that's not likely to become my focus.  I'm too busy trying to build a robot. ? 

So I just want Blender as a 3D CAD utility.  If I ever do make animations they will most likely be animations of my own robot as I build it.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@pugwash

Indeed, it looks daunting at first, because it is!

But, once you build up the courage to have a bit of a play with it, it becomes very enjoyable, and you can waste a lifetime on it 🙂

 


   
ReplyQuote
(@pugwash)
Sorcerers' Apprentice
Joined: 5 years ago
Posts: 923
Topic starter  

@robo-pi

But I do have a lot of 3D CAD experience under my belt from using other 3D CAD programs.

I have never done anything with CAD in my life, therefore this is ALL completely foreign to me. Unlike writing code, which I usually take as a fore drawn conclusion, that it will work. My tentative steps with Blender bring back the feeling of excitement of an eight year old. A rare feeling at 64.

This "Gosh, it can do that!" feeling.

Putting my adolescent raptures aside, I need your support. I have asked Bill in the "Questions and Suggestions" section for a sub-section on 3D Modelling separate from 3D Printing and Printers subsection. You did mention in one of the other threads about a subsection for Blender, but I thought that was too narrow, my thoughts were to include other CAD systems!

I recently requested Bill to add C++ and Python subsections, drawing a line between hardware and software issues, to which he obliged. Although I did make a similar request six months ago.

@frogandtoad and @zeferby have both indicated support for this idea and if I get enough backing, I will PM Bill with a direct request, in case he has overlooked it!

 


   
ReplyQuote
Robo Pi
(@robo-pi)
Robotics Engineer
Joined: 5 years ago
Posts: 1669
 
Posted by: @pugwash

Putting my adolescent raptures aside, I need your support. I have asked Bill in the "Questions and Suggestions" section for a sub-section on 3D Modelling separate from 3D Printing and Printers subsection. You did mention in one of the other threads about a subsection for Blender, but I thought that was too narrow, my thoughts were to include other CAD systems!

Sure, I'll support a request for a generalized CAD section.   That would be cool.

Dear Billy Guru
may we please have a section
where will can post our drawings
with passionate affection

We'll post our lines
and 2d boxes
and 3d shapes to boot

And share our skills
with other foxes
till everyone's astute

We'll draw our robots
in 3D space
with panoramic glory

And post our art
with subtle grace
in this brand new category.

DroneBot Workshop Robotics Engineer
James


   
ReplyQuote