Thursday, September 10, 2009

C3D 2010 Leader Vertex Overrides

Have you ever tried to anchor a text component to a line component which functioned as a landing to a leader?

And did you find that if you dragged the label over to its opposite side that the leader doesn't swap sides that it is anchored to automatically?

In the past we have handled this by creating two "duplicate" label styles, one behaving desirably when pulled to the left and the other behaving desirably when pulled to the right.


This is no longer necessary with Civil 3D 2010.  Now we have the ability to apply a leader vertex override and add additional leader vertices to existing labels for creating jogs in the leader lines.  With the diamond shaped grip, you can drag the leader vertex over and OSNAP it to the opposite side of the landing.  Clicking on the minus sign removes the vertex override returning the leader to its original location.  However clicking the plus sign allow you to define a jog in the leader line.

After applying such a leader override, be sure to use the original square shaped drag label grip to relocate the label components.  Clicking on the circular grip will reset the overridden leader to its original location as does the minus sign.  But clicking on the reset grip a second time will take the label to its original location out of drag state.

Tuesday, August 18, 2009

Autopopulating Custom Fields via VBA

I know that VBA didn't ship with AutoCAD 2010, but it did with Civil 3D 2010. And since old habits are hard to break, I continue to use it.

As I have stated before, building the perfect template may involve customization outside the DWT file. Sometimes the perfect template contains custom project fields. Wouldn't it be nice to be able to autopopulate these fields in other drawings?

Configure a userform and associate text box to a field:

Private Sub ProjectFields()
Dim oProjectKey As String
Dim oProjectValue As String
oProjectKey = "Project" 'name of custom field
ThisDrawing.SummaryInfo.SetCustomByKey oProjectKey, oProject
End Sub

When you hit the OK button, not only does the value get assigned to a field, but it gets written out to an XML file:

Private Sub ExportXML()
Dim strFileName As String
Dim FSO
Dim oXML
Dim oProjectKey As String
Dim oProjectValue As String
oProjectKey = "Project" 'name of custom field
ThisDrawing.SummaryInfo.GetCustomByKey oProjectKey, oProjectValue
strFileName = ActiveDocument.Path + "\" + "Project.xml" 'writes file in active DWG directory
Set FSO = CreateObject("Scripting.FileSystemObject")
Set oXML = FSO.CreateTextFile(strFileName, True)
oXML.WriteLine ("")
oXML.WriteLine ("")
oXML.Write ("")
oXML.Write (oProjectValue)
oXML.Write ("")
oXML.WriteLine
oXML.WriteLine ("")
oXML.Close
End Sub

Now when the userform initializes, it would be nice if the text boxes were autopopulated with values from the XML if set previously in another drawing (this required loading up the Microsoft XML, v6 reference):

Dim fSuccess As Boolean
Dim FSO
Dim oXML As MSXML2.DOMDocument
Dim oRoot As MSXML2.IXMLDOMNode
Dim oChild As MSXML2.IXMLDOMNode
Dim oChildren As MSXML2.IXMLDOMNodeList
Dim oProjectKey As String
Dim oProjectValue As String
oProjectKey = "Project"
Set oXML = New MSXML2.DOMDocument
oXML.async = False
oXML.validateOnParse = False
fSuccess = oXML.Load(ActiveDocument.Path + "\Project.xml")
If Not fSuccess Then
GoTo ExitHere
End If
Set oXML = New MSXML2.DOMDocument
oXML.async = False
oXML.validateOnParse = False
fSuccess = oXML.Load(ActiveDocument.Path + "\Project.xml")
If Not fSuccess Then
GoTo ExitHere
End If
Set oRoot = oXML.documentElement
Set oChildren = oRoot.childNodes
For Each oChild In oChildren
If oChild.nodeName = "ProjectValue" Then
oProjectValue = oChild.nodeTypedValue
End If
Next oChild
ThisDrawing.SummaryInfo.SetCustomByKey oProjectKey, oProjectValue
ThisDrawing.SummaryInfo.GetCustomByKey oProjectKey, oProjectValue
MainDialog.Project.Text = (oProjectValue) 'puts value in pertaining textbox in userform
ExitHere:
End Sub

All of this code is available in various places on the web. Just thought I would bring it together in one place.

Sunday, May 3, 2009

