Steven Didak posted a command to rebuild all corridors or rebuild all out of data corridors on his blog. He’s also got a great home office set up. His version was created for Civil 3D 2010 and is available as a dll file.
If you don’t have Civil 3D 2010 you can get the same functionality with the code below. Just change “AeccXUiRoadway.AeccRoadwayApplication.7.0” to match your version:
Civil 3D 2008: “AeccXUiRoadway.AeccRoadwayApplication.5.0”
Civil 3D 2009: “AeccXUiRoadway.AeccRoadwayApplication.6.0”
Civil 3D 2011: “AeccXUiRoadway.AeccRoadwayApplication.8.0” (Presumably this will be the value)
I started the code with the CorridorSample that ships with the product. The finished product may be downloaded here: http://style.civil3dreminders.com/UpdateCorridors.dvb
You’ll also need to update the references: http://blog.civil3dreminders.com/2008/09/updating-references.html
If you have dependent corridors, the code may have you end up with out of date corridor. Since updating in the wrong order could cause the other corridor to become out of date after it has been updated.
'
' MODULE_ID {Subroutines.bas}
' {CorridorSample.dvb}
'
' Copyright {2009} by Autodesk, Inc.
'
' Permission to use, copy, modify, and distribute this software for
' any purpose and without fee is hereby granted, provided that the
' above copyright notice appears in all copies and that both that
' copyright notice and the limited warranty and restricted rights
' notice below appear in all supporting documentation.
'
' AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS.
' AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF
' MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC.
' DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE
' UNINTERRUPTED OR ERROR FREE.
'
' Use, duplication, or disclosure by the U.S. Government is subject to
' restrictions set forth in FAR 52.227-19 (Commercial Computer
' Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii)
' (Rights in Technical Data and Computer Software), as applicable.
'
'
'
Option Explicit
'
' This sample demonstrates how to access various types
' of information about corridors that exist in the
' current document. It is hard-coded for use with the
' "Corridor-4b.dwg" file located in the Civil
' "Help\Civil 3D Tutorials\Drawings\" directory. The
' sample will work for other corridors, except that
' the volume surface test will not create a volume
' surface.
'
' Main entry point from the VBARUN dialog box.
'
Public g_oCivilApp As AeccRoadwayApplication
Public g_oRoadwayDocument As AeccRoadwayDocument
Public g_oRoadwayDatabase As AeccRoadwayDatabase
'
' Start Civil 3D and create Civil 3D document and database objects
' for use with corridor objects.
'
Function GetBaseCivilObjects() As Boolean
Dim oApp As AcadApplication
Set oApp = ThisDrawing.Application
' NOTE - Always specify the version number.
Const sAppName = "AeccXUiRoadway.AeccRoadwayApplication.7.0"
Set g_oCivilApp = oApp.GetInterfaceObject(sAppName)
If (g_oCivilApp Is Nothing) Then
MsgBox "Error creating " & sAppName & ", exit."
GetBaseCivilObjects = False
Exit Function
End If
Set g_oRoadwayDocument = g_oCivilApp.ActiveDocument
Set g_oRoadwayDatabase = g_oRoadwayDocument.Database
GetBaseCivilObjects = True
End Function
' Added update corridor routine.
Sub UpdateAllCorridors()
'always get the objects again since MDI is supported
If (GetBaseCivilObjects = False) Then
Exit Sub
End If
Dim oCorridor As AeccCorridor
For Each oCorridor In g_oRoadwayDocument.Corridors
oCorridor.Rebuild
Next
End Sub
Sub UpdateOODCorridors()
'always get the objects again since MDI is supported
If (GetBaseCivilObjects = False) Then
Exit Sub
End If
Dim oCorridor As AeccCorridor
For Each oCorridor In g_oRoadwayDocument.Corridors
If oCorridor.OutOfDate = True Then
oCorridor.Rebuild
End If
Next
End Sub
No comments:
Post a Comment