Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

twisted ribbon/object

Anonymous
Not applicable
Hello-
Please show me how this (attached) is done using GDL, I have posted this in 'Working in AC' section. I got a suggestion to bring it here. I have tried the mesh tool before, but didnt work. I would also like to know if I can manipulate/play with the surface of this object after creating it.
Please disregard materials.

Twist2.jpg
15 REPLIES 15
Anonymous
Not applicable
To do this in GDL will require the correct mathematics.

I haven't the time to noodle it out myself but it looks like a simple circular (sine) function should generate the values if the spiral is to be a regular one. Otherwise you will probably need additional parameters to introduce any distortions you want.

The SWEEP or TUBE statements are probably the best bet for the actual form. I recommend using a FOR-NEXT loop with a PUT statement to set up the coordinates and then use GET within the SWEEP or TUBE. There is some code similar to this in the manual.

Clever application of the graphical (or user) hotspots could make this into a very interesting part.
Durval
Enthusiast
Maybe this object may help you.
It was done as an exercise in one of our GDL classes here in São Paulo/Brazil.
--- www.dtabach.com.br ---
AC 24 BR – MacBook Pro 2,9 GHz Intel Core i7 16GB RAM Mac OS 10.14
Anonymous
Not applicable
Geometric shapes are very easy in GDL. It is architecture that is difficult The GDL is actually quite simple - but a geometric background does help.

HTH !
Stuart 'prefers long variable names' James


!*** master variables ***

oRevolutions = 2
oSegmentAngle = 5 !=== in degrees
oCoilRadius = 5
oCoilLength = 50
oBandWidth = 5
oBandHeight = 2

!*** dependent variables ***

oAngle = 360 * oRevolutions
oStep = oAngle / (360/oSegmentAngle)
oXmultiplier = oCoilLength / oAngle

!*** put path ***

for i = 0 - oStep to oAngle + oStep step oStep

oX = i * oXmultiplier
oY = sin (i) * oCoilRadius
oZ = cos (i) * oCoilRadius
put oX, oY, oZ, i
next i

!*** draw path ***

tube 4, oAngle/oStep +2, 32+16+2+1,
-oBandWidth*0.5, -oBandHeight*0.5, 0,
oBandWidth*0.5, -oBandHeight*0.5, 0,
oBandWidth*0.5, oBandHeight*0.5, 0,
-oBandWidth*0.5, oBandHeight*0.5, 0,
get ((oAngle/oStep+2)*4)

end
Anonymous
Not applicable
thanks guys,very helpfull

Durval, I would like to know how is it possible to make this ribbon start wide and end up thin or almost pointed. the width in the object is fixed all along.
I want it to look more like the one posted by Stuart, except for the thickness.

Stuart, please let me know how long it took you to do it?

and is that how you felt after doing it, turning around and around.
Anonymous
Not applicable
Saif;

The 'one posted by Stuart' is an even thickness along the length. Here is a 'rough' variation which gives tapered ends. As long as you're happy with the geometry/maths this doesn't take long at all.

Note - it isn't an 'accurate' model but would suffice for many circumstances.... Now I'm curious! - just what are you trying to model???

HTH - Stuart

PS. DnC et al - yes I know that you should 'rot x,y,z' all along the helical path to do this 'properly' but I'd need a beer before coding that!


oRevolutions = 3
oSteps = 1000
oCoilRadius = 10
oCoilLength = 50
oBandMaxWidth = 2
oBandMaxHeight = 5
oHeight = oCoilLength/oSteps

roty 90

for j= -1 to oSteps+1

i = j/oSteps * 360 * oRevolutions
oBandWidth = oBandMaxWidth * sin(j/oSteps*180)+0.001
oBandHeight = oBandMaxHeight * sin(j/oSteps*180)+0.001

put oCoilRadius * cos(i) - oBandWidth * cos (i) + oBandHeight * sin (i),
oCoilRadius * sin(i) - oBandWidth * sin (i) - oBandHeight * cos (i), oHeight,
oCoilRadius * cos(i) + oBandWidth * cos (i) + oBandHeight * sin (i),
oCoilRadius * sin(i) + oBandWidth * sin (i) - oBandHeight * cos (i), oHeight,
oCoilRadius * cos(i) + oBandWidth * cos (i) - oBandHeight * sin (i),
oCoilRadius * sin(i) + oBandWidth * sin (i) + oBandHeight * cos (i), oHeight,
oCoilRadius * cos(i) - oBandWidth * cos (i) - oBandHeight * sin (i),
oCoilRadius * sin(i) - oBandWidth * sin (i) + oBandHeight * cos (i), oHeight,
oCoilRadius * cos(i) - oBandWidth * cos (i) + oBandHeight * sin (i),
oCoilRadius * sin(i) - oBandWidth * sin (i) - oBandHeight * cos (i), oHeight

if j>=0 and j<=oSteps then
ruled 5, 51,
get(2), get(1)*0,
get(2), get(1)*0,
get(2), get(1)*0,
get(2), get(1)*0,
get(2), get(1)*0,
use(15)
addz oHeight
endif

next j
del top
[/size]
Anonymous
Not applicable
saif wrote:
Stuart, please let me know how long it took you to do it?
Saif;

The first one took about 4 minutes (+1 minute to render). The second example took 6:30 minutes (yes I timed it! + 2 minutes to render).

But if 3d geometry isn't your cup of tea then it could take a lot lot longer...

- Stuart
Anonymous
Not applicable
Having had a beer (:)) here's a 'better' solution...

oSe = 0300 !=== no. of segments
oCr = 0005 !=== helix diameter
oBw = 0002 !=== width of band
oAn = 1500 !=== total revolved angle
oLe = 0050 !=== total length

for j=-1 to 1 step 2 : for i=0 to oAn step oAn/oSe
put oCr*cos(i)+j*oBw*cos(i)*sin(i/oAn*180)
put oCr*sin(i)+j*oBW*sin(i)*sin (i/oAn*180)
put i/oAN*oLe
next i : next j

for i=0 to oAn step oAn : for j=0 to 1
put oCr*cos(i) : put oCR*sin(i) : put i/oAN*oLe
next j : next i

coons (nsp-12)/6, 2, 60, get (nsp)
[/size]
coil3.jpg
Durval
Enthusiast
StuartJames wrote:
Having had a beer (:)) here's a 'better' solution...
WOW! Where can I find one of these beers?
Maybe it alows me to understand your elegant piece of code...
Up to the ruled script I was following your mathematics.
But this coons solution made me a bit lost. Could you give some clue on how you worked out these geometric equations?
--- www.dtabach.com.br ---
AC 24 BR – MacBook Pro 2,9 GHz Intel Core i7 16GB RAM Mac OS 10.14
Karl Ottenstein
Moderator
Durval wrote:
WOW! Where can I find one of these beers?
Maybe it alows me to understand your elegant piece of code...
Up to the ruled script I was following your mathematics.
But this coons solution made me a bit lost. Could you give some clue on how you worked out these geometric equations?
Exactly. Give us a bit of a lesson here, Stuart! Or tell us which beer!

Karl
One of the forum moderators
AC 28 USA and earlier   •   macOS Sequoia 15.2, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB