The script for chain
 1-5  6-25  26-45  46-65  66-80

Previous
Next
 From:  krass
6087.26 
Wow, I have a deep subject, raised ))
I Hope that will be born something brilliant!
Watch for development, with bated breath ;))
  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.27 In reply to 6087.26 
Assumptions and remarks, some thoughts:

The chain is made up of many links, so that a small change in the length of the chain will only
cause a negligible change to the length of a link.

The chain is hung, or attached, at two end points, so the length of the chain will be two link
diameters, (=d), longer than the calculated pre-flow length. By using modular arithmetic, dividing
the target curve length+2d by the chain length, will give the integer number of links.

If the remainder fraction is less than or equal to one half link, the length shortage will be made up for
by flow causing a stretching of the chain.

If the remainder fraction is greater than one half link, the number of links will be increased by one.
Flow will cause a shrinkage in the chain length.

The calculated number of links will establish the length of the base curve line used by flow.
The formula is _______________.

The formula(s) for the lengths needed by array factory are ______________.

Assuming that the chain is "attached by two nails," for a chain with twisted links the situation is easier.
For a chain with alternating 90degree rotated links, the pre-flow chain could be twisted by 90 degrees,
if the number of links is even.

For a chain with twisted links, what is the "best" twist axis length?

It is assumed that two links are "hinged" at the pre-flow contact point. That they do not slide sideways.

Does Flow cause the links to bend?

It starts getting complicated...

- Brian

EDITED: 10 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.28 In reply to 6087.27 
Flow with stretch and rigid selected looks like it will work fairly well.
The links are not bent, but there is either more overlap, or else spacing, at
the hinge point. Another alternative is to shrink the length of each link a little.
  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.29 In reply to 6087.27 
Hi Brian, I'm afraid I don't know the answers to most of your questions there, other than if Flow will bend the links, which it sounds like you've already figured out that it will by default unless you enable the "rigid" mode. The rigid mode only does a move and rotation of the objects to be flowed instead of fully deforming the shape. It basically just flows one sample point at the center of the object's bounding box. With something that needs to be placed somewhat precisely like the 2 ends of a chain link it may not quite do exactly what you need 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.30 In reply to 6087.29 
Thank you Michael.
I was just throwing the questions and thoughts out there, in case there was any interest, and to make a start
on the scripting procedure.

Rigid Flow looks like it will work well, but the chain link length must first be shrunk or stretched a little bit, so the chain length is correct,
or the links will have a gap, or overlap.

The result may not be perfect, according to physics, but should be fairly close.

Wrote some draft code this morning, simple math and such, but it doesn't work yet. :-)

-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.31 In reply to 6087.29 
- Hi Michael
This chain script is turning out to be harder than I thought, when the ends are constrained.
In real life, (under light loads,) chains do not stretch or bend much, or at all, so the curve would change.

One chain link amounts to two points, a constant distance apart, I'm calling the "innerLength."
So the target curve should be represented as a polyline, with constant length line segments.
(It would be like a low resolution curve, made up of constant line segments.)

Array Dir command places points a constant distance along a curve, but sequential pairs are nearly always different distances in space.

ArrayGem script places the points along a curve, with sequential pairs a constant distance apart, in 2D anyway. (need to check 3D).
But ArrayGem usually does not place a point at the end of the curve, it has "left over" curve distance beyond the last point.

Is it possible to have a version of ArrayGem which has start and end points on the curve, and divides up the distance between points to
the constant spacing?

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:  Michael Gibson
6087.32 In reply to 6087.31 
Hi Brian,

> Is it possible to have a version of ArrayGem which has start and end points on the
> curve, and divides up the distance between points to the constant spacing?

It could be possible in the future at some point, but it would require a pretty significant change to the mechanism that ArrayGem uses to work, currently it uses an iterative solver that is set up to find a spot along a curve at a certain distance away from the previous object.

To do it the way you are describing is not just a small tweak to the mechanism, it means making a new iterative solver that behaves differently from the current one. Those are not really simple things to make work well, it involves quite a bit of testing and tweaking.

- 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.33 In reply to 6087.32 
Thank you Michael :-)

I've still got ideas to try. I may try dividing up the leftover curve of ArrayGem...sounds sort of iterative.
Sounds like a bunch of spheres touching.

Then again, a rigid flow may be good enough for nice drawings. The artist can adjust his spacing...

- 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.34 
Spent a lot of time trying out ArrayGem.
I've concluded that for a 3D curve, ArrayGem requires a matching surface (always or usually).

Flow rigid works well also.

-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:  Michael Gibson
6087.35 In reply to 6087.34 
Hi Brian, yeah ArrayGem needs both a curve and a surface that the curve is on - the surface normal is used to control rotation of the items so that the initial "up" direction of the base circle maps to the surface normal direction.

- 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.36 
Did some more work on the chain script.
Copied link1 to link2 and rotated 90 degrees.
Created Flow baseline. These were fairly easy as they just follow the same pattern as the previous factories.

Currently bogged down with trying to get "Array Dir" factory to work in script.
Not sure if the Array output is a list of multiple chain links or ...?
Still fuzzy on objects versus object lists, and object lists with one object, and how to concatenate
link1 and link2 with .addobject...etc...

