MoI discussion forum
MoI discussion forum

Full Version: ChainMaker script bug in Version 5.0 Beta Dec-1-2023

From: bemfarmer
4 Dec 2023   [#1]
I have in recently installed Version 5.0 Beta Dec-1-2-23, and erased last beta.
So I cannot try old beta, unless it is re-installed. It expires soon...

The ChainMaker script, which worked in Version 4, has a bug in the latest beta.

Link1, which may be sweeplist, the object to be flowed, shows up near the origin, and persists, when the checkbox for twisted chain is not checked.

Hitting undo causes the initial Link(1) to rotate 90 degrees-ish.

Doing twisted chain works WITHOUT leaving (Link1) on the screen, but is extremely slow.

Re-doing the ChainMaker script causes MoI to "crash".

I recollect that "wrap with object list" was changed/eliminated...
Since the script was written as an amateur, (with lots of help from Michael), there is something wrong :-)

- Brian
From: bemfarmer
4 Dec 2023   [#2] In reply to [#1]
OK, I reinstalled April 13, 2023 beta.

The same persistence of the base Link occurs, with untwisted chain.
And the rotation.

But Twisted chain does not have a big time lag.

- Brian
From: Michael Gibson
4 Dec 2023   [#3] In reply to [#1]
Hi Brian, where can I get the ChainMaker script that you are having difficulty with?

- Michael
From: bemfarmer
4 Dec 2023   [#4] In reply to [#3]
Hi Michael,

Here is the link to the old post. I just re-downloaded it to test it. l It has the same date. (Ten years ago...)
It has the same (bug) behavior.

https://moi3d.com/forum/index.php?webtag=MOI&msg=6087.67

- Brian

Probably my sloppy bookeeping?, or change in WrapWithObjList, or needs another type of removal...(?)

I think that I will test out some other scripts...
From: bemfarmer
4 Dec 2023   [#5] In reply to [#4]
Same behavior on Home computer.

Now Logitech is trying to mess with my harddrive, no idea why...:-(

- Brian
From: Michael Gibson
4 Dec 2023   [#6] In reply to [#4]
Hi Brian, there is an update to Flow in the Dec-1 v5 beta to make it use a fitting tolerance that is based on the smallest feature of the object being deformed. That's instead of a fitting tolerance relative to the whole source object's bounding box.

That is likely what is making it take longer, but it should also be generating a more accurate end result.

Here's an example - in the attached file if you use Flow on the thin cylinder:


In v4 and the Apr-13 v5 beta you get a result like this with pretty easily seen deviation:


Here with an exact circle on top:


But with the new Dec-1 v5 beta you get this more accurate result:


- Michael

Attachments:
flow_tolerance.3dm

Image Attachments:
Dec_1_flow_tolerance1.jpg  Dec_1_flow_tolerance2.jpg  Dec_1_flow_tolerance3.jpg  Dec_1_flow_tolerance4.jpg 


From: bemfarmer
4 Dec 2023   [#7] In reply to [#6]
Thank you very much Michael, for the cool increase in accuracy!

I'll try some minor code changes tomorrow. Maybe remove WrapWithObjectlist?

- Brian

The spell checker / word suggestion (AI?) is interesting.
From: bemfarmer
5 Dec 2023   [#8]
After 3 hours of study and trial code changes, a little progress has been made, on the residual basic chain single link, and its 90 degree rotation, In MoI V5 beta.
MoI4 does not have this residual problem.

The ChainMaker script is a morass of multiple names for various ChainLinks.
Note that the Twisted chain checkbox does not have any problem with residual links, nor MoI4.

Most of this post deleted.

Time for a break...

- Brian
From: bemfarmer
5 Dec 2023   [#9] In reply to [#8]
There seems to be a problem with using ...factory.getCreatedObjects (???)
e.g. Copy factory or rotateaxisfactory (???). I'll try switch to .calculate (???)

Link2.name = "Link2" works fine. Link2 is not a culprit.

I think that .name does not work with some objectlists(???)

I must be confusing objectlists with geometric objects(???)

- Brian
From: bemfarmer
5 Dec 2023   [#10]
Success.
The ChainMakerV5 script is now working in V5beta.
3 names work.
I'll prepare a cleaned up version, (and try not to destroy the working version).

But it does not work in MoI V4. The first link is not getting formed in V4.

- Brian

About 1 second to do unTwisted chain.
About 2 to 3 seconds to do Twisted chain.

Repetitive Updates can cause MoI to crash...
From: bemfarmer
5 Dec 2023   [#11]
Here is an updated ChainMaker script which works in V5 Beta, Dec1, 2023.
It does not work in V4.

It does not like unchecking the "Rigid" checkbox. MoI might crash.

Rigid unchecked = False, and the links can bend at sharp areas of the rail.

It seems that some "WrapWithObjectList" is still needed.

- Brian

Deleted this version.
See post 16 for "Final" version
From: Death
5 Dec 2023   [#12] In reply to [#11]
Thanks! U da Man!
From: Michael Gibson
5 Dec 2023   [#13] In reply to [#11]
Hi Brian,

re:
> It does not like unchecking the "Rigid" checkbox. MoI might crash.

Did a crash report get generated? If so can you please send it to me at moi@moi3d.com?

Thanks, - Michael
From: bemfarmer
6 Dec 2023   [#14] In reply to [#13]
Hi Michael,

I cannot find a "moi_report___.zip".
Finally located a Temp directory at C:\Users\(my_comp_name\AppData\Local\Temp. But it did not have any zip files.

Clarification of behavior when running ChainMakerV5 in MoI Beta5 Dec1 2023:

Rigid checkbox checked means that Rigid is set to True. The individual chain links maintain their shape. The script is relatively fast, a second or two or three +/-.
When Rigid is unchecked, the individual chain links can be "bent" or have their shape "distorted", when the radius at an area of the rail curve is low, with respect to the chain link size.

For Rigid = True, the speed of the script is faster for shorter, less curved rails.
For Rigid = True, the speed of the script is a little slower for twisted links, than for non-twisted links. (about double +/-?)

For Rigid = False, the speed of the script for non-twisted links, for a half egg ovoid rail with 30 links, is about 5 seconds.

For Rigid = False, the speed of the script for twisted chain, can be very slow, e.g. 50 seconds, for a half egg ovoid rail with 30 links. (10 times longer to form the chain, than for non-twisted links.)
Interrupting MoI by pressing Update again, or Done, or Cancel, causes an hourglass to appear, and eventually a MoI message box "MoI ... is not responding, with option to close the program or wait for MoI to respond. MoI can then be closed, or waiting eventually causes the completion of the change in the chain.

So MoI is not really crashing. MoI just seems to be busy for a LOT longer (10X) when Rigid is False, and chain is to be twisted.

I assume the new fitting math is taking a LOT longer with Rigid False and chain is to be twisted.

Maybe the best solution is to set Rigid to TRUE all the time, in the code. I think that "Stretch" has not been used at all.
Chains usually do not "distort" for normal loads, so Rigid should not be False.

- Brian

I am not sure what the specific change that I made to the script to eliminate the residual offset link and its rotation, versus behavior in MoI V4.

I think that "WrapWithObjectList", (used twice) is still needed for some factories???
I do not know what change was made in MoI 5 to change this need???
I never did try any 3D curves :-)
From: bemfarmer
6 Dec 2023   [#15]
ChainMaker script for MoI V5 Beta Dec1 2023, with Rigid set to true, so chain links maintain their shape, and are not distorted.

- Brian

EDIT: See next post for correction.
From: bemfarmer
6 Dec 2023   [#16]
Thank to 3 corrections by MO_TE, the ChainMakerV5R scripts now works on MoI4 as well as MoI5beta.

Some commands require .item(0) variable suffix.
I did not change the .js and .htm file names this time.
One person may need to download the corrected zip for the corrected version...
I think that I will start to eliminate the usage of _ in front of Scripts.

- Brian

The script even works in MoI3. And very fast.
Add the script to the MoI3 directory in commands folder below Program Files (x86).
Create a Rail curve in MoI3.
Hit Tab, and type in the script name and hit return.
Select the Rail and Update.
Like in the old days before CustomUI...

In MoI V5 Beta, a corrected version with Rigid checkbox, showed the same times as previously reported.
(50 seconds to update to Twisted Link with Rigid unchecked.) This version is not posted.

Attachments:
_ChainMakerV5RMO.zip