So you read Part 1 on Friday and you can’t wait to hear all about the conditionals and decisions that I promised to talk about next, right? But first we need to talk about variables and so I am going to sneak this discussion in as Part 2 and conditionals will have to wait for Part 3.
I am sure everyone has spent all weekend playing with the Subassembly Composer because it can be downloaded to your home computer while Civil3D sits all alone on your work computer back at the office all weekend. You are a regular expert at putting points and links into the flow chart and even using a sequence or two, (You did read my comment on the last post that you can nest sequences, right?) so what else is there to learn…
There are three tabs in the lower right of your screen (assuming you haven’t changed the dockable locations of the panes, which you can do). They are “Packet Settings”, “Input Parameters” and “Target Parameters”. Today, we are going to talk about “Input Parameters”.
Here is the Input Parameters tab for the subassembly that I shared on Friday.
You can make a variable name and then a type and a default value. For types there are 4 to chose from:
- Double: This is probably going to be your most common variable type. A simple number with decimals allowed.
- Integer: An integer variable will only allow whole numbers. Personally I would always use a double and let the user not be limited to whole numbers but maybe someone will find a case where an integer is preferable.
- Boolean: This is a “True” or “False” variable. You can use these in conjunction with the conditionals. They give you the opportunity to set up multiple scenarios for the user. For example, you can make a boolean variable called UseSubbase and if it is set to true it will use your sequence to make points and links for the subbase and if it is set to false it will ignore that part of your flow chart.
- String: At first I had a hard time thinking of when you would want a string variable. A string variable is text. The only real scenario I can think of at this point is if you want to give your user more than just a true/false option but an a/b/c option. You can then use this in your conditionals to say if Variable=”A”, then do SequenceA, else if Variable=”B”, then do Sequence B, else if Variable=”C”, then do SequenceC.
All right so you made a bunch of Input Parameter variables, now lets see them put to use.
This is probably the most simple use of an input variable. Here I used it to define the offset of my point P1 from the Origin (application point). As one would expect, a negative sign in front of the variable will make it offset to the left and a negative sign in front of the delta elevation will make it offset down.
What’s fun is that you aren’t limited to just a single variable in each property. You can even make a whole equation, like this:
In the scenario above I actually originally wanted to use SlopeAndDeltaElevation but it didn’t work the way I wanted to since I wanted point P8 to be up and to the left of point P7. What I had expected to work with SlopeAndDeltaElevation was if I set a positive elevation and a negative slope it would be up and to the left as I wanted but sadly it always wanted to be up and to the right no matter whether the slope was set to positive or negative. Thankfully I did find a nice little work around as you see above but I also wandered my way over to the Autodesk Discussion Forum for the Subassembly Composer and told them my problem so that it can be fixed. Ask and ye shall receive (or at least some of the time). So don’t forget to speak up if something doesn’t act the way to want or expect.
But I’ve saved the best for last, besides just the Input Parameter variables there are some top secret output variables that you can pull from some of your other points that you define. You can reference these top secret output variables for a point (ex. P1) by typing SubassemblyGeometry.GetPoint(“P1”).elevation and SubassemblyGeometry.GetPoint(“P1”).offset. I know what you are asking, but Kati, if these are top secret variables how do you know about them!? Well there is a wealth of knowledge out there and I came across the suggestion to use SubassemblyGeometry.GetPoint(“P1”).elevation over on the discussion forum and I thought that was so cool I wondered if it would work for offset as well and imagine my surprise when it did! I would love to know if there are more top secret output variables but these two will come in handy when we talk about decisions and conditionals in Part 3! Stay tuned!