Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Spiral needed with a twist

42 REPLIES 42
Reply
Message 1 of 43
Anonymous
1755 Views, 42 Replies

Spiral needed with a twist

Typ., all of the spiral lisp I've found offset the growth ring the same distance, ex. first ring 4m, next 4m , next 4 m, etc.

Can anyone make a slight adjustment to an existing or new lisp/VBA program to add a plus factor number such as 1 to the previous spiral ring? The plus factor number is the twist. Example, if the radius of the first ring intersection point is 4 meters, add plus 1 factor to each subsequent ring making the next ring it 5 meters, next is 6 meters, next is 7 meters, etc.

I need to be able to provide geometric input such as start point and radius of first ring. It would even better if I input my own offset factor. Instead of inputting a plus 1 for each ring, I might try 1.25, 1.50, 1.75 or 2, until I got the shape I wanted. If not, it could be identified in the lisp where I could edit the plus factor number.

I hope my request is clear. Thank you in advance.
42 REPLIES 42
Message 21 of 43
Anonymous
in reply to: Anonymous

Hi Brockster

Here is a my two cents
Unzip this project
Type in command line VBALOAD then upload this
project, then type in command line VBARUN

Hth

~'J'~
Message 22 of 43
Anonymous
in reply to: Anonymous

That worked very well, but needs a few tweaks.

1. This routine places pline arc segments, 180 degrees each. Most spiral routines I have seen allow the user to input the number of segments per 360 degree rotation. The number of degrees or segments is very important to creating a decent spiral. For whatever reason, 30 segments seem typical. Can this functionality be added?

2. The increment should allow for decimal numbers.

For hints, take a look at the sample lisp routine I attached to my original thread.
Message 23 of 43
Anonymous
in reply to: Anonymous

I do not agree with you about your notation:
>> Most spiral routines I have seen allow the user to input the number of segments per 360 degree rotation.

Using of bulge factor allows to you the best visualization
effect and absolutely distinct spiral curve
If not, change it yourself, I am not a math, to my regret

IMHO

~'J'~
Message 24 of 43
Anonymous
in reply to: Anonymous

Okay J, thank you anyway. I'm not a math wiz either. I can ask a friend today who is a math wiz.
Message 25 of 43
Anonymous
in reply to: Anonymous

Hope he would be helps to you

~'J'~
Message 26 of 43
Kent1Cooper
in reply to: Anonymous

Back after vacation last week --

Now I'm confused. The not-quite-fully-working routine I posted was based on the original post's requirements, namely:

"...if the radius of the first ring intersection point is 4 meters, add plus 1 factor to each subsequent ring making the next ring it 5 meters, next is 6 meters, next is 7 meters, etc."

Now this one seems to directly contradict that:

"...if the radius of the first ring intersection point is 4 meters, add plus 1 factor to each subsequent ring making the next ring it 5 meters, next is 7 meters, next is 10 meters, etc"

I was hoping to put some effort into fixing my routine, but I won't if it's based on the wrong requirements. Which way should it work?
--
Kent Cooper
Kent Cooper, AIA
Message 27 of 43
Anonymous
in reply to: Anonymous

... Message was edited by: Brockster
Message 28 of 43
Anonymous
in reply to: Anonymous

Kent, sorry for the confusion. When I showed the designer what your routine would produce, he corrected his intent. The 'X" factor number should be accumulated into the next arch's radius. My apologies.

The second one is the direction to go in: "if the radius of the first ring intersection point is 4 meters, add plus 1 factor to each subsequent ring making the next ring it 5 meters, next is 7 meters, next is 10 meters, etc"
The "X" factor number would have to be a decimal "Reals" number, input by the user. The user would change to achieve a spiral they like.

Do you still something can be worked out?
Message 29 of 43
Anonymous
in reply to: Anonymous

My son, the math whiz and student in a computer-science PHD program, reminds
me of the formula for this kind of progression. The total through "n"
rounds of adding successively increased integers (1 + 2 + 3 + ... + n)
comes to

n(n+1)
-------
2

(e.g., 1+2+3+4 is 4x5/2, or 10, like a set of bowling pins).

So the effective radius anywhere along the spiral is the formula above,
using the number of times it's gone around for "n", multiplied by the
initial interval value [1 in your example], and added to the starting radius
[4 in your example], or in Lisp terms:

(+ startradius (* firstinterval (/ (* n (1+ n)) 2.0)))

The "n" term can be fractional, so you can calculate the radius in as many
points as you want around each cycle, and use Polyline arc segments,
probably best calculated with the Second-point option, but after the first
one is built that way, tangent continuations would probably be fine. The
more segments you break it down to, the more precise will be the shape of
the spiral. For even greater "precision," maybe a Spline would be the thing
to do, since it can be closer to having a continuously-varying degree of
curvature, which a Polyline can only more roughly approximate.

