News:

The purpose of these forums is to discuss TurboCAD.  Please keep the discussion of other products to compatibility issues or how the other software can be used with TurboCAD.

Main Menu
TurboCAD 2026 Platinum box
Now available

TurboCAD 2026.2

The latest update for TurboCAD 2026. It installs over any 2026 build and keeps your activation, drawings and settings. Get it from the Start Page or Help > Check for Update.

TurboCAD MacroRecorder

Started by Alvin Gregorio, April 06, 2024, 07:54:05 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Alvin Gregorio

Just a curiosity question.

Why is it when?:
>I MacroRecord a simple operation.  Stop.
>Then in drawing space, Undo the operation (Undo unrecorded).
>Then in MacroRecorder, while just the text from that operation is in the body of MacroRecorder,
>Play Script

Nothing inserts ?  All I get is an Error Message stating something such as attached.


Start "Insert|3DObject|Box3Vertices"
On Error Resume Next
ActiveDrawing.Styles("Normal Cube").Activate
if Err.Number <> 0 then
 MsgBox Err.Description,,"Playback error"
End If
On Error GoTo 0
 ShiftDown 16
 ShiftUp 17
 ShiftDown 16
 ShiftUp 16
 Drag xOrigin + 204.6078705657324122, yOrigin + 199.6459137780539095, zOrigin + 0.0000000000000000, 0
 Click xOrigin + 0.0000000000000000, yOrigin + 0.0000000000000000, zOrigin + 0.0000000000000000, 1
 Drag xOrigin + 204.6078705657324122, yOrigin + 199.6459137780539095, zOrigin + 0.0000000000000000, 0
 ChangeEditField 1, "1"
 Drag xOrigin + 204.6078705657324122, yOrigin + 199.6459137780539095, zOrigin + 0.0000000000000000, 0
 ChangeEditField 1, "10"
 Drag xOrigin + 204.6078705657324122, yOrigin + 199.6459137780539095, zOrigin + 0.0000000000000000, 0
 ChangeEditField 2, "1"
 Drag xOrigin + 204.6078705657324122, yOrigin + 199.6459137780539095, zOrigin + 0.0000000000000000, 0
 ChangeEditField 2, "10"
 Drag xOrigin + 204.6078705657324122, yOrigin + 199.6459137780539095, zOrigin + 0.0000000000000000, 0
 ChangeEditField 3, "1"
 Drag xOrigin + 204.6078705657324122, yOrigin + 199.6459137780539095, zOrigin + 0.0000000000000000, 0
 ChangeEditField 3, "10"
 EnterKey
Dim gxVw
Set gxVw = ActiveDrawing.ActiveView
if (gxVw.SpaceMode = 1) then
 gxVw.Update = false
 gxVw.ViewLeft = xOrigin + -57.3173023701045778
 gxVw.ViewWidth = yOrigin + 29.7817909978235171
 gxVw.ViewTop = zOrigin + -174.5669690023467524
 gxVw.ViewHeight = 16.6565302509255844
 gxVw.Update = true
End If

 Properties("$SNAPMODE") = "4128"
 Drag xOrigin + 4.5163651057806717, yOrigin + 0.0338264615182255, zOrigin + 0.0000000000000000, 0
 Click xOrigin + 5.0000000000000089, yOrigin + 0.0000000000000060, zOrigin + -0.0000000000000067, 1
 Properties("$SNAPMODE") = "-1040183271"
Set gxVw = ActiveDrawing.ActiveView
if (gxVw.SpaceMode = 1) then
 gxVw.Update = false
 gxVw.ViewLeft = xOrigin + -15.4576982390432605
 gxVw.ViewWidth = yOrigin + 31.1706689723535817
 gxVw.ViewTop = zOrigin + 8.0891100487433096
 gxVw.ViewHeight = 17.4333098609663182
 gxVw.Update = true
End If

Set gxVw = ActiveDrawing.ActiveView
if (gxVw.SpaceMode = 1) then
 gxVw.Update = false
 gxVw.ViewLeft = xOrigin + -18.7024013834121483
 gxVw.ViewWidth = yOrigin + 37.4048027668242966
 gxVw.ViewTop = zOrigin + 10.4711182983556395
 gxVw.ViewHeight = 20.9199718331596003
 gxVw.Update = true
