Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 45 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
45
Dung lượng
9,59 MB
Nội dung
Bonus Chapter Custom Subassemblies The stock subassemblies available with the Autodesk® AutoCAD® Civil 3D® software are capable of providing many solutions to your corridor needs, as discussed in Chapter 8, “Assemblies and Subassemblies.” However, there are going to be instances when what they offer isn’t exactly what you need Sometimes it may be too robust or sometimes not robust enough When you install Civil 3D 2016, you are given the option to install an additional program called Autodesk® Subassembly Composer for AutoCAD® Civil 3D® (hereafter referred to as Subassembly Composer) This stand-alone program has an easy-to-use interface that allows you to create custom subassemblies without needing to know how to write programming code These custom subassemblies can be imported into Civil 3D for use in your assembly and corridor creation right alongside the stock subassemblies In this chapter, you will learn to: ◆ Define input and output parameters with default values ◆ Define target offsets, target elevations, and target surfaces ◆ Generate a flowchart of subassembly logic using the elements in the Tool Box ◆ Import a custom subassembly made with Subassembly Composer into Civil 3D The User Interface Subassembly Composer is a separate program that can be optionally installed when you install the Civil 3D software Once you’ve installed it, select Start ➢ All Programs ➢ Autodesk ➢ Subassembly Composer 2016 ➢ Autodesk Subassembly Composer 2016 to launch Autodesk Subassembly Composer 2016 Subassembly Composer consists of five individual window panels: Tool Box, Flowchart, Properties, Preview, and Settings And Parameters (Figure B1.1) both01.indd 12:37:2:PM/08/07/2015 Page | BONUS CHAPTER CUSTOM SUBASSEMBLIES Figure B1.1 The Subassembly Composer user interface By clicking a panel’s title bar and dragging it to access the docking control icons that appear, you can control these window panels independently At any time, you can return to the default position by choosing View ➢ Restore Default Layout Tool Box Panel The Tool Box panel, which by default is located along the left side of the user interface, is the storage location for elements available for constructing the subassembly This is similar to how the Tool Palettes panel in Civil 3D serves as the storage location for subassemblies available for constructing assemblies This panel will provide all the elements you’ll use to build your flowchart The five branches (Geometry, Advanced Geometry, Auxiliary, Workflow, and Miscellaneous) can be expanded and collapsed to show the elements within each category To use any of these elements, click the desired element and drag and drop it onto the Flowchart panel Later in this chapter you will look more closely at all the elements available Flowchart Panel The Flowchart panel, which by default is located at the top center of the user interface, is the workspace used to build and organize the subassembly logic and elements A flowchart can be a simple straight line of logic, or it can be a complex tree of branching decisions Either way, the subassembly definition always begins at the Start element If there is a problem with your subassembly’s logic, a small red circle with an exclamation point will be displayed in the upper-right corner of this panel Properties Panel The Properties panel, which by default is located at the bottom center of the user interface, is the input location of the parameters that define each geometry element This is where you will spend most of your time defining the subassembly’s geometry both01.indd 12:37:2:PM/08/07/2015 Page CREATING A SUBASSEMBLY Preview Panel The Preview panel, which by default is located at the upper right of the user interface, allows you to view your subassembly as currently defined by the Flowchart panel There are two preview modes Roadway Mode or target offsets Layout Mode Shows the subassembly built using any target surfaces, target elevations, Shows the subassembly built using only the input parameters (no targets) At the bottom of this panel are two check boxes: Codes and Comments If any codes or comments were entered in the properties for the points, links, or shapes and you select these check boxes, this information will be listed next to the applicable geometry in the Preview pane Codes will be shown in brackets, [ ], and comments will be shown in parentheses, ( ) You will learn how to define code and comments a little later Use the scroll wheel on your mouse to zoom in and out, or click the Fit To Screen button to zoom extents Settings And Parameters Panel The Settings And Parameters panel, which by default is located at the bottom right of the user interface, consists of six tabs that defi ne the subassembly: Packet Settings, Input/Output Parameters, Target Parameters, Superelevation, Cant, and Event Viewer You will take a closer look at some of these in this chapter Creating a Subassembly Every subassembly that you create using Subassembly Composer will be built using the same five basic steps: Define the packet settings Define the input and output parameters (Optional) Define the target, superelevation, and cant parameters Build the flowchart that defines the subassembly Save the packet (PKT) file in Subassembly Composer and import it into Civil 3D The names in each of these steps should sound familiar since many of them are built into specific sections of the user interface Generally, you will start in the Settings And Parameters panel in the lower-right corner of the user interface and work across the tabs from left to right to define the packet settings, input and output parameters, and then the target parameters Then you will move over to the Tool Box, Flowchart, and Properties panels to defi ne your subassembly There are three other tabs in the Settings And Parameters panel: Superelevation, Cant, and Event Viewer Defining the Subassembly As you saw in Chapter 8, there will be some instances when the stock subassemblies just won’t what you need them to to meet your design One example of such a scenario (which you learned about in Chapter 8) was the inability to define different cross slopes in the stock both01.indd 12:37:2:PM/08/07/2015 Page | | BONUS CHAPTER CUSTOM SUBASSEMBLIES subassembly UrbanSidewalk for the inside boulevard (terrace), sidewalk, and outside boulevard (buffer strip) To achieve the result you wanted, you used three separate subassemblies: a generic link, a sidewalk, and another generic link, which all worked independently of one another Instead of always using this combination of subassemblies, you could generate a custom subassembly using Subassembly Composer to meet your specific design needs As you can see from the five basic steps discussed earlier, the first three steps define various components of your subassembly These first three steps are the first three tabs of the Settings And Parameters panel In the following example, you will go through these three steps and define your subassembly Packet Settings On the Packet Settings tab shown in Figure B1.2, you can define the subassembly name, provide a description, link to a help file, and link to an image Of these four pieces of information, only the subassembly name is required; the others are optional Figure B1.2 The default Packet Settings tab The subassembly name (which can be different from the name of the PKT file) will be the name that is displayed on the tool palette once it’s imported into Civil 3D As with the stock subassemblies, the subassembly name that you defi ne cannot have any spaces If you include a description, this text will appear on the tool palette as hover text Similarly, the image, if provided, will display in the tool palette next to the subassembly’s name It’s recommended that the image you provide be 224×224 pixels (although an image as small as 64×64 is allowed) If you create a help file, supply it in HTM or HTML format To add an image or a help file, click the ellipsis button in that row and navigate to the file location Use this information to define the packet settings for this first example in a new subassembly PKT file On the Packet Settings tab, the following: Set Subassembly Name to UrbanSidewalkSlopes or UrbanSidewalkSlopesMetric Remember not to use spaces in the subassembly names Metric or Imperial Subassembly Composer is unitless PKT fi les generated by Subassembly Composer can be used with either metric or Imperial Civil 3D designs The only difference is in the default values: the Imperial subassembly will have values based on feet, and the metric subassembly will have values based on meters Th is is why you are going to name your subassemblies differently, so that you know which is which when they are later imported into the Civil 3D tool palettes both01.indd 12:37:2:PM/08/07/2015 Page CREATING A SUBASSEMBLY For Description, type Urban sidewalk with varying cross slopes Because they are both optional, leave the Help File and Image options blank at this time The Packet Settings tab should look like Figure B1.3 Figure B1.3 The Packet Settings tab for UrbanSidewalk Slopes Save this file and keep it open so you can define the input and output parameters next Input and Output Parameters On the Input/Output Parameters tab, shown in Figure B1.4, you can define numerous parameters along with their default values These are the same as the input and output parameters that are available in the stock subassemblies (which you learned about in Chapter 8) The information on this tab is presented in a table To add a parameter, simply click the Create Parameter text To remove a parameter, highlight that row in the table and press Delete on your keyboard Figure B1.4 The default Input/ Output Parameters tab Because this subassembly example is based on the UrbanSidewalk stock subassembly, keep the terminology consistent with the stock subassembly for ease of use by the end user in Civil 3D Maintaining consistent terminology across platforms is a good practice Stock Subassemblies in Subassembly Composer When you run into a limitation with one of the stock subassemblies and you want to make a modified subassembly based on that stock subassembly, one of your first questions will likely be, “Where can I find the PKT fi le for the stock subassemblies to use as a starting point?” Unfortunately, the stock subassemblies are written in a different type of code that doesn’t allow them to be opened in Subassembly Composer Let’s hope that some of the stock subassemblies will be made available in PKT format soon In the meantime, creating a subassembly in Subassembly Composer based on one of the stock subassemblies is a great learning experience both01.indd 12:37:2:PM/08/07/2015 Page | | BONUS CHAPTER CUSTOM SUBASSEMBLIES To help maintain consistency with the stock subassembly, look at the UrbanSidewalk help file for the input and output parameters it uses The help file indicates that there are six input parameters: Side, Inside Boulevard Width, Sidewalk Width, Outside Boulevard Width, %Slope, and Depth You will use these six input parameters; however, the whole reason you are using Subassembly Composer for this example is to allow the end user to specify different slopes for each of the components Therefore, in addition to %Slope (which you will instead name SidewalkSlope), you will define an Inside Boulevard Slope and an Outside Boulevard Slope You will also give the end user the ability to specify a point code at the outside point numbered P4 in the help file The help file indicates that there are no output parameters, so you won’t define any output parameters in this example As you look at the help file for the UrbanSidewalk subassembly, you may notice that the different input parameters have a type assigned to them These same types are available in Subassembly Composer Input/Output Parameter Types Input and output parameter types are provided with the program and are accessible from the drop-down in the Type column These are the basic variable types: ◆ Integer, which is a whole number ◆ Double, which is a number that allows decimal precision ◆ String, which is text ◆ Grade, which is a percentage slope ◆ Slope, which is a ratio of horizontal distance to vertical distance ◆ Yes/No, which is used for Boolean variables ◆ Side, which can be set to Left, Right, or None The following variable types relate to superelevation: ◆ Superelevation ◆ Superelevation Axis of Rotation ◆ Slope Direction ◆ Potential Pivot You can also create custom types, called enumerations, which will be discussed later in this chapter Let’s use the help file information to define the input parameters for the example started in the previous exercise On the Input/Output Parameters tab, the following: For the Side input parameter, change Default Value to Right by using the drop-down both01.indd 12:37:2:PM/08/07/2015 Page CREATING A SUBASSEMBLY If you leave Default Value as None, this parameter won’t be listed in the Advanced Parameters for the subassembly in Civil 3D In a later symmetric example, you will leave this value set to None Click Create Parameter once to add a new parameter Change Name to InsideWidth Verify that Type is set to Double by using the drop-down Verify that Direction is set to Input by using the drop-down Set Default Value to Set DisplayName to Inside Boulevard Width Click Create Parameter seven times to add seven more parameters Alternatively, you can click Create Parameter before defining each parameter Don’t forget that if you add too many parameters, you can highlight the row in the table that you want to remove and press Delete on your keyboard Because you want all of these to be input parameters, all the Direction values will remain as Input Define the remaining seven input parameters When entering the default value, press Enter to make the value stick Use the following settings (note that the metric values are shown in parentheses if different from the Imperial values): Name Type Default Value DisplayName SidewalkWidth Double (1.5) Sidewalk Width OutsideWidth Double Outside Boulevard Width InsideSlope Grade Inside Boulevard Slope SidewalkSlope Grade Sidewalk Slope OutsideSlope Grade Outside Boulevard Slope Depth Double 0.333 (0.1) OutsidePointCode String Hinge Point Code at Outside Point, P4 The program will change the parameters with the type of grade to have a percent sign in the Default Value column The DisplayName column value for Depth is intentionally left blank Entries made in the Description column are optional, and any fields that are left blank will use the Name column value as the DisplayName column value The Input/Output Parameters tab should now look like Figure B1.5 both01.indd 12:37:2:PM/08/07/2015 Page | | BONUS CHAPTER CUSTOM SUBASSEMBLIES Figure B1.5 The Input/Output Parameters tab for UrbanSidewalk Slopes Target Parameters On the Target Parameters tab, shown in Figure B1.6, you can define the targets to be used by the subassembly You can use three types of targets: ◆ Offset targets ◆ Elevation targets ◆ Surface targets Figure B1.6 The default Target Parameters tab These are the same types of targets you learned about in Chapter As with the Input/Output Parameters tab, click the Create Parameter text to add a parameter, and to remove a parameter, highlight that row in the table and press Delete on your keyboard Just as you looked in the UrbanSidewalk help file for the input parameters that it uses, you will look in the help file for the target parameters The help file indicates that there are three target parameters: Inside Boulevard Width, Sidewalk Width, and Outside Boulevard Width The help file also indicates that these parameters are optional Although the UrbanSidewalk file called all of these widths, they are actually offsets measured from the subassembly origin Therefore, you are going to suffix the names of these targets with the word Offset Let’s use this information to define the target parameters for this example On the Target Parameters tab, the following: Click Create Parameter to add a new parameter and then the following: a Change Name to TargetInsideOffset b Verify that Type is set to Offset c Set Preview Value to (or 0.25 for metric) and press Enter both01.indd 12:37:2:PM/08/07/2015 Page CREATING A SUBASSEMBLY The preview value is different from the default value you defined for the input parameters A preview value is used to configure display in the Preview panel here in Subassembly Composer; the actual value in Civil 3D is generated based on the assigned targets Click Create Parameter to add a new parameter and then the following: a Change Name to TargetSidewalkOffset b Verify that Type is set to Offset The order of the parameters may change after entering the type c Set Preview Value to (or 1.5 for metric) Click Create Parameter to add a new parameter and then the following: a Change Name to TargetOutsideOffset b Verify that Type is set to Offset c Set Preview Value to (or 1.75 for metric) The Target Parameters tab should now look like Figure B1.7 d Save and keep this file open for the next exercise Figure B1.7 Target parameters for UrbanSidewalkSlopes As you add the target parameters, you should notice that they will be added to the Preview panel, as shown in Figure B1.8, if you have the Preview Geometry option set to Roadway Mode Remember, Roadway mode will show your subassembly based on the target parameter, and Layout mode will show your subassembly without the targets considered Figure B1.8 Target parameters shown in the Preview panel both01.indd 12:37:2:PM/08/07/2015 Page | 10 | BONUS CHAPTER CUSTOM SUBASSEMBLIES You can zoom in and out in your Preview panel by scrolling the mouse scroll wheel, and you can pan by clicking the mouse scroll wheel and dragging Once there are elements shown in the Preview panel, you can also zoom to the extents of your subassembly using the Fit To Screen button at the bottom-right corner of the panel, but the Fit To Screen button does not consider the target parameters Now that you have defined the subassembly parameters, you will start building the subassembly You may keep this file open to continue on to the next exercise or use the finished copy of this file available from the book’s web page, www.sybex.com/go/masteringcivil3d2016 The file is named UrbanSidewalkSlopes_Defined.pkt or UrbanSidewalkSlopesMetric_Defined.pkt Building the Subassembly Flowchart Every flowchart will start from the appropriately named Start element From there, the flowchart is built with elements from the Tool Box, which are connected together with arrows As you will see, every element you add from the Tool Box has at least two nodes: one node for an incoming connection arrow and one node for an outgoing connection arrow Building a flowchart is as simple as dragging and dropping elements from the Tool Box into the Flowchart panel, as shown in this series of steps: If it is still open from the previous exercise, continue working in the PKT file from the previous example, or open the UrbanSidewalkSlopes_Defined.pkt or UrbanSidewalkSlopesMetric_Defined.pkt file From the Tool Box ➢ Geometry branch, drag a Point element to below the Start element The Start element will automatically connect to the new Point element, which has automatically been numbered P1, as shown in Figure B1.9 Figure B1.9 The Start element connected to the Point element If you look at the Properties panel while point P1 is selected, you will see that it has been placed on the origin The origin is the geometry point your subassembly will attach to when generating an assembly in Civil 3D While you may have instances where you don’t want a point at the origin, it is generally the case that P1 and the origin will be coincident As such, you not need to change any of the defaults for this point P, AP, L, AL, and S Number Prefixes While all sorts of geometric elements are available in your Tool Box, they all boil down to three types: points, links, and shapes They should all be familiar from the discussions in Chapter There are regular points and links as well as auxiliary points and links Auxiliary elements are used to make calculations in Subassembly Composer, but they will never be displayed in Civil 3D both01.indd 12:37:2:PM/08/07/2015 Page 10 USING EXPRESSIONS | Math API Functions In addition to all the Subassembly Composer API functions, numerous math API functions are available A few of the common ones you may need include the following: Round Math.Round(12.1009,2) returns the first value rounded to the nearest specified decimal places If the second value is –2, it will round to the nearest hundreds, –1 will round to the nearest tens, to the nearest integer, to the nearest tenths, to the nearest hundredths, and so on Floor or Ceiling Math.Floor(12.1009) or Math.Ceiling(12.1009) returns the next smallest integer (floor) or next largest integer (ceiling) In this example, the floor would be 12, and the ceiling would be 13 Max or Min Math.Max(12.1009,4.038) or Math.Min(12.1009,4.038) returns the maximum value or minimum value of the two specified values In this example, the maximum would be 12.1009, and the minimum would be 4.038 Pi Math.pi returns the value of the constant pi Sin, Cos, Tan, Asin, Acos, or Atan Math.Sin(math.pi) returns sine of the specified value (in this case, the constant pi) This similar format could be used for any of the other trigonometric functions The angles specified or calculated should be provided in radians Using an API Function in an Expression With all of the stock subassemblies, the parameters are constants throughout the region unless a target is used to taper the offset or elevation By using the API functions in the baseline class, you can generate a subassembly that knows the start and end of the region that it is in, as well as the current station By using this information, you can taper from a start value to an end value In the following example, you will use Subassembly Composer to calculate the current value (a double variable) based on the start value and end value, which have a linear taper between them You will then import this simple calculation subassembly into Civil 3D to use to taper using a parameter reference Start a new subassembly file and save it as TaperDouble.pkt, or TaperDouble_Metric pkt if metric On the Packet Settings tab, enter TaperDouble for the subassembly name On the Input/Output Parameters tab, click Create Parameter to add a new parameter for each of the input and output parameters with the following settings: Name Type Direction Default Value DisplayName Side Side Input None StartValue Double Input Start Value EndValue Double Input End Value CalcValue Double Output Calculated Value both01.indd 12:37:2:PM/08/07/2015 Page 31 31 32 | BONUS CHAPTER CUSTOM SUBASSEMBLIES From the Tool Box ➢ Geometry branch, drag a Point element to below the Start element Leave this point as generated at the origin and not change any of the default values A minimum of one point must be in the subassembly so that the calculation you will define in the next step will work when it’s imported into Civil 3D From the Tool Box ➢ Miscellaneous branch, drag a Set Output Parameter element to below P1 Define the Set Output Parameter element as follows: a Verify that Output Parameter is set to CalcValue b Set the value to StartValue+ (baseline.station-baseline.regionstart)/ (baseline.regionend-baseline.regionstart)*(EndValue-StartValue) Be sure to place a space after the plus sign (+), and make sure no spaces are in the remaining part of the expression Many of the fields throughout Subassembly Composer have an ellipsis button you can click to display the Expression Editor dialog, as shown in Figure B1.29 If you want to have a larger field for entering text, you can use the Expression Editor dialog to edit the text field Figure B1.29 Expression Editor can be accessed by clicking the ellipsis button on many of the expression fields In Subassembly Composer, save your PKT file, which should look like Figure B1.30 Figure B1.30 A simple subassembly with just a Set Output Parameter element When this portion of the exercise is complete, you can close the file A finished copy of this file (TaperDouble_FINISHED.pkt, TaperDouble_Metric_FINISHED.pkt)is available from the book’s web page You will import this subassembly into Civil 3D and use a parameter reference to pass the output parameter into another subassembly as an input parameter Open the TaperShoulder.dwg or TaperShoulder_METRIC.dwg file This file has an assembly of a simple, road cross section with lanes, curbs, shoulders, and daylight links, as shown in Figure B1.31 both01.indd 12:37:2:PM/08/07/2015 Page 32 USING EXPRESSIONS | Figure B1.31 Road subassembly Open the Tool Palettes window From the Insert tab ➢ expanded Import panel, choose Import Subassemblies The Import Subassemblies dialog will be displayed 10 In the Import Subassemblies dialog, click the Folder button to display the Open dialog 11 Navigate to your saved TaperDouble.pkt file, select it, and click Open 12 Verify that the Import To: Tool Palette check box is selected, and select the Mastering tool palette you created in an earlier exercise 13 Click OK to accept the settings in the Import Subassemblies dialog, and add the subassembly to the Mastering tool palette Now you will add the TaperDouble calculation before the left and right shoulders The TaperDouble subassembly component will calculate the shoulder width and pass it to the shoulder subassembly using a parameter reference 14 Open the Tool palettes panel, and click the TaperDouble subassembly 15 Locate the Advanced-Parameters section on the Design tab of the AutoCAD Properties palette 16 Change the Start Value to 3′ (or m) and the End Value to 10′ (or m) 17 At the Select marker point within assembly or [Insert Replace Detached]: prompt, press I ↵ 18 At the Select the subassembly to insert after or [Before]: prompt, press B ↵ 19 At the Select the subassembly to insert ahead of: prompt, select the left shoulder, which is a LinkWidthAndSlope subassembly 20 At the Select an attachment point for the highlighted subassembly, or press enter to accept and continue: prompt, press ↵ Now you will the same thing to add the TaperDouble calculation before the right shoulder 21 At the Select the subassembly to insert after or [Before]: prompt, press B ↵ 22 At the Select the subassembly to insert ahead of: prompt, select the right shoulder 23 At the Select an attachment point for the highlighted subassembly, or press enter to accept and continue: prompt, press ↵ 24 Press ↵ again to end the command 25 Select and right-click the red assembly baseline marker and select Assembly Properties both01.indd 12:37:2:PM/08/07/2015 Page 33 33 34 | BONUS CHAPTER CUSTOM SUBASSEMBLIES 26 On the Construction tab, highlight the LinkWidthAndSlope subassembly in the Right group 27 In the Input Values area, select the check box in the Parameter Reference Use column for the Width value 28 In the Get Value From column next to the check box, select TaperDouble.Calculated Value, as shown in Figure B1.32 Figure B1.32 Setting the shoulder width using a parameter reference of the value calculated by the TaperDouble subassembly 29 Repeat steps 26 through 28 for the Left group 30 Click OK when complete When this exercise is complete, you can close the drawing A finished copy of this drawing (TaperShoulder_FINISHED.dwg or TaperShoulder_Metric_FINISHED.dwg) is available from the book’s web page By passing the value to a stock subassembly, you avoid having to re-create the entire stock subassembly just to incorporate an API function into the calculation of one parameter Employing Conditional Logic Decisions are the most common way you will define conditions that will have either a True or a False result There are two ways you can make decisions: One is with a Decision or Switch element, and the other is by using conditional logic operators in your expression If the decision is going to affect only one expression, you will want to use the conditional logic operators However, if the decision is going to have an effect on the flowchart logic, then you will use a Decision or Switch element Conditional Logic Operators There are numerous conditional logic operators that you will want to be familiar with as you define decision conditions Examples of these include the following: > or < P1.Y>P2.Y (or P1.Y= or =P2.Y (or P1.YP2.Y)AND(P2.X>P3.X) returns True if both the first condition located in a pair of parentheses and the second condition located in a pair of parentheses are true OR (P1.Y>P2.Y)OR(P2.X>P3.X) returns True as long as at least one of the conditions located in either pair of parentheses is true XOR (P1.Y>P2.Y)XOR(P2.X>P3.X) returns True if one of the conditions located in a pair of parentheses is true and the other condition located in a pair of parentheses is false Any of these operators could also be used in an If statement within any expression in order to test a condition and provide one of two different values In the following example expression for a slope value, the distance from auxiliary point AP1 to the target surface is calculated If it is greater than 0, meaning that AP1 is located above the surface (in fill), then the slope value will be –0.25 If the value is not greater than 0, meaning that AP1 is located below the surface (in cut), then the slope value will be 0.33 IF(AP1.DistanceToSurface(TargetSurface)>0,-0.25,0.33) With a combination of the right conditional logic operators, you can make all kinds of decisions Decision and Switch Elements You briefly saw an example of a Switch element in action earlier in this chapter when you learned about enumeration The Decision elements have a similar behavior but provide only two conditions: True or False The Decision element is located in the Tool Box ➢ Workflow branch along with the Switch element, Flowchart element, and Sequence element When you insert a Decision element into your flowchart and hover over it, you will see that the True condition will be out of the left side and the False condition will be out of the right side, as shown in Figure B1.33 Figure B1.33 A Decision element with True on the left and False on the right An easy way to remember which side is which is “Right side means the condition is wRong.” You can define the condition in the Properties panel by highlighting the element For example, you can specify AP1.DistanceToSurface(TargetSurface)>0 similar to the example expression discussed in the previous section However, notice that you did not need to specify in the expression what will happen if the answer is true or false; this is because you will specify the True and False through the use of the connection arrows out of the left and right sides of the Decision element both01.indd 12:37:2:PM/08/07/2015 Page 35 35 36 | BONUS CHAPTER CUSTOM SUBASSEMBLIES One of the benefits of using a Decision element in your flowchart instead of burying a conditional expression into an element is that finding them is easy because the flowchart is a visual representation of the logic There are a few things you can to make your decisions easy to follow in the flowchart, as shown in Figure B1.34 Figure B1.34 A defined Decision element with customized True and False connection arrow labels and the condition expression flyout The first thing you can is click the triangular flag in the upper-right corner of the element This will cause the condition expression to be displayed in a flyout The second thing you can is to further annotate the True and False connection arrow labels You can change these labels through the Decision element’s Properties panel In Figure B1.34, there are two elements named P1 This may confuse you because you have learned up until this point that every point, link, and shape must have a unique number, which is true—however, there is a caveat The elements must have a unique number along any given connection arrow path Because these elements are not along the same path, they may be duplicated Making Sense of Someone Else’s Thoughts There will come a time when you will open a PKT file that someone else made or that you made long ago Most likely you will open this confusing and complicated PKT file because you have found a mistake in how it behaves in Civil 3D or you want to edit it for different Civil 3D capabilities So instead of building the subassembly from scratch, you will need to understand how the subassembly was built In this last example, you will open a complex subassembly that was made to behave similarly to the Channel stock subassembly You have decided that instead of the baseline attachment point being at a point located above the midpoint of the bottom width, at a height equal to the Depth parameter, you want it at the midpoint of the bottom link Open the Channel.pkt or Channel_METRIC.pkt file The Channel subassembly in the Preview panel, as shown in Figure B1.35, should look similar to the subassembly shown in the Channel stock subassembly help file both01.indd 12:37:2:PM/08/07/2015 Page 36 MAKING SENSE OF SOMEONE ELSE’S THOUGHTS | Figure B1.35 The Channel subassembly in the Preview panel as shown in Roadway mode The flowchart looks like Figure B1.36 Figure B1.36 Complex flowchart for the Channel subassembly As you can see, the flowchart is full of decisions, sequences, and elements Thankfully, if you take a close look, you will see that the sequences are clearly labeled, as are the True and False labels, as shown in Figure B1.37 both01.indd 12:37:2:PM/08/07/2015 Page 37 37 38 | BONUS CHAPTER CUSTOM SUBASSEMBLIES Figure B1.37 Labeled elements in the complex flowchart Because the attachment point is typically one of the first elements defined, it should be pretty easy to find Double-click the Main Channel Points sequence element Be certain to double-click the actual element and not the text; otherwise, you will just select the name of the sequence for editing Click the element for point P1 You will notice that it also highlights in the Preview panel In the Properties panel, change the Delta Y value from -math.abs(Depth), as shown in Figure B1.38, to Figure B1.38 Labeled elements in the complex flowchart When you do, the whole subassembly will jump up to the origin The links at the right will disappear in Roadway mode This is because Roadway mode uses the targets that are set at locations that are no longer valid If you look at Event Viewer in the Settings/ Parameters panel, you will notice three errors about points that can’t be placed both01.indd 12:37:2:PM/08/07/2015 Page 38 MAKING SENSE OF SOMEONE ELSE’S THOUGHTS | These errors will disappear if you change the preview values of the right target parameters If you switch to Layout mode, your subassembly will use only the input parameter that matches Figure B1.39 Figure B1.39 The Channel subassembly with the bottom of the channel now at the baseline assembly marker shown in Layout mode math.abs(Depth)? You may have noticed the original expression that was used to define the Delta Y value of this point and wondered what it was doing math.abs() is an API function that fi nds the absolute value of the variable in the parentheses By first finding the absolute value of the input parameter, you avoid having an error occur if one user in Civil 3D thinks the Depth parameter should be a negative value and another user thinks it should be a positive value Although this was a simple change to a complex flowchart, it all started with finding the right location to change the variable Now that the attachment point is at the bottom of the channel, let’s make one more change to this subassembly You should add a link representing the water surface elevation and then define a shape for the water, as shown in the next steps In the Preview panel, zoom into the subassembly and you will notice that the depth points located at the top of the lining of the channel are at point P4 on the left and point P5 on the right On the Input/Output Parameters tab, change the value for LiningDepth to You will notice that the lining disappears but the depth points remain as P4 and P5 This is good because it means that you can define one link as the water surface that will be applicable to the subassembly with and without the lining From the Tool Box ➢ Geometry branch, drag a Link element to below point P5 in the Main Channel Points sequence This link will automatically be numbered L13 Define link L13 as follows: a Set Link Codes to “WaterSurface” Note that the quote marks are required in order to define this text as a string b Verify that Start Point is P4 and End Point is P5 both01.indd 12:37:2:PM/08/07/2015 Page 39 39 40 | BONUS CHAPTER CUSTOM SUBASSEMBLIES Click the word Flowchart in the upper-left corner of the Flowchart panel to return to the main flowchart You must now find an appropriate place to define the shape delineating the water 10 On the No Lining side of the first decision, double-click the Main Channel Links sequence element 11 From the Tool Box ➢ Geometry branch, drag a Shape element to below link L3 This shape will automatically be numbered S2 12 Define shape S2 as follows: a Set Shape Codes to “Water” Note that the quote marks are required in order to define this text as a string b Click the Select Shape In Preview button c Select inside the closed shape representing the water, as shown in Figure B1.40 Figure B1.40 Defining the water shape for the channel subassembly with no lining 13 On the Input/Output Parameters tab, change LiningDepth back to 0.333 (or 0.1 for metric) Notice that the water link remains, but the shape is no longer present This is because you defined the shape in a branch of the flowchart that isn’t being used when the lining is in place 14 Click the word Flowchart in the upper-left corner of the Flowchart panel to return to the main flowchart Now you must find an appropriate place to define the shape delineating the water for the subassembly when a lining is being used 15 On the Add Lining side of the first decision, double-click the Lining Links And Shape sequence element 16 From the Tool Box ➢ Geometry branch, drag a Shape element to below shape S1 This shape will automatically be numbered S3 If you want, you could renumber this shape to S2 because it is located in a different branch from the S2 previously defined 17 Define shape S3 as follows: both01.indd 12:37:2:PM/08/07/2015 Page 40 THE BOTTOM LINE | a Set Shape Codes to “Water” Note that the quote marks are required in order to define this text as a string b Click the Select Shape In Preview button c Select inside the closed shape representing the water, as shown in Figure B1.41 Figure B1.41 Defining the water shape for the channel subassembly with a lining You have now changed the attachment point from the depth location to the bottom of the channel, added a link at the water elevation, and defined a water shape When this exercise is complete, you can close the file A finished copy of this file (Channel_ modified.pkt or Channel_Metric_modified.pkt) is available from the book’s web page Sharing Custom Subassemblies PKT files are not part of the drawing fi le So, anytime you use a PKT fi le in a drawing, you must make the PKT fi le available for anyone who has to rebuild the corridor If a user does not fi rst import the subassembly into the drawing, they will receive an error message that says “One or more subassembly macros (or NET classes) could not be found Check Event Viewer for more information Continue? Yes/No.” In conjunction with the stock subassemblies already available in Civil 3D and the custom subassemblies you create with the Tool Box in the Subassembly Composer, your corridors will have endless possibilities The Bottom Line Defi ne input and output parameters with default values By providing detailed input parameters, you let the Civil 3D user edit your custom subassembly In addition, by providing detailed output parameters, you let them use the subassembly’s characteristics to edit the subsequent subassemblies in the assembly Master It Generate a new subassembly PKT file for a subassembly named MasteringLane (or MasteringLaneMetric) For input parameters, define the following: ◆ Side with a default value of Right ◆ LaneWidth provided as a double input type with a default value of 12 feet or 3.6 meters both01.indd 12:37:2:PM/08/07/2015 Page 41 41 42 | BONUS CHAPTER CUSTOM SUBASSEMBLIES ◆ LaneSlope provided as a percentage with a default value of –3 percent ◆ Depth provided as a double input type with a default value of 0.67 feet or 0.2 meters For output parameters, define the following: ◆ CalcLaneWidth provided as a double input type ◆ CalcLaneSlope provided as a percentage Solution On the Packet Settings tab, set Subassembly Name to MasteringLane (or MasteringLaneMetric) On the Input/Output Parameters tab, change Default Value for the Side input parameter to Right Click Create Parameter to add a new parameter for each of the input and output parameters with the following settings (note that the metric values are shown in parentheses if different from the Imperial values): Name Type Direction Default Value LaneWidth Double Input 12 (3.6) LaneSlope Grade Input -3% Depth Double Input 0.67 (0.2) CalcLaneWidth Double Output CalcLaneSlope Grade Output 50.00% When this exercise is complete, you can close the file A finished copy of this file (Mastering_InputOutput.pkt or Mastering_InputOutput_Metric.pkt) is available from the book’s web page Defi ne target offsets, target elevations, and/or target surfaces Targets allow the subassembly to reference unique items within the drawing They allow for varying widths, tapered elevations, and daylighting to a surface Master It For the same subassembly from the previous “Master It,” defi ne an elevation target named TargetLaneElevation with a preview value of –0.33 feet (or –0.1 meters) and an offset target named TargetLaneOffset with a preview value of 14 feet (or meters) Solution On the Target Parameters tab, click Create Parameter to add a new parameter Change Name to TargetLaneElevation, verify that Type is set to Elevation, and set Preview Value to –0.33 (or –0.1 for metric) Create another parameter, change Name to TargetLaneOffset, verify that Type is set to Offset, and set Preview Value to 14 (or for metric) both01.indd 12:37:2:PM/08/07/2015 Page 42 THE BOTTOM LINE | When this exercise is complete, you can close the file A finished copy of this file (Mastering_Target.pkt or Mastering_Target_Metric.pkt) is available from the book’s web page Generate a flowchart of subassembly logic using the elements in the Tool Box The Tool Box in Subassembly Composer is full of all sorts of tools But like a tool box in your garage, the tools are useful only if you know their capabilities and practice using them The simplest tools are points, links, and shapes, but there are also tools for more complex flowcharts Master It Define the subassembly using the width, slope, and depth input parameters defined earlier Make certain that if the slope of the lane changes based on the targets, then the top and the datum links have matching slopes The subassembly should have four points: P1 (“Crown”) located at the origin, P2 (“ETW”) located at the upper-right corner of the lane cross section (with both TargetLaneElevation and TargetLaneOffset), P3 (“Crown_Subbase”) at the lower left of the lane cross section, and P4 (“ETW_Subbase”) at the lower right of the lane cross section The subassembly should have four links: L1 (“Top”, “Pave”) connecting P1 and P2, L2 connecting P1 and P3, L3 (“Datum”, “Subbase”) connecting P3 and P4, and L4 connecting P2 and P4 The subassembly should have a shape: S1 (“Pave1”) Solution From the Tool Box ➢ Geometry branch, drag a Point element (P1) below the Start element Define point P1 as follows: a Set Point Codes to “Crown” b Verify that From Point is set to Origin From the Tool Box ➢ Geometry branch, drag a Point element (P2) to below P1 Define point P2 as follows: a Set Point Codes to “ETW” b Verify that Type is set to Slope And Delta X c Verify that From Point is set to P1 d Set Slope to LaneSlope e Set Delta X to LaneWidth f Set Offset Target (Overrides Delta X) to TargetLaneOffset g Set Elevation Target (Overrides Slope And Superelevation) to TargetLaneElevation h Verify that the Add Link To From Point check box is selected This link will automatically be numbered L1 i Set the Link ➢ Codes to “Top”, “Pave” both01.indd 12:37:2:PM/08/07/2015 Page 43 43 44 | BONUS CHAPTER CUSTOM SUBASSEMBLIES From the Tool Box ➢ Geometry branch, drag a Point element (P3) to below P2&L1 Define point P3 as follows: a Set Point Codes to “Crown_Subbase” b Verify that Type is set to Delta X and Delta Y c Verify that From Point is set to P1 d Set the Delta X to e Set the Delta Y to –Depth f Verify that the Add Link To From Point check box is selected This link will automatically be numbered L2 From the Tool Box ➢ Geometry branch, drag a Point element (P4) to below P3 and L2 Define point P4 as follows: a Set Point Codes to “ETW_Subbase” b Verify that Type is set to Delta X And Delta Y c Verify that From Point is set to P2 d Set Delta X to e Set Delta Y to –Depth f Verify that the Add Link To From Point check box is selected This link will automatically be numbered L3 g Change the name for this link to L4 From the Tool Box ➢ Geometry branch, drag a Link element (automatically numbered L5) to below P4 and L4 10 Define the link currently numbered L5 as follows: a Change Link Number to L3 b Set Link Codes to “Datum”, “Subbase” c Verify that Start Point is set to P3 d Verify that End Point is set to P4 11 From the Tool Box ➢ Geometry branch, drag a Shape element (S1) to below L3 12 Define shape S1 as follows: a Set Shape Codes to “Pave1” b Click the Select Shape In Preview button c Select inside the closed shape representing the lane both01.indd 12:37:2:PM/08/07/2015 Page 44 THE BOTTOM LINE | 13 From the Tool Box ➢ Miscellaneous branch, drag Set Output Parameter to below S1 14 Define Set Output Parameter as follows: a Verify that Output Parameter is set to CalcLaneWidth b Set Value to L1.xlength 15 From the Tool Box ➢ Miscellaneous branch, drag Set Output Parameter to below CalcLaneWidth 16 Define Set Output Parameter as follows: a Verify that Output Parameter is set to CalcLaneSlope b Set Value to L1.slope Note that there are other ways to define the points and links that will have the same end results When this exercise is complete, you can close the file A finished copy of this file (Mastering_Flowchart.pkt or Mastering_Flowchart_Metric.pkt) is available from the book’s web page Import a custom subassembly made with Subassembly Composer into Civil 3D A custom subassembly is no good if it is just made and not used By knowing how to import your PKT file into Civil 3D, you open up the world of building and sharing tool palettes full of subassemblies to help your office’s workflow Master It Import your MasteringLane or MasteringLaneMetric subassembly into Civil 3D Solution In Subassembly Composer, save your PKT file Open Civil 3D and create a new drawing using the _AutoCAD Civil 3D (Imperial) NCS or the _AutoCAD Civil 3D (Metric) NCS template From the Insert tab ➢ expanded Import panel, choose Import Subassemblies In the Import Subassemblies dialog, click the Folder button to display the Open dialog Navigate to your PKT file and click Open Verify that the Import To: Tool Palette check box is selected Using the drop-down, either select an existing tool palette or select Create New Palette from the bottom of the list to display the New Tool Palette dialog to defi ne a new palette using the Import Subassemblies dialog Click OK to accept the settings in the Import Subassemblies dialog both01.indd 12:37:2:PM/08/07/2015 Page 45 45 ... will be empty, as shown at the left in Figure B1 .23 both01.indd 12: 37 :2: PM/08/07 /20 15 Page 21 21 22 | BONUS CHAPTER CUSTOM SUBASSEMBLIES Figure B1 .23 An empty Sequence element (left) and a Sequence... Figure B1 .25 to Figure B1 .21 to see how much room a Sequence element can save Figure B1 .25 Organizing Flowchart elements in a sequence both01.indd 12: 37 :2: PM/08/07 /20 15 Page 22 CREATING A SUBASSEMBLY. .. numbered L2 h Set Codes to “Top”, “Sidewalk” Point P3 and link L2 are shown highlighted in Figure B1.14 Figure B1.14 Preview panel highlighting point P3 and link L2 both01.indd 12: 37 :2: PM/08/07 /20 15