I don't have time to develop that further at the moment, but I'll play with
it as I get a chance. Anyone else, feel free to give it a go.

[I still would like to know what's wrong with the routine I posted earlier
for an equally-spaced spiral, in its (while) section that should be feeding
it points -- it does the first two and then jumps to the end, without the
intermediate ones. Something like that will be needed for this, too, so if
anyone can point out why it's not working, that will help.]
--
Kent Cooper


wrote...
Kent, sorry for the confusion. When I showed the designer what your routine
would produce, he corrected his intent. The 'X" factor number should be
accumulated into the next arch's radius. My apologies.

The second one is the direction to go in: "if the radius of the first ring
intersection point is 4 meters, add plus 1 factor to each subsequent ring
making the next ring it 5 meters, next is 7 meters, next is 10 meters, etc"
The "X" factor number would have to be a decimal "Reals" number, input by
the user. The user would change to achieve a spiral they like.

Do you still something can be worked out?
Message 30 of 43
Anonymous
in reply to: Anonymous

Try these.

I figured out what to do to fix the equal-spaced spiral one -- it seems that
(while) doesn't work as I expected inside a (command) function, but it seems
to work if you "end" the (command) function [in mid-command], and then use
(while) with its own sub-(command) functions to feed information to the
waiting prompts. I tried that on the equal-spaced routine, and that got it
to
work, so I knew how to do that part in the other one. I'm including that
even
though it's not exactly what you wanted (someone else may have a use for
it).

The equal-spaced one is less sophisticated -- it always starts in the
zero-degree direction, goes counterclockwise, and uses eight arc segments
per turn. It could be made more sophisticated like the other one, easily
enough. But it has one "advantage" over the other one: it will end the
spiral *at* the specified outer radius value, even if that falls between the
regular segment angles.

The increasing-spacing one asks the user for a starting angle from the
center, and which way to go around, and how many arc segments to make per
turn. But it goes in full arc segments until it equals the specified
outside radius, OR if it doesn't land exactly, to the end of the first whole
segment *beyond* that. To fix that would, I think, require a quadratic
calculation that I'm not sure AutoLisp can do. That's why it asks for the
"Minimum" ending radius. (If it matters to you, you can always draw a
circle from the center to the maximum radius, and trim the excess off the
last Polyline segment.)

Of course, there are other things that could be added (error controls,
etc.), but the geometric challenge was what I was interested in figuring
out.

--
Kent Cooper
Message 31 of 43
Anonymous
in reply to: Anonymous

Well, it's easy enough to localize the variables, which I forgot to do in
the Increasing-space one. Here it is with at least that "improvement."
--
Kent Cooper


"Kent Cooper" wrote...
....
Of course, there are other things that could be added (error controls,
etc.), but the geometric challenge was what I was interested in figuring
out.
....
Message 32 of 43
Anonymous
in reply to: Anonymous

Well... that quite interesting. Two very well built routines! We will definitely make use of the SpiralEqualSpacing.LSP routine. And I really think SpiralIncrSpacing.LSP is going to do the trick. I'll have to wait until Monday to show the design team.

I have one question though. How am I to respond to "First Turn Interval"? I'm not sure how to respond to this question.

You get five gold stars for your effort and stick-to-it'ness. Message was edited by: Brockster
Message 33 of 43
Anonymous
in reply to: Anonymous

[You can change the wording of the prompt to something clearer for you.]
It's the Interval or spacing from the start point to the end of the First
Turn, that is going to be doubled for the Second interval, and tripled for
the Third interval, etc.; or, the distance of 1 unit in your example.

I enjoyed figuring out how to make that work.
--
Kent Cooper


wrote...
Well... that quite interesting. Two very well built routines! We will
definitely make use of the SpiralEqualSpacing.LSP routine. And I really
think SpiralIncrSpacing.LSP is going to do the trick. I'll have to wait
until Monday to show the design team.

I have one question though. How am I to respond to "First Turn Interval"?
I'm not sure how to respond to this question.

You get five gold stars for your effort and stick-to-it'ness.

Message was edited by: Brockster
Message 34 of 43
Anonymous
in reply to: Anonymous

Kent. The designers were very happy with the routine you developed. Their response was something like "...this will enable us to design the building's skin with real numbers we can provide to the contractor."

Thanks again. I'm glad you enjoyed the challenge. And thanks everyone that provided input.
Message 35 of 43
Anonymous
in reply to: Anonymous