Non Style-based Civil 3D Customization

Outside styles and label styles, additional customization can be provided:

Pipe and Structure Libraries

Pipes and structures are three dimensional parametric parts. Not only must they be drawn, but values, extrusions, planes, and constraints must be configured as well. Creating a custom structure is not easy. If it were, then everyone would be making them and we would all be happy with our parts. There is a little bit of information available on various websites and blogs that can help with getting started. There are no books or classes on it unless you catch a quick one at AU. www.autodesk.com/au has some archived information that can be downloaded.

Custom Assembly Sets

Typical sections can be created and saved as blocks in the template or another DWG file. These blocks can be configured to be inserted and exploded via tool palettes. An advantage to setting up typical sections ahead of time in this manner is that code sets can be modified based on the subassemblies used in these sections. Also, pay items can be configured in these code sets for use with QTO.

In 2010, we can define an "assembly set" for use with the new intersection tool. An assembly set actually comes from an XML file definition that declares what assembly is to be used in full section, left half section, right half section, and on the curb return for primary and secondary roads. The XML file also stores the path and filename where the assemblies reside.

Plan Production Template(s)

The plan production template or sheet settings template contains layout configurations for plan, profile or plan & profile sheets. The sheets are arranged along an alignment and match lines are inserted where needed. You would configure your layout with viewport types and scales, border, north arrow, legend, typical notes... anything particular you would want to see on each of the sheets produced.

There has always been a debate about how the plan production template customization should be served:
  • Layouts in Civil 3D Styles Template - This option was preferred when plan production tools was initially released in 2007. The styles had to exist in the main template file so that they would exist in the newly created files. But this became unnecessary with the release of a service pack. Now, when sheet files are created, Civil 3D brings in the necessary styles.
  • Layouts in One Sheet Settings Template - This option would involve one plan production template. This template contains all layout situations: border, scaled viewports, viewport arrangements, etc.
  • Layouts in Multiple Sheet Settings Templates - When Civil 3D is creating sheets with this tool, each sheet file will contain all layout tabs from the sheet settings template. This is not ideal since this potentially could create a lot of useless layouts in one drawing. So a way to avoid the mess is to create one sheet settings template per configured layout.

Sheet Set Template(s) and Data Files

To fully implement sheet set manager, a custom sheet set data (DST) file should be set up. This file contains custom field values, block callout designations, and reference to a sheet set creation template with a configured layout tab and plot setup. The sheet set creation template does not require a configured viewport.

Project Template(s)

The easiest part of Civil 3D configuration is creating a project template which is simply a named folder containing subfolders that represent standard directory structure in your Civil 3D project. Project templates are selected when creating a data shortcuts folder or when creating a Vault project.

QTO Customization

Civil 3D 2010 comes with a feature called QTO that enables you to extract pay items from your design. Pay items can be configured to code sets (corridors pavement quantities) and part lists (pipe network quantities).Pay item information can be configured in a block definition. Pay item information can manually assigned to a block, Civil 3D point, linework, and hatch patterns.

Civil 3D 2010 comes with some pay items files and categorization files already customized. However, they are not complete. Civil 3D can extract quantities for area (pavement and sod), linear measurement (pipes and curb), and individually counted items (trees and lightpoles).

Hopefully, this has got your wheels turning a bit with regard to completing your Civil 3D customization.

Wednesday, April 8, 2009

Civil 3D Jewels

A brief discussion concerning marker styles...

Marker styles are Civil 3D jewels that can used for emphasis in other display styles.

  • Alignments can possess markers. Various marker styles can be assigned at different types of horizontal geometry intersections and other points of interest on alignments. Profiles can possess markers. Various marker styles can be assigned at different types of vertical geometry as well as vertical points of interest on alignments. Both alignments and profiles have a Markers tab that can be used to configure styles to these locations.
    Marker styles are assigned to codes sets to delineate the locations of intersecting links which can be very important when constructing an assembly.
  • Marker styles can be configured to feature line styles for projection into views.
  • Survey network styles use marker styles to delineate types of points observed in the field.
  • Survey figure styles use marker styles to illustrate various points of interest along an observed linear feature.
  • Marker styles can be configured to interference styles to mark where pipes are in conflict.
  • Marker styles can be assigned to certain types of labels that are not a part of a label set.
  • Marker styles can be selected at time of label creation.
