Friday, December 11, 2015

How to create bearing labels that show all bearings as north


Article by Timothy Corey




This article is about a way to make Civil 3D display all bearings in their northerly directions. My solution was going to be a process that would involve three expressions and one label style that would include two components. Jeff Mischler, my friend and the Yoda of Civil 3D, showed me a way to do it with one expression and one label style having one component. Jeff's solution, in my words:

Step 1 -- Create a new Expression. This post will show the process using a General Line label style. It could be performed in the same manner for Alignment Line labels or for Parcel Segment labels. Right click and pick New... 





I going to blow this image up large so you can read the expression:



If it were to be translated into English: Take the statement "direction of line line is either smaller than or equal to 90 degrees (0 is north, angles are to the right) or larger than or equal to 270 degrees." If that is true, then return the segment direction, but if the statement is false, return the segment direction plus 180 degrees (in radians, pi.) That makes southerly lines answer with a northerly direction. Slick. Thanks, Jeff.

In case you don't understand what pi is doing in there, general segment direction is returned in radians. Using radians, pi is half of a circle, 180 degrees, or 3.1415926... radians. What you and I think of as AutoCAD 270 degrees is pi*1.5, or 4.712...radians. Using pi instead of the actual radians lets you avoid rounding errors that can only be avoided by typing out the radians to many decimal places. It's far easier to just say pi * 1.5 than 4.7123889. Plus it's easier to remember. That's why you see pi in these formulas.

Be positive that you have set Format result as: to Direction.Your expression won't work if you don't.

Create a new label style. Pick the Bearing component in Component name list.


Go into Contents:






Select inside the preview window and delete the contents, then drop down the Properties list.



Set the settings to your desire, then press the right-pointing arrow that sits just to the right of the Properties list. The Preview window will populate.



Hit OK, set the rest of your label properties and components and go test it.





That's way easier than how I was going to to do it. 












Friday, February 27, 2015

Subassembly Composer, A Primer -- Part 6, Creating a Shape






Article by Timothy Corey










Having left our exploration of Subassembly Composer at the point where we know how to set both geometric and surface targets, we realize that every subassembly we have created has been zero-thickness. You can create surfaces from this type of subassembly, you can quantify it using QTO Manager but you cannot take advantage of Civil 3D's Material Volume reporting capabilities...

Until now. This part of the primer will show you how to create a basic Shape object in Subassembly Composer. By now you know how to create points and links, so for this exercise, we let you alone to create your version of a sidewalk. Use your own numbers to make a rectangle, something like this:



Before you draw your shape, one important consideration. Will you be creating Surfaces from the Link Codes you apply to your shape? If so, remember, Civil 3D surfaces cannot handle vertical faces. Although you could rely on your users to set Overhang Correction in their Corridor Surface creation, many find it more reliable to do the correction themselves.

For example, say we plan to use the base of the Shape as a Datum surface. If we were to rely on Overhang Correction for this assembly, the far right end of our sidewalk would likely be missed in modeling the Surface.


To model this correction into the subassembly, we created the lower right point an X offset of -0.001 from the upper right point. To create the lower left point, we used an X offset of 0.001. 

If you only plan to use this subassembly for quantity takeoff, but not for a surface, ignore what was said above and use vertical faces all you like.

Back to the How-to: To create a Shape, drag the Shape tool from the Toolbox to the Flowchart.



Now, all you need to do is add the Links that define the Shape. You can either press the Add Link button four times or you can press the little box with pointer icon at the right end of the box. Press the icon and then select inside the shape.






The next part of the series will show you how to allow users to assign their own Point and Link Codes while placing your custom subassembly. It might be a couple of weeks, as our schedule is full.



Monday, February 23, 2015

Subassembly Composer, A Primer -- Part Five, Targeting other Geometry












Article by Timothy Corey







Now you are able to target a surface and you are able to make the link decide on cut or fill. The office staff are astounded at your abilities. A raise is imminent.

But now some dufus senior engineer says he wants to be able to target some other geometry, like a feature line, an alignment, a profile or a 3d polyline. Why the heck would he need to do that? He can already target a surface. "Ok, whatever, dude, I'll do it."

Start a new subassembly and add your UserSlope input parameter. You should be pretty good at this step by now. For this subassembly, we will also want a User Offset input parameter.



The subassembly will use this value in any area it cannot find its assigned targets. It is common that a subassembly does not find assigned targets. For example, you are grading in an area with an existing retaining wall. Along the wall, you want your new point to grade to the existing base of wall. The retaining wall does not extend the entire length of the corridor region, so parts of the region need an assigned offset.

Next, move to the Target Parameters tab and add two parameters: one for offset and one for elevation.



Although you might want to use the same drawing object for both offset and elevation, you must create two parameters and the user must assign the same object twice when setting the targets. There is no "both" option. Should there be? Yes, in the author's opinion, there should.

