How to use some else's code with yours?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

How to use some else's code with yours?

This post has NOT been accepted by the mailing list yet.
I don't yet own a 3d printer, but have found the absolute need for one.  That said, I've been scouring the internet looking for a user friendly CAD software to begin reworking a THING I found on Thingiverse.  Having tried all the point and click/drag and drop apps I could stomach, I saw some YouTube vids of people designing their thing with code, and still being an Arduino newb of 3 years, I gave this a shot and so far, manically frustrating, but that's just my limited code skills, and after about 3 days of playing around, I was able to formulate a working .scad file that generates an image (and I hope one day a print) exactly as I want/need it which brings me to the point of this topic.  My design is about 99% complete and lacks one key component that I was able to find in this THING.  The servo horn I think it's called.  The female splined hole that receives the servo gear.  In the most recent linked thing, there in the code is language that obviously defines the characteristics of the horn, but it appears that all the variables and modules are so intertwined, that extracting the snippet(s) I need to complete my project appears to be impossible.  Does this mean I have to recreate as best I can the code needed to get my horn in place?  Here is my code in all of it's overly basic glory.

Reply | Threaded
Open this post in threaded view

Re: How to use some else's code with yours?

Hi Skybound,

Firstly, your post is still flagged as "This post has NOT been accepted by the mailing list yet", so nobody gets it unless they look.
You need to subscribe to the mailing list, and CLICK THE LINK in the registration email (check your spam folder).

Re the servo.

1. You need to edit thing-28566 (servo_arm.scad), add line 208

    translate([0, 0, head_heigth]) {
      if (arm_count)                                      //   <--- add this line - just prevents an error message.
        for (i = [0 : arm_count - 1]) {

2. In you code

Add, at top:

    use <servo_arm.scad>  // from Thing:28566    (make sure your file and this are in the same directory)

3. Adjust your models shaft & the above translate of the servo hub to the right position.

Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.” Fight it! time is running out!