The script for chain
 1-12  13-32  33-52  53-72  73-80

Previous
Next
 From:  Michael Gibson
6087.13 In reply to 6087.12 
Also if you want to streamline the steps you can use the Pipe plug-in to avoid having to draw a circle separately, you can get the Pipe plug-in here:
http://kyticka.webzdarma.cz/3d/moi/#Pipe

- 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:  krass
6087.14 In reply to 6087.12 
Michael, thanks for such a comprehensive and detailed answer, I'm touched!
Of course I don'T "do chains all day" :))
And, nevertheless, I do not think that you here present, script writers, all the day engaged in" gears or thread or the creation of nuts or extruded tubes.

Of course all that I described above, you can do once and forget about it.
Also, as the gear, nut, bolt, spring, hose or something else.

Then why there are scripts? ;))
Or actions in Photoshop? Or macros in other programs? Why all this?
All, all you can do without them, right? ))

PS. This is just my private opinion is not claiming anything more))))
  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.15 In reply to 6087.14 
Hi krass, it would definitely be cool to have a script for it, unfortunately it's more time consuming than what you might think to create those scripts so right now I myself only really have time to do them when they'll help save someone a bunch of time.

In the future at some point I'll probably be able to spend some time just making scripts for fun...

In the meantime if you want to undertake learning how to create those kinds of scripts yourself, I can try to help you along if you get stuck!

If some script like this would save you some significant amount of time beyond just a convenience or "cool" factor, then make sure to let me know that is the reason why you need the script...

- 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:  krass
6087.16 In reply to 6087.15 
Michael, thank you very much, but - I am sure - you and I have enough worries without that and still teach me scripts!
Especially because there is quite keen enthusiasts who may be try to implement my idea.

And I learn skrtptam - I'm afraid nothing will happen.
Not my way, alas.
Very badly in school, so with mathematics and programming is not friends, alas;)) (joke)

And forgive my terrible English, it's Google translator;))
  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.17 
- krass
Here is a quick htm file for a chain_link_maker.
You could process the numbers and feed them into a rounded rectangle factory...

There are several ways to accomplish tasks in MoI. Pipe, array, unwrapcurve, and flow would be very helpful, so you would have
to implement several factories.

I think that I would rather spend my time on other projects. :-)

- Brian
Edit: deleted obsolete file

EDITED: 11 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:  krass
6087.18 In reply to 6087.17 
To bemfarmer:
Thank you so much for your help, I will understand!
And what to do with the file to make it work?
Copy this html-file in the /commands and assign a "hot key"? Or something else?
  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.19 In reply to 6087.18 
- Krass
You would need to write several dozen lines of javascript, to apply the numbers to the appropriate factories.
In the MoiWiki, under scripting, the MoI Javascript API documentation by David Morrill describes the factory inputs.
Opening various existing MoI scripts from the MoI command folder and the forum, in a word processor, studying them,
and modifying them, is one approach. The ToroidalHelix script provides a "pattern."
Since the several rectangle scripts, such as RectCenter and GetRectRoundCorner are designed for interactive use, and
so have extra code, you would need to tease out the portions needed to set up the rectangle factory numbers.
This would create the centerline of the link. Then repeat the process with extracts from the Pipe script, then the array script,
and the Flow script, etc.

Using unwrapcurve on your path curve may provide its length, in order to calculate how many links are needed +/-.

Occasionally an interactive script does not have the "handles" needed to work in a non-interactive script...
I am an amateur programmer, so anything I say may be incorrect. :-)
- 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:  krass
6087.20 In reply to 6087.19 
Brian, thank You all so thoroughly explained.
There is one problem - I'm NOT a programmer )) And nothing will be able to write in either Java code, not with any other. I can only draw, because I am an artist, designer )))
Can I copy and paste it into the desired place in the file script - and then use it in their work. This I can. But write scripts does not work ))
Would be familiar with programming - of course I would be all for a long time had composed. ))
But thanks for the support and advice! ))
  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.21 In reply to 6087.20 
.

EDITED: 11 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.22 
Request for script help.

Here is my latest effort to script a chain.
It is unsuccessful so far.
The sweep goes into endless calculation, trying to sweep a scripted circle over the scripted rounded rectangle.
Based upon the Pipe2 script, it should work, but it uses a scripted rail, not an interactively selected rail.
Is it a problem with the rail? Is the rail a list or an object, with one or multiple parts?

Studied quite a bit Michael's and Martin's posts, asynchronous sweep, .calculate() versus .getCreatedObjects(),
and did a lot of permutations, but the sweep does not work. (Many tries ago I did have a sweep formed when changing the profile radius, but
that version is long gone...)

- Brian

Edit, deleted obsolete chain maker script draft

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.23 In reply to 6087.22 
Hi Brian,

> Is it a problem with the rail? Is the rail a list or an object, with one or multiple parts?

The rail should be an object list, it can be either one rail curve for a one-rail sweep, a list of 2 curves for a 2 rail sweep, or 3 or more curves to do a one-rail sweep on each of them.

The problem is that sweep is an asynchronous factory and it requires an object ID to be set for transferring geometry over into the command processor (async factories are actually generated inside of the moi_commandprocessor.exe process instead of inside of moi.exe). Because your rail has been created through script and never added to the geometry database, it doesn't have an ID yet and so doesn't work with sweep. If you add it to the geometry database it will then work. You'll need to do that for both the circle and the rail as well. (EDIT: see added info below, only add the circle).

So something like call:

moi.geometryDatabase.addObjects( rail ); // addObjects takes an object list
moi.geometryDatabase.addObject( circle );

Before doing the sweep.


EDIT:

Actually it's not the rail that wasn't in there, it was the circle that wasn't in the geometry database. So don't try to add in the rails again or else you'll get an assert.


The rails were already in the geometry database because they were created by .update() and then .getCreatedObjects() - that sequence adds stuff to the geometry database. The circle was created just by .calculate() which just generates an object and does not add it into the geometry database automatically.

So get the circle into the geometry database before doing the sweep and it should then work for you.


I'll see if I can eliminate this requirement for async factories to have things inserted into the geometry database before they can be remoted.


- 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.24 In reply to 6087.23 
Thank you Michael. I must have missed something in the Pipe2 script.

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.25 In reply to 6087.24 
Added circle to the geometry Database with "moi.geometryDatabase.addObject( circle );" worked! :-)

Still do not see the line in Pipe2.
Maybe it is the order of code, re function WrapWithObjectList( obj ) ?

The purpose of this script is mostly for script education, not chain making. :-)

Now to try an array and flow factory. The recent forum topic on spaced copy may be timely?

- 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:  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
 

Reply to All Reply to All

 

 
Show messages:  1-12  13-32  33-52  53-72  73-80