Marker styles can be configured as you would AutoCAD points using the DDPTYPE command. Alternately, marker styles can use blocks. Either method allows you to scale the marker to a plotted height or a specified scale. Property overrides on the Display Properties tab do not affect styles using blocks as markers. Any property overrides for marker styles using blocks must be made in the block definition itself.

I recommend the use of separate marker styles if the same shape is being utilized in multiple styles. For instance, if a circle is being used in both an alignment style as well as an assembly code set, use two separate styles so that you can scale them independently of each other.

Thursday, March 19, 2009

Short PVI Extensions

http://c3dsupport.blogspot.com/2009/03/short-pvi-extensions-better-way.html

This is helpful to know if you are trying to build your perfect template. Peter Funk showed this to me when I was up in Manchester and my reaction was "duh" i.e. I couldn't believe I was doing it the hard way all this time.

Parcel Area – Commas

There is a wonderful trick on the Civil 3D Reminders blog on how to work commas in your parcel areas using one label style!

Click here to see the original blog: Parcel Area – Commas

Just to clarify, the trick involves six expressions:

  • HundredsSize: IF({Parcel Area}>1000,0.0000000000000001,0.1/12)
  • Hundreds: ({Parcel Area}/1000000-TRUNC({Parcel Area}/1000000))*1000
  • ThousandsSize: IF({Parcel Area}>1000, IF({Parcel Area}<1000000,0.1/12,0.0000000000000001),0.0000000000000001)
  • Thousands: {Parcel Area}/1000000
  • MillionsSize: IF({Parcel Area}>1000000,0.1/12,0.0000000000000001)
  • Millions: {Parcel Area}/1000000000

The label involves 4 text components: Parcel Name, Hundreds, Thousands, Millions

  • Parcel Name is the parcel name.
  • Hundreds is the area label configured for when parcel area is less than 1000.
  • Thousands is the area label configured for when parcel area is more than 1000 and les than 1,000,000.
  • Millions is the area label configured for when parcel area is more than 1,000,000.

The latter three components size themselves down to nothing as per the "Size" expressions listed above depending upon how their conditions check. In this example, labels will go in at 0.1" i.e. 0.1/12 as the expression reads. If you label using a smaller height like at 0.08", change each "Size" expression to use 0.08/12.

Think this is brilliant? Thank Christopher Fugitt who posted it at 12:31 AM this morning!

AU File & Object Layer Eccentricities

I developed a bare bones template working file for my 2008 AU class called "Building the Perfect Template-Making All of Your Civil 3D 2009 Dreams Come True". It was loaded up with sample styles and sample content. The style components are all configured to layer 0.

The object layers were configured to layer names prefixed with $. The reason for this was so that they would easily stand out if we spent a lot of time talking about them. Object layers cannot be simply renamed. You must create the new layer names and redirect the object layer items in Drawing Settings to the new layers. These new layers can be created with layer manager or with the "New" tool in the Layer Selection dialog box that appears when you click into the layer field in the Object Layer tab.

Object layers can easily be purged out of a drawing if they are not being used. This can be bad if you've configured color and linetype to them. If objects are created in an object layer that has been purged from a drawing, the layer will be recreated using color 7 and continuous linetype. No worries if you are leaning on component layers to define color and linetype for you.

Tuesday, March 17, 2009

Starting with a Blank Canvas

If you do want to use your own layer standard, text style, blocks and linetypes in your Civil 3D template and want to avoid issues with not being able to purge undesirable, existing content out of your template file, I always suggest that people create their template from acad.dwt. This will provide you with an empty file. You can then use Design Center to bring in your standards. However, there are some issues to be aware of before you start your customization:

Standard Styles are not at Ground Zero
The components in the Standard styles are set to use layer “0”, but are configured with color overrides and linetypes set to byblock. If you try to create a new style at the object level, your new style will be produced with the same settings. It would be ideal if colors and linetypes were both set to bylayer. If it were at least so in the Standard styles, we could create new styles with a copy with “Ground Zero” configuration.

Ambient, Feature & Command Settings
Always start at Drawing Settings and work your way down. If you examine the Ambient Settings tab in the Drawing Settings dialog, you’ll find that precisions for each of the units may not suit you. In addition, overrides have been placed for you. Personally, I like to have total command over the overrides so I kill them at the drawing level and reconfigure units, formats and precisions to my standards. Then I visit Feature Settings and Command Settings in case there are overrides I want to make in a particular area.

