Wednesday, February 18, 2015

Subassembly Composer, A Primer -- Part Four, Deciding on Cut or Fill


  




Article by Timothy Corey

 



Well, that's pretty cool, now we can make a surface link by creating a Surface Target Parameter and targeting it with our point and link. Sweet.

But we want more. The current surface link will cut or fill based on whether UserSlope is positive or negative, but won't decide if we are in cut or fill on its own.

That's where a Decision (Toolbox window) comes in.

We will start this primer with a subassembly that has the UserSlope and SurfaceTarget parameters that we created in Part 3, but delete everything from the Flowchart, except the Start object.



Add P1 at the origin.

Drag a Decision from the Toolbox to the FlowChart. Drop it below P1.



The Decision object is your basic If/Then or True/False option provider within Subassembly Composer.

What we need to determine is whether P1 sits in cut or fill, below or above the surface at this location.

In the Properties window, in the Condition box, you will see grey text saying Enter a VB Expression here. Click in the box and type P1.DistanceToSurface(SurfaceTarget)<0 font="">. Inside the parentheses is the name of your Surface Target Parameter. If Subassembly Composer accepts the expression, you won't see a little warning symbol.






In the example, I have changed the labels to Fill and Cut. If the Distance to Surface is negative, less than 0, that means we're in cut, and vice versa.


Drag a new point below the Decision. It will connect to the Cut side (left) of the Decision.






Set the properties of P2 so that it targets a surface at a positive UserSlope.



Notice the use of math.abs to be sure we get a positive number from UserSlope.


Now add P3 and connect to the Fill side of the Decision.





And set its properties:


Notice the - sign in front of math.abs(UserSlope). This forces the slope in a fill direction.

Test this by changing the Preview Value of SurfaceTarget (target parameters window) from a positive to a negative number.






A more succinct method of doing the same thing, without need for a Decision, is to put an If statement right in the box for P2 Slope, like this:



Thanks to our friends at Civil3DReminders.com for this suggestion. 

Of course, test in Civil 3D before distributing to your amazed colleagues. The boss is gonna be astounded and your job will remain secure....until he asks for the users to be able target feature lines, alignments and profiles. That's Part 5.



More about VB Expressions in Subassembly Composer here.










No comments: