TurboCAD Forums

Turbo Talk => Tips and Tricks => Topic started by: Andy H on April 20, 2017, 10:19:12 AM

Title: Macro Palette
Post by: Andy H on April 20, 2017, 10:19:12 AM
No idea if anyone uses the Macro Palette, anyway, I needed to  create lots of concentric circles, I couldn't decide the best tool to use so used the macro recorded to record a single alteration as seen below.
Start "Edit|Select"
      Drag xOrigin + 1268.5349766673933000, yOrigin + 241.8858788353384500, zOrigin + 0.0000000000000000, 0
      ChangeEditField 4, "3mm"
      Drag xOrigin + 1268.5349766673933000, yOrigin + 241.8858788353384500, zOrigin + 0.0000000000000000, 0
      ChangeEditField 4, "31mm"
      Drag xOrigin + 1268.5349766673933000, yOrigin + 241.8858788353384500, zOrigin + 0.0000000000000000, 0
      ChangeEditField 5, "3mm"
      Drag xOrigin + 1268.5349766673933000, yOrigin + 241.8858788353384500, zOrigin + 0.0000000000000000, 0
      ChangeEditField 5, "31mm"

Then with a slight modification to the code
 
For I = 31 to 181 step 2
temp = I & " mm"
   Start "Edit|Select"
      Drag xOrigin + 1226.7351720312176000, yOrigin + 195.9666514229270400, zOrigin + 0.0000000000000000, 0
      ChangeEditField 4, temp
      Drag xOrigin + 1226.7351720312176000, yOrigin + 195.9666514229270400, zOrigin + 0.0000000000000000, 0
      ChangeEditField 5, temp
      EnterKey
Next

Selected object, turned on the make copy tool, ran the macro and got all the circles (75 of them)

Just posting in case any new users are unaware of the Macro Recorder
Title: Re: Macro Palette
Post by: Jeffin90620 on April 22, 2017, 02:55:16 AM
That is interesting information.

Thank you.


Jeff

Title: Re: Macro Palette
Post by: Henry Hubich on April 29, 2017, 06:32:24 PM
Not having done any serious coding since the days of C++ under DOS, may I ask a couple of naive questions, Andy...?

1. What is the significance of the digit that immediately follows "ChangeEditField"? In some of the code it's "4" and sometimes it's "5."

2. What does "EnterKey" do?

Henry H
Title: Re: Macro Palette
Post by: Andy H on April 30, 2017, 04:58:00 AM
Hi Henry.

1).  The figure after ChangeEditField is the inspection bar field, for example 1 = Scale x, 4 = Size x, etc.  the macro palette can be odd though, using it to record something means one cannot write a macro for distribution (unlike when it was vba), in that if someone didn't have the Scale boxes ticked in the selector properties, it would mean Size x would then be 1 not 4.

2). The EnterKey is the keyboard Enter or Return key press.

For me, the macro recorder is a bit limiting as there is no specific documentation as to how it works, but it can be useful for replicating some tasks, in a similar way the Transform recorder works.   
Title: Re: Macro Palette
Post by: Henry Hubich on April 30, 2017, 09:31:34 AM
Thanks, Andy.

Henry H