End If

Set gxVw = ActiveDrawing.ActiveView
if (gxVw.SpaceMode = 1) then
 gxVw.Update = false
 gxVw.ViewLeft = xOrigin + -22.4428816600945815
 gxVw.ViewWidth = yOrigin + 44.8857633201891630
 gxVw.ViewTop = zOrigin + 12.5653419580267602
 gxVw.ViewHeight = 25.1039661997915111
 gxVw.Update = true
End If

 Drag xOrigin + 17.3583129725957477, yOrigin + 15.1827834640651638, zOrigin + -0.0000000000000067, 0
 Click xOrigin + 17.3583129725957477, yOrigin + 15.1827834640651638, zOrigin + -0.0000000000000067, 1
Set gxVw = ActiveDrawing.ActiveView
if (gxVw.SpaceMode = 1) then
 gxVw.Update = false
 gxVw.ViewLeft = xOrigin + -20.3475051422603812
 gxVw.ViewWidth = yOrigin + 46.9790171493472499
 gxVw.ViewTop = zOrigin + 24.0221441865526195
 gxVw.ViewHeight = 26.2746931628134988
 gxVw.Update = true
End If

Set gxVw = ActiveDrawing.ActiveView
if (gxVw.SpaceMode = 1) then
 gxVw.Update = false
 gxVw.ViewLeft = xOrigin + -24.3164935547378889
 gxVw.ViewWidth = yOrigin + 49.1698901626111819
 gxVw.ViewTop = zOrigin + 13.2298837377481409
 gxVw.ViewHeight = 27.5000171409461132
 gxVw.Update = true
End If

Set gxVw = ActiveDrawing.ActiveView
if (gxVw.SpaceMode = 1) then
 gxVw.Update = false
 gxVw.ViewLeft = xOrigin + -29.5019340975666999
 gxVw.ViewWidth = yOrigin + 59.0038681951333999
 gxVw.ViewTop = zOrigin + 16.5175709596257398
 gxVw.ViewHeight = 33.0000205691353301
 gxVw.Update = true
End If

Set gxVw = ActiveDrawing.ActiveView
if (gxVw.SpaceMode = 1) then
 gxVw.Update = false
 gxVw.ViewLeft = xOrigin + -30.8777609065434397
 gxVw.ViewWidth = yOrigin + 61.7555218130868795
 gxVw.ViewTop = zOrigin + 17.2905633742293396
 gxVw.ViewHeight = 34.5389811283192998
 gxVw.Update = true
End If

 Drag xOrigin + 17.3583129725957477, yOrigin + 15.1827834640651638, zOrigin + 17.6987602205371353, 0
 Click xOrigin + 17.3583129725957477, yOrigin + 15.1827834640651638, zOrigin + 17.6987602205371353, 1
 Start "Modify|3DBoolean|BooleanOperationAdd"
 Drag xOrigin + 2.4651449161756531, yOrigin + 12.7452402321487561, zOrigin + 0.0000000000000000, 0
 Click xOrigin + 2.4651449161756531, yOrigin + 12.7452402321487561, zOrigin + 0.0000000000000000, 1
 Drag xOrigin + 22.7780408208234277, yOrigin + 28.6289788138792254, zOrigin + 0.0000000000000000, 0
 Click xOrigin + 22.7780408208234277, yOrigin + 28.6289788138792254, zOrigin + 0.0000000000000000, 1
gxPlayList.Delete
Set gxPlayList = Nothing
gxSelList.Delete
Set gxSelList = Nothing
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Alvin Gregorio

Here's another one. (.tcr file within the .zip-folder)   With an associated similar Error Message.
This one was just the insertion of a single Line segment.  Clicked at 0,0,0 then randomly clicked at +0,0,0
This time, I kept/Saved the initial 32 text lines that MacroRecorder always initially creates.

Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Andy H

#2
Hmmm  No idea.  Both macros work fine for me in TC2022 (except it does not add the two boxes together in your first one),  I assumed you were using 2022.  If you have purchased 2024. you will need a beta tester.

