Author Topic: Multi Gears using SETATREF Function and Cell.Result Property  (Read 25266 times)

0 Members and 1 Guest are viewing this topic.

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #15 on: November 26, 2015, 09:01:02 PM »
Thank you for your comments.

Here is a Visio drawing to make involute curve.

A macro makes curve, when you right click on the shape and select a menu "Draw Involute Curve".
This shape has a control. If you move control, the top pf a line will trace on involute curve between -180 deg and +180 deg.

« Last Edit: November 26, 2015, 10:43:19 PM by JuneTheSecond »
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Visio Guy

  • Administrator
  • Hero Member
  • *****
  • Posts: 1737
  • Smart Graphics for Visual People...n' Stuff
    • Visio Guy
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #16 on: November 27, 2015, 05:07:09 AM »
Cool! Reminds me of the old Spiral Maker:
http://www.visguy.com/2006/10/19/spiral-shape-maker/
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Bald Eagle

  • Jr. Member
  • **
  • Posts: 57
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #17 on: November 30, 2015, 08:12:40 PM »
 :)
You have an excellent mastery of the math, how to translate it into code, and how to execute that in VISIO.
I greatly enjoy your creations, Chris' excellent projects on [t]his site, and the work of many other talented people sharing their work.
Thank you again!

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #18 on: December 10, 2015, 07:32:04 PM »
And here is a Visio drawing with macro that draws involute gear.
Best Regards,

Junichi Yoda
http://june.minibird.jp/

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #19 on: December 11, 2015, 07:55:12 PM »
I found a bug in macro.
Here is a revised Visio drawing.

And applied produced gears to existing Visio drawing of gear set.
Here is a Visio drawing and a short video in YouTube.
https://youtu.be/QDayY1P3fZo
« Last Edit: December 11, 2015, 08:08:26 PM by JuneTheSecond »
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Bald Eagle

  • Jr. Member
  • **
  • Posts: 57
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #20 on: December 16, 2015, 05:20:49 PM »
<whistles>
That's some impressive shape-sheet work I see!
June IS crazy - the good kind of crazy!   ;)
It's a joy to watch him exercise his skill and create things of beauty.

For some reason, I don't seem to be able to get the "draw involute curve" macro to work.

I'm running it in VISIO 2007, on Windows 7 if that matters.
Screenshot of error attached.

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #21 on: December 16, 2015, 07:08:37 PM »
I am sorry I forget that Visio2007 or younger has no RELMOVETO cell and RELLINETO cell.
Please remove Rel2AbsRows in Sub DrawInvolute.

Sub DrawInvolute(shp As Visio.Shape)
   
.............................
   
    ActiveWindow.DeselectAll
    For Each tmpShp In tmpCol
        ActiveWindow.Select tmpShp, visSelect
    Next
   
    ActiveWindow.Selection.Join
    Rel2AbsRows
    ActiveWindow.Selection.FitCurve 0#, visSplinePeriodic
    Set tmpShp = ActiveWindow.Selection(1)
    tmpShp.Copy

..................................
   
End Sub
Best Regards,

Junichi Yoda
http://june.minibird.jp/

Bald Eagle

  • Jr. Member
  • **
  • Posts: 57
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #22 on: January 07, 2016, 07:50:47 PM »
Thank you for that,
I hope everyone had a good holiday and vacation time.


I tried to comment out that variable definition, but when I run the macro I get another error, and when I hit debug I get the attached results.   Perhaps I'm doing something wrong or there's more to getting this to run in 2007 than just that one thing.

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #23 on: January 07, 2016, 11:30:59 PM »
Sorry, I forgot that PasteToLocation method is available after Visio 2013.
Please, use Paste method and add 2 lines after like

Code
    'To duplicate involute to same location
    InvoluteShp.Copy
'    ActivePage.PasteToLocation InvoluteShp.Cells("PinX").Result(visInches), InvoluteShp.Cells("PinY").Result(visInches), 0
    ActivePage.Paste
    Set tmpShp = ActiveWindow.Selection(1)
    tmpShp.Cells("PinX").Result(visInches) = InvoluteShp.Cells("PinX").Result(visInches)
    tmpShp.Cells("PinY").Result(visInches) = InvoluteShp.Cells("PinY").Result(visInches)


Best Regards,

Junichi Yoda
http://june.minibird.jp/

Bald Eagle

  • Jr. Member
  • **
  • Posts: 57
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #24 on: January 08, 2016, 12:39:54 PM »
I'm getting there.
I realize code is very difficult to debug when you don't have the luxury of running it on your own computer in the software it's generating the error in, and being able to rapidly follow the string of interrelated errors.
I've had the "joy" of debugging Python code written in an earlier version and then run in a later version.   :|

Currently I seem to be having problems with the DuplicateShapeToSamePlace subroutine.
It looks like you have tmpshp1, tmpShp2, tmpshp, and InvoluteShp as variables, and I'm running into undefined variable errors and a failure to properly call the sub with the required arguments.   

I wish I was more familiar with VISIO's macro language, but right now I'm just hacking and butchering the code.  :)
I did however get it to mostly draw the involute curve(s), although they all look like they got rotated out of tangent.

I'll keep working on it.
Can you tell me how to edit the macro code and then save it, and how to clear the drawing page of the macro-generated involute so that I can save the VSD file and re-run the macro with the new edits?

Thanks!

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #25 on: January 08, 2016, 07:54:37 PM »
Quote
how to edit the macro code and then save it,
I am using VBA editor belonging to Visio.

Quote
How to clear the drawing page of the macro-generated involute
I almost use undo button to delete shape made by macro.
« Last Edit: January 08, 2016, 07:57:59 PM by JuneTheSecond »
Best Regards,

Junichi Yoda
http://june.minibird.jp/

pdeepie

  • Newbie
  • *
  • Posts: 2
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #26 on: July 29, 2016, 07:40:51 AM »
Hi Junichi,

Thank you for generating this tool, I have found it very useful.

Is it possible/easy to modify the VBA code to allow the tooth to be slightly narrower than the space, but the module remains the same. I wanted to use this to design a gear train for a wooden gear clock. It has been suggested that the tooth is about 0.02" to 0.03" smaller and then add that distance back to widen the space.

Many thanks for your feedback.

Pete

JuneTheSecond

  • Hero Member
  • *****
  • Posts: 1027
    • Visio Shapes, Stencils and Sample Drawings
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #27 on: July 29, 2016, 06:26:23 PM »
Is there any document theoretically explaining about the wooden gears you mentioned?
I simply feel that there is no change other than a little delay of angle of rotation.
Best Regards,

Junichi Yoda
http://june.minibird.jp/

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4917
  • Ideas Visio-lized into solutions
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #28 on: July 29, 2016, 06:56:09 PM »
If I had to make a guess, for wood gears, a tight fit might be a problem.  The change requested will loosen the fit, resulting in more backlash.  Otherwise, the teeth might bind and break off.  Just a guess.

Wapperdude
Visio 2019 Pro

pdeepie

  • Newbie
  • *
  • Posts: 2
Re: Multi Gears using SETATREF Function and Cell.Result Property
« Reply #29 on: July 30, 2016, 04:45:47 AM »
Hello

Thank you for your responses.

W is the measurement of the tooth and the space next to it, measured on the curve that defines  the pitch diameter, PD

Tooth width = (w/2) – 0.03”
Tooth space =(w/2) + 0.03"

Wooden gears cannot be as accurate so its sensible to make the tooth narrower than the space to minimise binding of the teeth.

Thank you
Pete