generating gear part

This forum is for 'Work-in-Progress' QCAD user developed script Add Ons and Plug-ins.

Please use this forum to request/submit your script Add-Ons & Plug-in idea's.

Moderators: andrew, Husky, J-J

Matfie
Active Member
Posts: 37
Joined: Tue Aug 30, 2016 8:46 am

generating gear part

Post by Matfie » Tue Dec 20, 2016 11:36 am

Hi

I wrote a gear generator script for QCAD. implemented as a part library item

https://github.com/plunky/qcad-gears

So far, generates an Involute Spur gear outline only as a polyline. Can draw an axle hole, and spokes if required.
gear.png
gear.png (106.59 KiB) Viewed 38524 times
gear.dxf
(36.83 KiB) Downloaded 1129 times
for dimensioning the gear, you can specify the Pitch Circle Diameter and the number of teeth (it displays the Module, but you can't specify it that way as yet). You can change the pressure angle too.

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: generating gear part

Post by andrew » Tue Dec 20, 2016 1:42 pm

Excellent! Thanks for sharing this. A very interesting library item and a great example of what can be done with scripted QCAD library items.

Can this script be included in future QCAD packages?

Matfie
Active Member
Posts: 37
Joined: Tue Aug 30, 2016 8:46 am

Re: generating gear part

Post by Matfie » Tue Dec 20, 2016 6:42 pm

Sure, and I will keep working on it for a while too

I want to generate an internal ring gear at least, and also this script does not handle undercutting at all - in fact I don't know how to calculate that as in the real world the hobbing tool just does that automatically but it weakens the gear, and perhaps its better not to handle undercut but to do a profile shift instead to work around the need for it (with some manual calculation this can perhaps be generated already I'm not exactly sure!)

A question; if I want to make a different part using some of the same script, can I have a file of common routines in the directory without it appearing separately in the part list? ie I would have 'Spur' and 'Ring' gear in the parts list, and a common.js file included by both..

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: generating gear part

Post by Husky » Tue Dec 20, 2016 7:56 pm

Hi Matfie - that looks promising .... :D

Right now I'm not sure how to run your script ... :oops:
I created a Gears Folder which contains the InvoluteSpur.js and InvoluteSpur.ui files, restarted QCad and updated the Library. I can now see the InvoluteSpur entry but how to start the script?

Win10/QCad 3.16.2
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

Matfie
Active Member
Posts: 37
Joined: Tue Aug 30, 2016 8:46 am

Re: generating gear part

Post by Matfie » Tue Dec 20, 2016 8:15 pm

just as any other part

I think you can double click on the 'InvoluteSpur' gear icon and it will open the options window (or single click to select it, and click the 'insert object' arrow at the bottom of the library browser window..) if you then move the mouse pointer to the drawing you will see a preview of what you are getting, hovering at the mouse pointer ready to be inserted. You can change the options in the options window and the preview will be redrawn with the new settings

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: generating gear part

Post by Husky » Tue Dec 20, 2016 8:43 pm

Matfie wrote:just as any other part
That is what I thought .... but obviously I'm doing something wrong ....

If I insert it looks like I have nothing on my Mousepointer. The common insert option for Rotation scale etc will pop up but nothing more. If I insert this invisible gear in my drawing I can't see / find it afterwards in the drawing.

And the Symbol looks way different than that in your screenshot ...
Husky-2016.12.20-03.png
Husky-2016.12.20-03.png (20.84 KiB) Viewed 38508 times
Any idea what I'm doing wrong?
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

Matfie
Active Member
Posts: 37
Joined: Tue Aug 30, 2016 8:46 am

Re: generating gear part

Post by Matfie » Tue Dec 20, 2016 8:53 pm

the little yellow triangle means that the script failed to produce an icon, and the lack of anything in the drawing means that the script failed to produce an object to insert

I find that when that happened, there would be an error message on the terminal that I ran qcad on; I don't know how to make those error messages appear on the QCAD console, is that possible?

(btw I'm not on Windows)

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: generating gear part

Post by Husky » Tue Dec 20, 2016 9:07 pm

Thanks for explanation!
Matfie wrote:I don't know how to make those error messages appear on the QCAD console, is that possible?

(btw I'm not on Windows)
I'm afraid I'm the wrong person to be ask - I'm only a QCad User. Maybe Andrew has an idea (I'm sure he has one!) :D
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: generating gear part

Post by andrew » Wed Dec 21, 2016 9:23 am

Matfie wrote:A question; if I want to make a different part using some of the same script, can I have a file of common routines in the directory without it appearing separately in the part list? ie I would have 'Spur' and 'Ring' gear in the parts list, and a common.js file included by both..
Yes, including a shared script should work just fine (i.e. include("common.js")). You can include any JS file on disk. To keep things simple, I would recommend to put the shared script into the same directory as the library items.

Matfie
Active Member
Posts: 37
Joined: Tue Aug 30, 2016 8:46 am

Re: generating gear part

Post by Matfie » Wed Dec 21, 2016 10:32 am

I created such a file with a couple of functions, but it shows up in the library browser as a non useable part.. is there a way to prevent that?
dump.png
dump.png (18.01 KiB) Viewed 38486 times
Hm ok, if I use a different extension eg 'common.ecma' then it doesn't show up.. would that be the best way?

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: generating gear part

Post by andrew » Wed Dec 21, 2016 10:45 am

Matfie wrote:I created such a file with a couple of functions, but it shows up in the library browser as a non useable part.. is there a way to prevent that?
Ouch.. didn't think of that.

An alternative extension would be a way around that for now. An alternative might be to put it into a sub-directory called "_META". The _META directories are currently used by the library browser to store meta information that applies to all items in a directory. It's a slight abuse of that directory, but one I could live with. I'll leave it up to you. This can be changed quite effortlessly if needed in the future.

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: generating gear part

Post by Husky » Sat Dec 31, 2016 6:04 pm

Hi,

the Changelog to 3.16.3 is mentioning this gear tool - but I assume I have to wait a little bit longer to see it working in Windows, I'm right?

3.16.3 (2016/12/28)
Part Library Browser:
Add gear generator item (default > Mechanics > Gears > InvoluteSpur)
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

User avatar
J-J
Moderator
Posts: 502
Joined: Tue Mar 24, 2009 9:48 pm

Re: generating gear part

Post by J-J » Sat Dec 31, 2016 6:26 pm

Hi Husky
I tried the tool and I do get a gear, you have to adjust the parameters before clicking where you want to insert it. I'm on Win7-64
JJ Win7 pro-64

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: generating gear part

Post by Husky » Sat Dec 31, 2016 7:21 pm

Hi J-J - thanks for the info!

Uuuuuuuuuuuuuuuuuuuuuuuups .... my fault! Dirt on me a whole shovel!!!!

I haven't recognized that I'm trying to work with the not working Gear Library item which is (was!) still on my OS for testing.
Thanks for waking me up and a happy new year!

P.s.: I hope that was my last 2016 mistake .... e_confused
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

User avatar
Husky
Moderator/Drawing Help/Testing
Posts: 4931
Joined: Wed May 11, 2011 9:25 am
Location: USA

Re: generating gear part

Post by Husky » Sat Dec 31, 2016 7:29 pm

J-J wrote:Hi Husky
I tried the tool and I do get a gear ...
Is there right now a possibility to create two gears related to each other with a ratio e.g. 4:1?
Work smart, not hard: QCad Pro
Win10/64, QcadPro, QcadCam version: Current.
If a thread is considered as "solved" please change the title of the first post to "[solved] Title..."

Post Reply

Return to “QCAD 'Script Add-On & Plug-in challenge' - Work in Progress”