'Start' is specific to the macro recorder.  From what I know, its like a shortcut telling the macro what operation one wishes to perform.  The recorder should have no problem reading this. 

Although it is based on VBScript, the recorded language has very little written about what everything means.  so when writing macro's people use VBScript, not all the drag / click stuff. 

Alvin Gregorio

Quote from: Andy H on April 06, 2024, 09:31:45 AMHmmm  No idea.  Both macros work fine for me in TC2022,  which is what I assumed you were using. If you have purchased 2024. you will need a beta tester.

'Start' is specific to the macro recorder.  From what I know, its like a shortcut telling the macro what operation one wishes to perform.  The recorder should have no problem reading this. 

Although based on VBScript, the recorded language is in a world of its own, with vey little written about what everything means.

I'm still using v2022 and v2020.
Elected to skip v2023.
Haven't purchased v2024; just happened across that it's available this morning.  Might purchase upgrade to v2024, if I can get a reasonable enough price.
____
So I am creating and trying to run this Macro script in v2022_Platinum.
I would think if the script is recorded/created in a TC version, and it is immediately requested to "Play Script" within that same version, it would work without a hitch.

Maybe I'll fiddle with it some more.  Just to satisfy curiosity.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Andy H

I tried recording a scrip in v2022.  I set record,  drew two boxes, moved them into position, and used 3D add.  Then stopped the recorder, and deleted the objects.  It played back no problem.  drawing and 3D adding the objects. 

Alvin Gregorio

Quote from: Andy H on April 06, 2024, 10:00:27 AMI tried recording a scrip in v2022.  I set record,  drew two boxes, moved them into position, and used 3D add.  Then stopped the recorder, and deleted the objects.  It played back no problem.  drawing and 3D adding the objects. 
Hm.  Peculiar.  Must be something with my installation, on my system.
I don't know that I have ever successfully Played a MacroRecorder script-- in any version.  Maybe it's a setting within something.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Alvin Gregorio

If I record "Mouse Click", the subsequent Play Script does not work.  Error Message, regarding that "Start" text line.
But if I don't record "Mouse Click", the subsequent Play Script works.

Odd though that the two I previously shared here had "Mouse Click" ticked when recorded, and Andy was able to play one or both of them back, but I wasn't.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Andy H

In case it makes any difference,  I should have added that I'm using windows 10.  May need checking by someone else using Windows 11.  In case there is any conflict specific to windows 11.

I just checked, and I have 'Mouse click' ticked.

nikkipollard

#8
I always turn mouse click off
According to help

Mouse Click: The script will include each mouse click, including work in the Inspector Bar, use of the local menu, etc.). A script created with mouse clicks can be used only in TurboCAD. A script that was created without mouse clicks can be used in any TurboCAD add-on, if the add-on is created based on the TurboCAD Object Model.

When you turn mouse click off - The menu stuff(like start) is omitted from the script and it is more like the SDK.
I am surprised that Boolean operations work in the macro recorder. They don't for me.  The script is stopped after the part tree graphic is defined

Do you have the part tree on Andy?
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

#9
I have to have Part Tree (ACIS; Create Editing History) active, to get it to work with the Boolean operation.

Interestingly, the Play Script result doesn't delete the original two Boxes.
So after Play Script, I get two Boxes and a combined Part Tree object.

Note:  The original operations for the MacroRecord were inserting 2 Boxes, then 3D Boolean Add them.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

Andy H

#10
Quote from: nikkipollard on April 06, 2024, 10:31:12 AMDo you have the part tree on Andy?

I tried it with both part tree turned on and turned off.  same result.  Boolean doesn't work for me if Mouse click is turned off. 

## Edit ##  Error on my part.  With part tree turned ON.  the Boolean worked, but also left the original boxes visible, making it look like it didn't work.   So the drawing ends up with the two original boxes, and a third added part tree object.   ## End Edit ##

nikkipollard

Quote from: Alvin Gregorio on April 06, 2024, 10:43:35 AMI have to have Part Tree (ACIS; Create Editing History) active, to get it to work with the Boolean operation.

Interestingly, the Play Script result doesn't delete the original two Boxes.
So after Play Script, I get two Boxes and a combined Part Tree object.

