The script for chain
 1-7  8-27  28-47  48-67  68-80

Previous
Next
 From:  bemfarmer
6087.48 In reply to 6087.47 
Thank you again Michael.

I started a text file of a bunch of your script explanations. It is good for review and recollection.

There is no way I would ever have figured it out!

Installed the changes, and Flow does work! It took about 3.5 seconds.

Some tentative observations:
The first two links are missing...I think.
I think end selection of the target curve selection is not working either.

I think there is some cleanup to do on the script also.
Undo leaves link2 persisting...

More work to do tomorrow.

:-)

-Brian

EDITED: 19 Aug 2013 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
6087.49 In reply to 6087.48 
Hi Brian, yeah really the whole current system is tuned more for a combination of some script more for "control flow" plus some C++ backend that does the actual geometry creation. It's not really specifically tuned for someone who's doing all script for everything as you've been doing.

I had been originally hoping that just one "factory" mechanism would work for everything but I think it's getting fairly clear that it would be better for larger scripts to have their own methods to call like createLine( start, end ) and stuff like that rather than running everything through the factory mechanism. The factory mechanism has some complexity to it since it's tuned for generating each thing in an interactive way like how the line command runs rather than just creating a specific line for example.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.50 In reply to 6087.49 
Good morning Michael.
Thank you again for all of your help with this scripting.
Your MoI interactive programming is top knotch. To me the interactive programming seems
that it must have been ten times harder to do and understand than doing these bulk scripts, which work pretty well,
once the inputs are figured out.


Last night, I tried to attach or append link1 and link2 to the array chainobj, but was unable to do it properly, so this morning
I moved the flow base line over to the right by 2 links, to get around the array "leaving out" link1 and link2, and now the
flow works properly, starting from the start of the target curve.

The flow takes about 3 seconds for a 15 link chain, which is normal.

Have not done a twisted chainlink option yet. Undo leaves a link2 residue.
Need to clean up the script a bit also. Factories are not needed.

Note that this script does not adjust the chain length, nor the link length, to match the endpoint. So there is
"left over" chain link portion at the end.

Edit: Hmm, Rigid is not working...

- Brian

EDITED: 19 Aug 2013 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
6087.51 In reply to 6087.50 
Hi Brian, re: rigid not working -

The factory is expecting a boolean true/false property for that parameter, not a string, so change:

factory.setInput( 5, 'rigid' );

to instead be:

factory.setInput( 5, true );


If you see in the UI that it's using a checkbox control hooked into the property, that's going to give a true/false value out of it.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.52 In reply to 6087.51 
:-)
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.53 In reply to 6087.51 
Added checkboxes for Twist chain and Rigid chain.

Having a faulty input #5 for Flow, incorrect string instead of the proper true/false variable Rigid,
resulted in the very slow Flow timing!!
Now Flow take less than one second, instead of 3.5 seconds.

After Link1 and Link2 no longer needed for future factories, removed them from the geometry.

Need to do cleanup of removing the factory results, in the event the cancel button is pressed.

Need to do a Twisted link.

- Brian

EDITED: 7 Jul 2014 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
6087.54 In reply to 6087.53 
I like the fact that you left the option to remove rigid. It allows you to make a "chainlike" form, which is cool too.
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.55 In reply to 6087.54 
Thank you BurrMan.
The script still needs more work.
The checkboxes are hard to access. Several factory (s) need to be canceled or cleared out...
Have to check Michaels scripts to do this properly...

Flowing a chain around a rectangle is so-so in rigid mode, and makes weird corners in non-rigid mode.
Small radii curves cause chain overlap in rigid mode, and curved links in non-rigid mode.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  BurrMan
6087.56 In reply to 6087.55 
The chain needs to be made in Rigid mode, and any small kinks will just have to be manaually manipulated. I dont think there will be anything you could do about that without extensive development.

The non rigid is good for that. We bent links all the time on heavy lifts, though "not recommended"... :o
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.57 
Took another look at LineWeb script, and Pipe2 script, which both use several factory(s).
(The plural of factory denoted with (s), because "factories" is used as an array in some scripts.)

LineWeb deals with points and objects made from points, and factories which are arrays.

Pipe2 has PushButton Update which I'll try to add to the chain script, including removing objects appropriately.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.58 
Hi Michael

I am having trouble removing three things from the geometryDatabase, in order to prevent the creation of multiple copies of chains.

The first one is chainobj, which is an input to the FLOW factory.

