Home › Forums › Problems and solutions in GDL › 3D modelling › Double use of buffer
Tagged: buffer
- This topic has 4 replies, 2 voices, and was last updated 7 years, 5 months ago by
Bruce Walker.
-
AuthorPosts
-
-
October 2, 2017 at 23:38 #3560
Bruce Walker
ParticipantIs there a way to store two separate sets of values in the buffer?
I have an object I’m coding, where the user can select from a list of profile shapes in order to create a selection of TUBE paths (straights, elbows).
The profile definitions are complex (20-28 lines), and the paths go through curves with variable angles & steps. I was really hoping to store both these in the buffer, but I don’t see a way to do this. If I could reference from a set position in the buffer, I could – but I can only use the next item in the queue.
Any ideas?
www.brucepwalker.com
https://www.mindmeister.com/65450406AC20 6005 AUS Full & AC 21 3009 NZE Full | Win 10 Pro 64 | Intel i7-7700HQ 2.80GHz | 16 Gb RAM
NVIDIA GeForce GTX 1060 8Mb -
October 3, 2017 at 07:51 #3561
Bruce Walker
ParticipantTo answer my own question, the below code example seems to give me the functionality I’m after:
! Define profile
nProfile = 0PUT -1, 0, 0,
1, 0, 0,
1, 1, 0,
-1, 1, 0
nProfile = nProfile + 4! Define path
nPath = 0PUT 0, -1, 0, 0,
0, 0, 0, 0,
0, 5, 0, 0,
0, 5, 5, 0,
0, 0, 5, 0,
0, -1, 5, 0
nPath = 6TUBE nProfile, nPath, 3 + 16 + 32,
GET(nProfile * 3),
USE(nPath * 4)www.brucepwalker.com
https://www.mindmeister.com/65450406AC20 6005 AUS Full & AC 21 3009 NZE Full | Win 10 Pro 64 | Intel i7-7700HQ 2.80GHz | 16 Gb RAM
NVIDIA GeForce GTX 1060 8Mb -
October 3, 2017 at 08:50 #3562
Péter Baksa
KeymasterHi Bruce,
That way the path will stay in the buffer, but if you use it in a loop, next time you won’t be able to put the profile before that.
One solution is to use arrays, and put the values you need before the tube command.Péter Baksa
Library Platform, Software Engineer
GRAPHISOFT SE -
October 3, 2017 at 09:19 #3563
Bruce Walker
ParticipantI thought about using an array, but couldn’t figure out how to feed an array of undefined size into a TUBE or PRISM command.
In this part, the user can choose from a selection of profiles (let’s say Rectangle wide, Rectangle narrow, Pentagon, Hexagon). The profiles are also made up of two different surfaces (let’s say the top 3/4 is white, the bottom 1/4 is grey). They can also choose from a selection of paths (straight, horizontal bend 45°, vertical bend 45°, vertical bend 15°). If the user chooses the straight path, then they can define segment length and number. Horizontal and vertical bends are of fixed length.
In this situation, I use two PRISMs in a loop for the straight segments, and two TUBEs for each of the other options (the horizontal path needing to be defined differently to the vertical path).
At the moment I use the buffer for the path (as the angle can change, as can the number of steps / resolution), and have copied the profile to each of the commands. This means I double up on code, which will be difficult to add more profiles to, or edit what is there (which is almost guaranteed).
I think I know what you mean…but will have to play around with it to figure it out properly.
Cheers
www.brucepwalker.com
https://www.mindmeister.com/65450406AC20 6005 AUS Full & AC 21 3009 NZE Full | Win 10 Pro 64 | Intel i7-7700HQ 2.80GHz | 16 Gb RAM
NVIDIA GeForce GTX 1060 8Mb -
October 3, 2017 at 09:44 #3564
Bruce Walker
ParticipantGot it working – thanks Peter.
www.brucepwalker.com
https://www.mindmeister.com/65450406AC20 6005 AUS Full & AC 21 3009 NZE Full | Win 10 Pro 64 | Intel i7-7700HQ 2.80GHz | 16 Gb RAM
NVIDIA GeForce GTX 1060 8Mb
-
-
AuthorPosts
- The forum ‘3D modelling’ is closed to new topics and replies.