Double use of buffer

Home Forums Problems and solutions in GDL 3D modelling Double use of buffer

Tagged: 

Viewing 4 reply threads
  • Author
    Posts
    • #3560
      Bruce Walker
      Participant

      Is 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/65450406

      AC20 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

    • #3561
      Bruce Walker
      Participant

      To answer my own question, the below code example seems to give me the functionality I’m after:

      ! Define profile
      nProfile = 0

      PUT -1, 0, 0,
      1, 0, 0,
      1, 1, 0,
      -1, 1, 0
      nProfile = nProfile + 4

      ! Define path
      nPath = 0

      PUT 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 = 6

      TUBE nProfile, nPath, 3 + 16 + 32,
      GET(nProfile * 3),
      USE(nPath * 4)

      www.brucepwalker.com
      https://www.mindmeister.com/65450406

      AC20 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

    • #3562
      Péter Baksa
      Keymaster

      Hi 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

    • #3563
      Bruce Walker
      Participant

      I 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/65450406

      AC20 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

    • #3564
      Bruce Walker
      Participant

      Got it working – thanks Peter.

      www.brucepwalker.com
      https://www.mindmeister.com/65450406

      AC20 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

Viewing 4 reply threads
  • The forum ‘3D modelling’ is closed to new topics and replies.