The second one is baselineobj, whose first item is baseline, an input to the FLOW factory. (I haven't tried removing baseline from the geometryDatabase.)

The third one is flowedchainobj, which is the output of the chain factory.

My current theory is that asynchronous FLOW factory is interfering with the removal from the geometry Database.

For example the command: moi.geometryDatabase.removeObjects( chainobj ); placed before FLOW, does remove the arrayed chain from the screen.
However, placing it after FLOW does not appear to have any removal effect, and multiple chains can be created on top of each other by repeated updates.

FLOW commit does not seem to help.

Any Ideas?

Thankyou
- Brian

EDITED: 22 Aug 2013 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
6087.59 In reply to 6087.58 
Hi Brian, you probably want to avoid calling .commit() on the various in-between factories. For a regular command, factory.commit() signals to the factory that the command has completely finished and the factory is completely done, once you call .commit() any further call to .cancel() won't do anything. Basically .commit() and .cancel() are mutually exclusive to one another.

Also any factory that has been created during a command goes on the "active factory list", and if the command ends without .commit() ever getting called, it will get automatically canceled during the command end cleanup processing. Either a .commit() or a .cancel() will pull that factory off of the active factory list, since it's considered to be completed after either of those calls.

So anyway probably if you just don't call .commit() for the things you don't want to persist in the geometry database that may cover it.

Otherwise if you do call .commit() you will have to manually remove things you don't want from the geometry database.

If you want to have factories remove the stuff they were showing in response to .update(), you can either call .cancel() on them if you're going to still be running the command (like for parameters changing), or if the command is ending you can actually just not do anything and then .cancel() gets called automatically for any active factory at the command end.

Does that make sense? Let me know if you are still having problems.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.60 In reply to 6087.59 
Thank you Michael
EDIT: Your descriptions ARE helping.


My script is flawed, and also my understanding . The pipe2 script is becoming more understandable, so I am going to adopt
its methods even more. Lineweb is helpful too.

I think I will make some more changes in my script, and even use a javascript array or two, and more subroutines.

I'm starting to think that .calculate() is more user friendly than .getCreatedObjects() ?

EDIT: Making a little progress. I had left out a few important things, and put in a few poor things. :-)

- Brian

EDITED: 22 Aug 2013 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.61 
Thought of the day: Chain links are like "Bones" in an animation program ?

Another thought: script to copy an object, based upon two points, to another location with two points... OK in 2D ?
Maybe ArrayGem does this.

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Michael Gibson
6087.62 In reply to 6087.61 
Hi Brian,

> Another thought: script to copy an object, based upon two points, to another location with two points... OK in 2D ?
> Maybe ArrayGem does this.

Check out Transform > Orient > Line to line - it does that kind of transformation, which is just basically a move from one line's start point to the other line's start point, and then a rotation by the angle between them (and optionally a scale by the difference in length between them too).

It works like this:




ArrayGem is a slightly different, it builds a "base frame" around the starting circle, and then figures out a target frame that is oriented around the surface normal and then does a frame-to-frame transformation which is also really just a move + rotation as well though.

- Michael
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.63 In reply to 6087.62 
Thanks Michael

I'll try it out.

(Still working on the chain script, slowly :-) )

- Brian
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  mattj (MATTJENN)
6087.64 In reply to 6087.63 
Keep up the good work on the chain script, its looking good!!
matt
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.65 
After a lot of failure, trying to delete flowed chain outside of the subroutine, FINALLY
got it to work, using example of spur gear script, by assigning a chainList = Update(...). So simple and hard. :-)
Fixed simple link length, non-Updateable missing code.

Now to work on twist.

- Brian

EDITED: 7 Jul 2014 by BEMFARMER

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  Ditto
6087.66 In reply to 6087.65 
Bravo, bravo, bravo! Hats off for your tenacity, Brian!
  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged

Previous
Next
 From:  bemfarmer
6087.67 
Implemented the option to Twist the individual chain links.

Note that some trial and error, guided by the many helpful explanations of Michael, was necessary in order to discover
that Input "0" of the Twist factory would work with sweeplist, from var sweeplist = sweepfactory.calculate();,
but would not work with link1, from var link1 = sweeplist.item(0);.
Also, it was not necessary, in this case anyway, to add sweeplist to the moi.geometryDatabase with moi.geometryDatabase.addObjects( sweeplist );.

As an alternative test, the rail based upon a rounded rectangle worked well with the Twist factory, and would be another way to Twist the first chain link.
Twisting the rail is not done in the current version of the script.

There are several possibilities for the Twist axis. The one used seemed to look well.

The script worked well on one test 3d curve.


ArrayGem in 3d would need a surface for normal.
Chopping the curve up into points which are equally spaced in space, not necessarily equally spaced along the curve, and then
doing a copy to two points is another possibility, but probably needs normal also, in 3D.

This completes the chain script, for now.

I should probably delete old versions...?

- Brian

  Reply Reply More Options
Post Options
Reply as PM Reply as PM
Print Print
Mark as unread Mark as unread
Relationship Relationship
IP Logged
 

Reply to All Reply to All

 

 
Show messages:  1-7  8-27  28-47  48-67  68-80