Then will have to get the Flow factory to work in script...

- Brian :-)

EDITED: 18 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.37 In reply to 6087.36 
Tried some array permutations this morning, changing the objectlist formation. Array dir script still not working.
Maybe my Mode string is wrong, or the ObjectList is wrong.
Not sure how foreign languages figure in to the Mode string, maybe have to look at CSS or something...?

Are Array Dir, or Flow factories asynchronous?
Is there a list of asynchronous factories?

- Brian

EDITED: 18 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.38 In reply to 6087.36 
Hi Brian,

> Currently bogged down with trying to get "Array Dir" factory to work in script.

Array dir's inputs are like this:

index 0 = object list - objects to be arrayed.
index 1 = integer - number of items to make in the array (the original object is included in this count, so for example num items = 3 will actually make 2 copies).
index 2 = point - base point
index 3 = point - offset point
index 4 = point - extent point
index 5 = string - can be one of: "Offset, Count" or "Extent, Count" or "Offset, Extent"

How the points are interpreted depends on the mode, the most simple mode is "Offset, Count" mode that will be where only the base point and offset point are set and that defines a distance that is used for each generated copy.



> Not sure if the Array output is a list of multiple chain links or ...?

Which method are you using for generatring the output, is it factory.calculate() ? That method always generates an object list for its output. For array dir it will be all the copied objects that were generated.


> Still fuzzy on objects versus object lists, and object lists with one object, and how to
> concatenate link1 and link2 with .addobject...etc...

Yeah the "object list of a single object" can be kind of awkward, that comes into play though when you use some general purpose interface that is set up to be flexible so that it handles both commands that generate one object and also commands that generate multiple objects with a common way of operating. So for example the .calculate() method is like that it always returns an object list with the objects that were generated in it, that way it behaves the same way for all factories instead of returning different things depending on whether the factory made only one object versus a bunch of them.

For concatenating 2 lists together, you need to do something like this

var list1, list2;

...

// Combine list2 into list1
for ( var i = 0; i < list2.length; ++i )
{
var obj = list2.item(i);
list1.addObject( obj );
}

If you need to do this a lot, make a helper function that will do that task for you so you can call your function to do it when you need it.


And one thing to note is that the geometry database is not exactly the same thing as an object list, although the geometry database contains within it a list of objects, it has its own interface for dealing with it and has some additional methods like addObjects() that takes an object list. Currently an object list itself does not have a method that adds another object list to it, it only has an addObject() function.

- 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:  Michael Gibson
6087.39 In reply to 6087.37 
Hi Brian,

> Not sure how foreign languages figure in to the Mode string, maybe have
> to look at CSS or something...?

Localization does not affect the mode string that is passed into code, it only changes the displayed UI part of stuff.

Things like those modes are usually set by a <select> or <moi:select> element, and the options within the select have 2 parts, a "value" property which is always in english and that's what is passed into the acutal code, and then an inner text or a textid (text id for a look up into the current language string table) that controls only what is displayed in the UI when that option is active.

So for example if you want to know what values the array dir command can take, open up ArrayDir.htm and look at the control for <moi:Select id="Mode"> , the value="" properties on the child options there have the different string values that the code will actually recognize.



> Are Array Dir, or Flow factories asynchronous?
> Is there a list of asynchronous factories?

Array dir is not asynchronous. Usually it's the ones that need to do some more in depth calculations that are asynchronous. Here's a quick list of async ones:
ArrayGem, Blend, Booleans, Intersect, Project, Silhouette, Flow, Twist, Extrude, Fillet, Chamfer, Join, Loft, Offset, Shell, Inset, Network , Nsided, Revolve, RailRevolve, Sweep, Text.

- 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.40 In reply to 6087.38 
Thank you Michael.
My problem was with improper list creation of link1 and link2.
Now have array working with offset, extent.
On to Flow factory...
I'll post an update later.
  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.41 In reply to 6087.40 
Latest ChainMaker script.
Array Dir works to array the links on a base line.
Still cannot get Flow to work. One of the inputs must be wrong. It gets to a point were I run out of things to try.

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:  BurrMan
6087.42 In reply to 6087.41 
Hey Bem,
Thats a great result already. Unwrapping the flow curve and leaving it allows to just run a rigid flow with the 2 curves quickly and get a result.

I suppose if you automate the flow it will be complete, but it's already a great command...

Thanks.
  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.43 In reply to 6087.42 
I wonder if you can just get to that point there, Have the end of your command select all solids, then launch the regular flow command? Pick the curves and done.
  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.44 In reply to 6087.43 
So for instance, I just made a copy of the flow command and named it ChainFlow, then I copied the code for ChainMaker js and htm to the top part of the new ChainFlow.

It "looks" like it could work, but both commands are running at the same time.

Is there a "pause here until finished" that could be added? The flow is waiting while chainmaker is running. Once chanmaker is done, it accepts the input curve, but wont pick the target. So they need to be seperated...

Michael,
Can a js call "DoChainMaker();" wait, then call "DoFlow();"? (Or "Function DoChain, FunctionDoFlow) with includes or something like that?
  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.45 In reply to 6087.43 
Thank you Burr :-)
  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-5  6-25  26-45  46-65  66-80