Label Style Defaults
There are some settings and overrides issues here as well. Killing the overrides at this level, setting the default orientation reference to “View”, and configuring text style and height will allow you to start dictating label standards at higher levels in your template. Make any adjustments on these settings at lower levels keeping in mind the Civil 3D hierarchy of settings.

The Standard text style is configured into all of the label settings and styles in the acad.dwt template. If you are open to using a text style called “Standard” as your standard with your preferred font settings, the modifications will be inherited in the labels, tables and views therefore cutting out a good amount of work. Although text style can be overridden at the drawing level for labels, view styles and table styles require that you open up each and make those changes.

In Conclusion
Addressing these issues will get you a “Ground Zero” template providing you a blank canvas to start your work. But you’ll get there faster if you download the following file in which all of these issues have already been addressed. C3D2009_Ground_Zero.DWT

Enjoy!

Tuesday, March 10, 2009

Productive Use of Name Formats with Object Layer Modifiers

In the prior post, I mentioned that using standard object naming conventions when using object layer modifiers would help keep the layer list standard. If you are using NCS-like layer names, consider this example to start the wheels turning:

Object layer: C-ALGN

Standard Object Names:
· RD1 (roadway)
· SS1 (sanitary sewer)
· ST1 (storm sewer)
· EP1 (edge of pavement)

Resulting Layers:
· C-ALGN-RD1
· C-ALGN-SS1
· C-ALGN- ST1
· C-ALGN- EP1

This of course is in conjunction with configuring object layers with a modifier suffix of “-*”.

It would be helpful to configure the more repetitious object name into the feature’s Default Name Format setting (feature settings). You may use the counter to assign the numbers behind your object type, but these numbers will probably be subject to manual manipulation.

Keep in mind that you can make overrides to these values in the feature’s command settings so that particular object names will be assigned when you execute particular commands. This functionality is useful when creating profiles. Creating a profile by surface usually results in an existing profile; creating profile from a layout usually results in a finished grade profile.

Object layer: C-PROF

Standard Object Names:
· XG1 (existing)
· FG1 (finished grade)

Resulting Layers:
· C- PROF -XG1
· C- PROF -FG1

This is a great way to get control of layers and object names so that people in your organization can move from one drawing to the next and still remain in a familiar environment.

Using Object Layers with No Objection

A difficult area of adoption in Civil 3D is the productive application of object layers. Since it is typical in our industry to layer every entity we draw, it becomes a challenge to retrofit a standard layer list that has been around for a decade to Civil 3D's object layer list. There are 3 basic approaches you can take in implementing object layers.

Object Zero Approach
Set all object layers to layer 0 (zero) and make sure that the Immediate and Independant Layer On/Off Control check box is filled. By using this method, you can skip configuring object layers and use the style component as the sole tool for controlling object display. Keep in mind that all object insertion layers will be layer 0; therefore freezing layer 0 will cause all objects to disappear. This method allows for quick adoption of Civil 3D since existing layer lists are usually suitable for style component configuration. And if you haven't decided how you stand on object layers, you can always configure them at a later date.

Component Zero Approach
This method is for the Civil 3D purest. Configure a suitable object layer for each object type. Leave all style components set to layer 0. The properties of your object layers will control the appearance of your objects. If there is a component of an object that needs to bear a different color, linetype, or lineweight, don't create a layer for it unless you want to have the ability to isolate it; instead, override the desired property in the style. This method allows you to utilize the least amount of layers in your drawing.

If this method suits you, then you may also want to consider using object layer modifiers. This enables you to create layers for each of your objects using the properties of the parent object layers. Each alignment, surface, profile, pipe network, etc will be generated in its own layer. To keep crazy layer names down to a minimum, it would be advantagious to adopt an object naming standard which can be applied to name formats in the template. Modifiers enable you to add the object name to the beginning or end of the object layer.

All or Nothing Approach
This is the more complex approach. Come up with a set of object layer names. Come up with a set component layer names. Configure everything. You will end up with a longer layer list. In the end, you will have more control over display of objects. You can use component layers to isolate features. You can use the object layers to control display of objects via external references or viewports.