[Oh boy -- do I get a cut of your fees?] If they're going to put dimensions
on it or on things that intersect with it, and so on, just make sure they
understand that a Polyline is *not* (and cannot be) a true spiral, because
it does not have a continuously changing degree of curvature. The more
precise they need it, the more segments per turn they should call for.
I'm thinking of doing another version, too, for a Geometrically-Increasing
Spiral (that is, a Logarithmic or Equiangular Spiral, of which the famous
Fibonacci Spiral is a special case).
--
Kent Cooper


wrote...
Kent. The designers were very happy with the routine you developed. Their
response was something like "...this will enable us to design the building's
skin with real numbers we can provide to the contractor."

Thanks again. I'm glad you enjoyed the challenge. And thanks everyone that
provided input.
Message 36 of 43
Anonymous
in reply to: Anonymous

So, after a bunch of fiddling when I could, here is my multi-purpose
Polyline Spiral Lisp File -- SPIRALS.lsp.

It contains three different commands, for Equal, Arithmetically-Increasing,
and Geometrically-Increasing spacing between successive turns of the spiral.
As an improvement over what I posted earlier, all three versions let the
user choose how many segments per rotation, the angle from the center to the
start point, and which direction it spirals. See the Lisp file for other
comments and more description of each type.

I hope someone finds them useful. They're even kind of fun just to watch,
especially if you use a high number of segments per rotation.

--
Kent Cooper


"Kent Cooper" wrote...
....
I'm thinking of doing another version, too, for a Geometrically-Increasing
Spiral (that is, a Logarithmic or Equiangular Spiral, of which the famous
Fibonacci Spiral is a special case).
....
Message 37 of 43
Anonymous
in reply to: Anonymous

So, after a bunch of fiddling when I could, here is my multi-purpose
Polyline Spiral Lisp File -- SPIRALS.lsp.

It contains three different commands, for Equal, Arithmetically-Increasing,
and Geometrically-Increasing spacing between successive turns of the spiral.
As an improvement over what I posted earlier, all three versions let the
user choose how many segments per rotation, the angle from the center to the
start point, and which direction it spirals. See the Lisp file for other
comments and more description of each type.

I hope someone finds them useful. They're even kind of fun just to watch,
especially if you use a high number of segments per rotation.

--
Kent Cooper


"Kent Cooper" wrote...
....
I'm thinking of doing another version, too, for a Geometrically-Increasing
Spiral (that is, a Logarithmic or Equiangular Spiral, of which the famous
Fibonacci Spiral is a special case).
....
Message 38 of 43
Anonymous
in reply to: Anonymous

[Sorry about those other partial messages -- I don't know what went wrong
there, but let's try again....]

So, after a bunch of fiddling when I could, here is my multi-purpose
Polyline Spiral Lisp File -- SPIRALS.lsp.

It contains three different commands, for Equal, Arithmetically-Increasing,
and Geometrically-Increasing spacing between successive turns of the spiral.
As an improvement over what I posted earlier, all three versions let the
user choose how many segments per rotation, the angle from the center to the
start point, and which direction it spirals. See the Lisp file for other
comments and more description of each type.

I hope someone finds them useful. They're even kind of fun just to watch,
especially if you use a high number of segments per rotation.

--
Kent Cooper


"Kent Cooper" wrote...
....
I'm thinking of doing another version, too, for a Geometrically-Increasing
Spiral (that is, a Logarithmic or Equiangular Spiral, of which the famous
Fibonacci Spiral is a special case).
....
Message 39 of 43
Anonymous
in reply to: Anonymous

[All right, this is getting too weird.... Starting from scratch instead of
copying & pasting, here we go once more.]

After fiddling around with it when I could over the last while, here is my
SPIRALS.LSP file, containing three commands, for Equal,
Arithmetically-Increasing, and Geometrically-Increasing spacing between
turns of the spiral. Improving on parts of what I posted before (as well as
adding the Geometric version), all three let the User choose the number of
arc segments per rotation, the angle from the center to the starting point,
and the direction in which to spiral. See the Lisp file text for other
comments, and more description of each type.

I hope someone finds them useful. They're even kind of fun just to watch,
especially if you use a high number of segments per rotation.

--
Kent Cooper


"Kent Cooper" wrote...
....
I'm thinking of doing another version, too, for a Geometrically-Increasing
Spiral (that is, a Logarithmic or Equiangular Spiral, of which the famous
Fibonacci Spiral is a special case).
....
Message 40 of 43
Anonymous
in reply to: Anonymous

Hello Kent. I just read your previous messages and if I could, you'd definitely get your cut of the pie.

I'll have the guys take a look at the revised routine you've worked up and inform you of their comments. I appreciate your hard work.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report