Add P1 at the origin. Add P2&L1. Set Point Geometry Type to Slope and Delta X. Specify your UserSlope input parameter for Slope and UserOffset for Delta X. For Offset Target, drop the list down and pick your TargetOffset parameter. Same for Elevation Target. This critical step is what allows your user to specify target geometry from the Parameters tab of Corridor Settings.




Save and test in Civil 3D.

Your rise in status to office hero continues unabated. Congratulations.... for now.

Part 6 will show you how to create a Shape in Subassembly Composer, because the world is neither flat nor zero-thickness.





















c

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.










Saturday, February 14, 2015

Subassembly Composer, A Primer -- Part Three, Targeting a Surface



Autodesk Platinum Partner

 
Article by Timothy Corey
Autodesk Civil 3D Certified Professional


Now you have a subassembly that is meant to connect to a curb subassembly. This new subassembly lets the user apply slope and offset values for creation of a new point and link.



It doesn’t do much, but there is awesomeness in its power.

The engineers in the office love this new subassembly and you have become a hero among them. Then…that new guy, right in front of the boss, asks if you can make the new point intersect with a surface. The boss looks at you, “Yeah, can you make it do that?” He has internet, he knows it can be done.

The good news is, yes, YES, it’s simple to create a surface link with Subassembly Composer. Your position is secure, or will be once you read to the end of Part 3 of this primer.

At this point in our process, we will create a new subassembly file in Subassembly Composer. We have saved the previous file in a secure location.

The new point is going to target a surface and we want the user to be able to supply the slope. As before, we will need an input parameter for slope, but we will also utilize the Target Parameters window. 

Use Packet Settings to name your subassembly as you wish.

Create your user slope input parameter like you did in Part 2 of this primer. 



Now, something new! Move to the Target Parameters tab. Create a new parameter and name it something meaningful, like SurfaceTarget. No spaces allowed in the name. The user sees what you use in the Display Name column. Preview Value is an elevation for the surface in the preview window. This allows you to test your subassemblies, especially as they become more complex. And, of course, be sure you’ve set the Type to Surface. 





Now, create P1 at the origin and then add P2 and L1. Set the point geometry type to Slope to Surface. Replace the default slope value to the name of the input parameter you created for slope. I used UserSlope for mine. For surface target, drop down the list and pick the target parameter you created. 





You’ll see its name there and once you pick it, your link will appear in the Preview window, unless you left the Preview Value of the surface target at 0. Remember that setting, back on the Target Parameters window?



Save your subassembly, import it into Civil 3D and give it a try. Pass it around to your colleagues.

What, your boss said he knows there’s a way to make it check for cut, but go to fill if it needs to? Part 4, coming soon… 
















Sunday, February 8, 2015

Subassembly Composer, A Primer -- Part Two, Using Input Parameters


Autodesk Platinum Partner

 
Article by Timothy Corey
Autodesk Civil 3D Certified Professional


You have successfully created a custom subassembly that slopes away at five percent for ten feet. That's pretty cool, but now the designers are complaining that they want to be able to change the slope and offset with Subassembly Properties.

You need to add some input parameters to your subassembly. Here's how.

In Subassembly Composer, go to the Input/Output Parameters tab in the lower right of the screen.


I usually set my Side parameter Default Value to Right. Do as you wish with that.

Press the Create parameter bar (it's a button that looks like a bar, and it's easy to hit it when you don't mean to, making parameters you don't want or need. Be careful, you can't delete a parameter once your press the button.) I called my first parameter User Slope. Set Type to Grade, Direction to Input, Default Value to whatever you want as the default slope and DisplayName to what you want the user to see in the Properties dialog in AutoCAD Civil 3D.



Input the UserOffset parameter using the values above.

A couple of notes: This example uses Grade for UserSlope because I want the default user-input to be in percent. If you want run:rise slope input, use the Type called Slope. I used Integer for the UserOffset Type because I want input to be in whole units. If you want to be able to use decimals, set the Type to Double.

Almost done now, but we need to tell our subassembly point P2 to use these parameters instead of fixed values. In the Flowchart or Preview window, pick P2. On the Properties window, replace the Slope value of -5% with UserSlope. No quotes, just that name. If you mis-type, you will get a red warning symbol, so if you don't see that, you know you typed it correctly.

Replace Delta X of 10 with UserOffset.



Go to the Packet Settings tab and rename the subassembly. While I am building a subassembly, because I might test it in AutoCAD Civil 3D and then come back to Subassembly Composer to tweak it, I use 01, 02, 03 at the end of the subassembly and file names, incrementing each time. This allows me to continue to load versions of my subassembly into AutoCAD Civil 3D without closing and re-opening each time. Use Saveas to save the pkt file.

Go back to Civil 3D and import the updated subassembly.



Erase the previously placed subassembly from the assembly and then place the updated version. Notice that the Properties dialog now lets you input Slope and Offset. Try various values and see how your subassembly changes. In the example below, I have changed the values to 12% and 5 feet of offset.



That's it for part two of this primer. Part three will cover creating targets. Coming soon...