Note:  The original operations for the MacroRecord were inserting 2 Boxes, then 3D Boolean Add them.
That is what I am getting as well which made me think it wasn't working.
Easy remedy
draw the boxes before starting to record the macro.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

nikkipollard

Interesting to note.  In TC2021 recording a boolean subtract - I get a boolean Union when playing it back.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Alvin Gregorio

So weird.
Without "Mouse Click" and with "Mouse Click", the recorded scripts are substantially different.

Oh well... I'll just let it remain a mystery to me.  I need to get outside and move.


You cannot view this attachment.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

They are different because, with the mouse clicks on it records the menu.
Without the options on it doesn't use the shortcuts built into the macro recorder.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Dean

Quote from: nikkipollard on April 06, 2024, 11:32:22 AMInteresting to note.  In TC2021 recording a boolean subtract - I get a boolean Union when playing it back.

Nikki, try using TC Surface objects...
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

Alvin Gregorio

Quote from: nikkipollard on April 06, 2024, 09:59:19 PMThey are different because, with the mouse clicks on it records the menu.
Without the options on it doesn't use the shortcuts built into the macro recorder.
It almost seems to a scripting neophyte like me that TurboCAD MacroRecorder had the recording results of Mouse_Tick=True and Mouse_Tick=False backwards.
Alvin Gregorio
TurboCAD: v2024_Plat (31.0.77.1); v2022_Plat; v2020_Plat; v2019_DL; v20.2_PP
Lenovo Thinkpad P20Y laptop; Windows 11 Pro; i7-11800H 2.30GHz, 8-core; 32GB RAM; NVIDIA T1200
3D_Printer: Ender-3 S1 (NOT Pro)

nikkipollard

#17
Quote from: Dean on April 07, 2024, 07:59:26 AM
Quote from: nikkipollard on April 06, 2024, 11:32:22 AMInteresting to note.  In TC2021 recording a boolean subtract - I get a boolean Union when playing it back.

Nikki, try using TC Surface objects...
I am using 2021 - If I record a Boolean operation on a Surface with mouse click off - TC crashes.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h

Dean

Quote from: nikkipollard on April 07, 2024, 09:19:27 PM
Quote from: Dean on April 07, 2024, 07:59:26 AM
Quote from: nikkipollard on April 06, 2024, 11:32:22 AMInteresting to note.  In TC2021 recording a boolean subtract - I get a boolean Union when playing it back.

Nikki, try using TC Surface objects...
I am using 2021 - If I record a Boolean operation on a Surface with mouse click off - TC crashes.


Try the attached...
Open a new drawing from scratch.The object is 12x12x9 in whatever units your drawing from scratch is...
Just to make it easy, draw an object 12x12x12 go to SW iso view then delete the object.
load the macro then run it.
:) Be patient at the end,it might take a minute or two to finish.
I used a boolean subtract and add.
"What do I know, I'm still learning".
Lenovo Legion T5  Intel(R) Core(TM) i7-14th Gen 20 cores Nvidia RTX 4070 Super 16GB Windows 11 home TurboCad 2025 with Animation Lab 6.0

nikkipollard

Quote from: Dean on April 08, 2024, 03:47:52 AM
Quote from: nikkipollard on April 07, 2024, 09:19:27 PM
Quote from: Dean on April 07, 2024, 07:59:26 AM
Quote from: nikkipollard on April 06, 2024, 11:32:22 AMInteresting to note.  In TC2021 recording a boolean subtract - I get a boolean Union when playing it back.

Nikki, try using TC Surface objects...
I am using 2021 - If I record a Boolean operation on a Surface with mouse click off - TC crashes.


Try the attached...
Open a new drawing from scratch.The object is 12x12x9 in whatever units your drawing from scratch is...
Just to make it easy, draw an object 12x12x12 go to SW iso view then delete the object.
load the macro then run it.
:) Be patient at the end,it might take a minute or two to finish.
I used a boolean subtract and add.
Thanks Dean, that worked.
Maybe the crashes have nothing to do with the macro recorder and I the built in folder.
Nikki
TC20 platinum, TC 2015 platinum
TC 2017 with lightworks
TC 2021 platinum
Windows 11 Home 22h