Using FRA to create striped cladding
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2010-07-05 03:10 PM
ā2010-07-05
03:10 PM
I'm trying to create an object which allows for striped panels of cladding.
The user picks 3 materials and these need to be used on every third iteration to draw a striped object.
The code I have increments a counter 'count' in a loop, shortly before these lines:
IF (FRA(count/3)) = 0 THEN MATERIAL mat_board IF (FRA(count/3)) = 1/3 THEN MATERIAL mat_board2 IF (FRA(count/3)) = 2/3 THEN MATERIAL mat_board3Unfortunately, it only seems to alternate the first 3, then it seems to get stuck on mat_board for all iterations afterwards.
Any ideas?
http://www.lsiarchitects.co.uk
http://derekjackson.artstation.com
AC19 / 21 / 23 / 27
Windows 7 Intel Xeon 18Gb
http://derekjackson.artstation.com
AC19 / 21 / 23 / 27
Windows 7 Intel Xeon 18Gb
4 REPLIES 4
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2010-07-05 03:35 PM
ā2010-07-05
03:35 PM
Hi,
try it:
eps=0.001
IF ABS((FRA(count/3)) - 0 )<eps THEN MATERIAL mat_board
IF ABS((FRA(count/3)) - 1/3 )<eps THEN MATERIAL mat_board2
IF ABS((FRA(count/3)) - 2/3 )<eps THEN MATERIAL mat_board3
cheers,
try it:
eps=0.001
IF ABS((FRA(count/3)) - 0 )<eps THEN MATERIAL mat_board
IF ABS((FRA(count/3)) - 1/3 )<eps THEN MATERIAL mat_board2
IF ABS((FRA(count/3)) - 2/3 )<eps THEN MATERIAL mat_board3
cheers,
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2010-07-05 03:56 PM
ā2010-07-05
03:56 PM
Perfect, thanks!
http://www.lsiarchitects.co.uk
http://derekjackson.artstation.com
AC19 / 21 / 23 / 27
Windows 7 Intel Xeon 18Gb
http://derekjackson.artstation.com
AC19 / 21 / 23 / 27
Windows 7 Intel Xeon 18Gb

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2010-07-05 07:31 PM
ā2010-07-05
07:31 PM
Since count is an integer and never has fractional values, you shouldn't really be using floating point arithmetic anyway.
The simplest method is to use the MOD (modulo) operator.
(count MOD 3) will always equal exactly 0, 1 or 2
and gives you much simpler code (within what GDL offers):
Cheers,
Karl
The simplest method is to use the MOD (modulo) operator.
(count MOD 3) will always equal exactly 0, 1 or 2
and gives you much simpler code (within what GDL offers):
nStripe = count MOD 3 IF nStripe = 0 THEN MATERIAL mat_board if nStripe = 1 THEN MATERIAL mat_board2 if nStripe = 2 THEN MATERIAL mat_board3Of course, if you have an array set up, then you can just replace all of the above with:
MATERIAL mat_board[(count MOD 3)+1]where the +1 is necessary since GDL array indices begin at 1. An advantage of the array is that you can generalize your script to handle any number of stripes, defined parametrically. The other solutions are 'hard coded' to a specific number of stripes.
Cheers,
Karl
AC 28 USA and earlier ⢠macOS Sequoia 15.4, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2010-07-06 09:58 AM
ā2010-07-06
09:58 AM
Superb, far easier. Thanks!
http://www.lsiarchitects.co.uk
http://derekjackson.artstation.com
AC19 / 21 / 23 / 27
Windows 7 Intel Xeon 18Gb
http://derekjackson.artstation.com
AC19 / 21 / 23 / 27
Windows 7 Intel Xeon 18Gb