2017년 2월 27일 월요일

[C#] To download files on the FTP using WebClient class

Following example is to download guestbook.file on the FTP using WebClient class.
That FTP needs login. It's very simple example.
When you need more detail option, you can use HttpClient;
But HttpClient is supported on the .Net Framework 4.5.

-----------------------------------------------------------------------------------------------


using System.Net;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main()
        {
            WebClient wc = new WebClient { Proxy = null };
            wc.BaseAddress = "ftp://ftp.albahari.com";
            string username = "nutshell";
            string password = "oreilly";
            wc.Credentials = new NetworkCredential(username, password);

            wc.DownloadFile("guestbook.txt", @"d:\guestbook.txt");
        }
    }
}

[C#] To download content on the internet using WebClient

Following example is to download a website content using WebClient.
It's very simple.


2017년 2월 24일 금요일

[Civil3D2015 개발자 가이드 번역] Creating Custom Subassemblies Using .NET

.NET을 사용해서 사용자 Subassembly를 생성하기

이 절의 주제
  • Overview
  • Subassembly 변경사항
  • 사용자 Subassemblies 설계하기
  • Subassembly Programs의 구조
  • VB.NET Subassembly 샘플
  • The Subassembly Tool Catalog
  • Custom Subassemblies를 설치하기
  • Package File을 사용해서 사용자 Subassemblies 를 내보내기

Overview

이 장은 Visual Basic .NET을 사용해서 사용자 subassembly를 생성하는 방법을 설명한다. 이 것은 현재 지원되고 있으며 사용자 subassembly를 만들기중 선호하는 방법이다.
이 장은 설계 고려사항, subassembly program의 구조, 그리고 VB에서 예제 subassembly를 설명한다. 예제는 사용자 subassembly를 위한 탬플릿으로 사용할 수 있다.

Subassembly 변경사항

AutoCAD Civil3D 2015에서 “대상 매핑” 기능에 변화가  생겼다, 이 변화는 사용자 subassembly가 쓰여진 방법에 관한 것이다. 이 기능은 현재 subassembly가 선형과 종단에 추가되는 object type으로 지정되도록 한다. 선형과 종단은 코리더와 연관되고, 그것의 기하학 정보를 정의하기 위해 요구된다. 더이 기능에 대한 더 많은 정보는, Setting and Editing Targets in the AutoCAD Civil 3D User’s Guide를 보라
사용자 subassembly를 만드는 방법에는 4가지 변경사항이 있다.
  1. ParamLogicalNameType에 새 파라미터 타입
  2. corridorState에 새 대상 collection
  3. 대상은 이제 object이다.
  4. CalcAlignmentOffsetToThisAlignment 매서드가 변경되었다.

ParamLogicalNameType에 새 파라미터 타입

Subassembly는 이제 offset target과 elevation target을 지정할 수 있다.(선형과 종단 대신) 이들은 ParamLogicalNameType에서 새 파라미터 타입에 의해서 표현된다.만약 당신의 subassembly에 새 target type을 지원하기를 원한다면, 교체할 필요가 있다 :
  • ParamLogicalNameType.Alignment with
    • ParamLogicalNameType.OffsetTarget — offset targets that are alignments, feature lines, survey figures and AutoCAD polylines OR
    • ParamLogicalNameType.OffsetTargetPipe — offset targets that are pipe networks
  • ParamLogicalNameType.Profile with
    • ParamLogicalNameType.ElevationTarget — elevation targets that are profiles, feature lines, survey figures and AutoCAD 3D polylines OR
    • ParamLogicalNameType.ElevationTargetPipe — elevation targets that are pipe networks

corridorState의 새 target collections

corridorState object에서 offset과 elevation target collection을 가져오려면 , ParamsAlignment와 ParamsProfile 대신 ParamsOffsetTarget과 ParamElevationTargett을 사용하라. 모든 offset target은 ParamsOffsetTarget에 있다, 그리고 모든 elevation target은 ParamsElevationTarget에 있다. 여기 BasicLaneTransition.vb 샘플에서 가져온 예제가 있다. 이 샘플은 VB.NET  :
       Dim oParamsLong As ParamLongCollection
       oParamsLong = corridorState.ParamsLong

       Dim oParamsOffsetTarget As ParamOffsetTargetCollection
       oParamsOffsetTarget = corridorState.ParamsOffsetTarget

Target은 이제 object이다.

Target은 이제 선형이나 종단 ID가 아닌 object이다. 이제 WidthOffsetTarget이offset target을 위해 정의 되고, SlopeElevationTarget이 elevation target을 위해서 정의된다, 그래서 당신은 ID대신 object로 target을 선언할 수 있다. 여기 BasicLaneTransition.vb 샘플에서 가져온 예제가 있다. 이 샘플은 VB.NET  :
       Dim offsetTarget As WidthOffsetTarget 'width or offset target
       offsetTarget = Nothing
       Dim elevationTarget As SlopeElevationTarget 'slope or elevation target
       elevationTarget = Nothing

CalcAlignmentOffsetToThisAlignment()로 변경된다.

CalcAlignmentOffsetToThisAlignment() 유틸리티 매서드는 현재 선형에서 offset 대상까지의 offset 을 계산한다. 이 매서드는 더이상 측점값을 리턴하지 않는다; 그것은 이제 선형의 측점에 수직인 점에서 offset 대상의 XY 좌표를 리턴한다.
CalcAlignmentOffsetToThisAlignment()를 사용하는것 대신 SlopeElevationTarget.GetElevation 매서드를 사용해서 elevation 대상에서의 elevation을 직접 가져올 수도 있다. 여기 BasicLaneTransition.vb 샘플에서 가져온 예제가 있다. 이 샘플은 VB.NET  :
               'get elevation on elevationTarget
               Try
                   dOffsetElev = elevationTarget.GetElevation(oCurrentAlignmentId, _
                      corridorState.CurrentStation, Utilities.GetSide(vSide))
               Catch
                   Utilities.RecordWarning(corridorState, _
                      CorridorError.LogicalNameNotFound, _
                      "TargetHA", "BasicLaneTransition")
                   dOffsetElev = corridorState.CurrentElevation + vWidth * vSlope
               End Try

사용자 Subassembly를 설계하기

이 장은 사용자 subassembly를 설계하기 위한 요구사항을 설명한다.
이 절의 주제
  • 사용자 Subassembly 이름 정하기
  • 첨부 및 삽입 방법론
  • 사용자 정의 파라미터 대 하드코드된 파라미터
  • 입력 파라미터 타입
  • 편경사 동작과 Subassembly
  • Subassembly 도움말 파일 만들기

사용자 Subassembly 이름 정하기

  • Space나 특수 문자를 사용하지 마라.
  • 각 단어의 첫번째 문자를 대문자를 사용해서 대문자와 소문자를 조합해서 사용하라.
  • component의 유형을 첫번째 단어로 만드는 것으로 Subassembly를 그룹화 하라. 예를들어, AutoCAD Civil 3D Corridor Modeling 카탈로그에서 모든 lane subassembly이름은 “Lane”으로 시작하고, 모든 길어깨는 “Shoulder”로 시작한다.

부착과 삽입 방법론

대부분의 subassembly component는 한개의 부착점을 가지고 한방향 또는 다른 점으로 연장된다. 하지만, 이 일반적인 규칙에 대해 몇가지 예외사항이 있다.
아래 리스트는 subassembly의 세가지 카테고리에 대한 부착과 삽입 방법론을 설명한다 : 중분대, 2 도로를 연결하는 구성요소, 그리고 재활 및 오버레이
  • 중분대. 중분대는 중심선에 대해 동시에 왼쪽 오른쪽 방향 모두에 삽입되는 경향이 있다(corridor 기준 선형이 필요하지 않다). 더욱이, 이 부착점은 중분대 면 링크에 있는 점이 아닐지도 모른다. 예를들어, 내려앉은 중분대 subassembly의 부착점은 내부 edges-of-traveled-way 의 elevation에 있는 중분대 도랑위일수도 있다.
  • 2 도로를 연결하는 구성요소. 모델링이 한개의 corridor 모델에 도로가 분리될때, 그것은 종종 fill slope 교점을 추가하거나 도로의 edge에서 다른데로 연결할 필요가 있다. 일반적으로, 가능하면 첫번째 도로만큼의  구성요소를 조합한다, baseline을 변경하고 2번째 도로의 구성요소를 조합한다, 그런다음 특별한 subassembly를 사용해서 2 도로사이를 연결한다. 이 경우에, 2 부착점이 필요하게 된다. 한쪽은 일반 부착점으로 subassembly를 생성하고, 다른쪽은 이전에 정의한 표시점에 부착하는 것으로 이것을 하라.
  • 재활 및 오버레이. 일반적으로, strip pavement, level, 그리고 기존도로에 겹쳐지는 용으로 사용된 subassembly는 선형과 종단의 중심선을 사용하기 보다 기존 도로 단면의 형상을 관련있게 계산하는 것을 기준으로 배치된다. 예를 들어, pavement 오버레이 subassembly는 주어진 설계경사에 대해 기존 pavement에서의 최소 수직 거리를 필요로 할수도 있다. 확폭차선 subassembly는 기존 edge-of-traveled-way에 부착되고, 기존 차선경사와 일치할 필요가 있을 수 있다.

사용자 정의 vs. 하드코드된 파라미터

지오메트릭 치수, 동작 그리고 방법론의 결정은 subassembly로 하드코드되고 사용자 정의 입력 파라미터에 의해서 제어될 것이다.
한가지 방법은 대부분의 항목을 사용자 입력으로 제어할 수 있도록 지정하는 것이다. 이것은 subassembly를 사용하는데 시간과 복잡성이 추가 될 수 있다. 또 다른 방법은 만드는 것이다. 다른 상황에 끼워넣을 수 없도록 만드는 것이다. 일반적으로, 폭, 깊이, 그리고 경사는 변할 수 있어야 한다, 고정이 되면 안된다. 타협점은 더 많은 수의 입력을 포함하지만, 대부분의 설계상황에서 사용가능한 기본값을 제공하는 것이다.
하드코드된 치수를 사용하는 좋은 예는 barrier이나 curb-and-gutter 형태같은 구조물 구성요소이다. 만약 다른 치수의 같은 기본형상의 5가지 공통사용 변수가 있다면, 1개의 subassembly에 사용자 정의 치수를 만드는것 보다, 5가지 분리된 subassembly(하드코드된 치수의)를 제공하는 것이 더 좋을수도 있다. 예를 들어, 사용자는 curb 타입 A-E로 분리된 subassembly에서 편안한 선택이 될 수 있다. 이때 A-E타입은 미리 정의된 하드코드된 치수이다. 당신은 항상 일반적인 경우가 아닌 시나리오를 위한 다양한 치수의 일반적인 subassembly를 제공할 수 있다.

입력 파라미터 종류

아래 테이블은 입력 파라미터의 다양한 종류를 설명한다.

Input Parameter
Description
Widths
도로 assembly에서 2점 사이의 횡단 수평거리. Widths는 보통 양수값으로 주어지고, subassembly의 삽입방향으로 확장된다. width를 필요로 하는 많은 component들이 선택적 대상 파라미터로 선형을 사용할 가능성이 있다. Width는 대상이 주어진다면 그 선형에 맞춰서 각각의 측점에서 계산이 된다.
Offsets
Corridor 기준선에서 도로assembly에 있는 점까지의 횡단면 수평거리이다. Offset과 Width의 차이점은 Width는 subassembly의 어떤 점에서 측정이 되고, Offset은 Corridor 기준선에서 측정이 된다. 양수와 음수는 기준선의 오른쪽 또는 왼쪽을 의미한다. Offset을 필요로 하는 Component는 아마도 선형을 사용해서 계산된 offset을 사용하게 될 것이다.
% Slopes
차선, 길어깨 그리고 다른 component는 보통 경사를 가지고 있다.
이 경사는 rise-to-run(상승대 진행)의 비율로 정의된다. 이런것들을 표현하는 2가지 일반적인 방법이 관례가 있다. 그들은 단위가 없는 비율(-0.05)같은 또는 퍼센트 값(-5%) 모두 가능하다. 이 예들 모두 5% 경사 아래로 가는것을 의미한다. 같은 관례가 카테고리에서 모든 subassembly에 대해 사용되어야 한다. 몇가지 경우, 당신은 component가 다양한 경사를 가지고 있어서, 종단에 적용하기를 원할수도 있다. 종단이름은 대상파라미터로 주어질 수 있다.
Ratio Slopes
절토 경사, 성토 경사, 측구 측면 경사, 중분대 경사 그리고 많은 다른 도로 구성요소들은 일반적으로 run-to-rise 비율로 표현된다. 이것은 4:1처럼과 같은 방식으로 표현된다. 이들은 값이 표현될수도 안될수도 있는데, 상황에 따라 다르다, 그래서 사용자가 ‘-4’와 같은 값으로 입력하는 것을 필요로 하지 않을지도 모른다.
Point, Link, and Shape Codes
대부분의 경우, 점, 링크, 그리고 shape코드는 하드코딩되어야 일관된 코드가 전체 assembly에 할당된다. 기본 예외는 일반링크 subassembly이다. 이 subassembly는 사용자가 링크를 필요에 따라 assembly에 추가하도록 한다. 이것들은 포장되거나 그렇지 않은 마감처리, 구조물 구성요소, 포장층, 그리고 많은 다른 예상치못한 구성요소를 위해 사용될수도 있다. 이런 시나리오에서, 사용자는 점, 링크, 그리고 shape코드에 좌표를 를 할당한다. 이 좌표는 assembly위에 있다.

편경사 동작과 Subassembly

도로가 일반 crown 상황 또는 편경사에 있을때 와 같은  component 동작에서 차이점을 고려해야 한다.  측구와 중분대 subassembly는 일반과 편경사 단면에서 다른 동작으로 설계될수 있다.
Corridor 선형의 편경사속성은 도로의 모든 측점에서 차선과 길어깨 경사를 정의한다. 하지만, 이런 경사길은 조합에 의해서 적용된다. 이 조합은 subassembly가 layout모드와 subassembly의 내부 로직에서 조작되는 방법에 의한 조합이다. 여러 기관마다 다양한 방법론이 있다. subassembly뒤의 코드가 그것이 대부분의 상황에 대하여 적용되는 것을 가능하게 한다.
당신은 편경사 pivot 점이 위치한 곳과 점이 종단 경사 선(PGL) 설계에 어떻게 관련이 있는지를 결정할 필요가 있다. Pivot 점/PGL 조합은 일반적으로 다음과 같다:
  • Pivot 점과 PGL은 모두 도로의 crown에 있다.
  • Pivot 점과 PGL은 분리도로에서 edge-of-traveled-way안쪽에 있다.
  • Pivot 점과 PGL은 비분리도로에서 한개의 edge-of-traveled-way에 있다.
  • Pivot 점은 curve의 안쪽에 있는 edge-of-traveled-way에 있고, PGL은 도로의 중심선에 있다.
  • Crown된 도로의 분리도로에서, PGL은 crown 점에 있고, pivot 점은 edge-of-traveled-way안쪽에 있다.
  • Crownd되지 않은 도로의 분리 도로에서, PGL과 pivot 점은 중심선에 있는 중분대위에 있다.
상황이 어떻든, subassembly는 올바른 동작으로 배치될 수 있도록 설계되어야 한다.
때때로 도로 구성요소들은 편경사 단면에서 특별한 동작을 한다. 몇가지 특별한 편경사 동작의 예:
  • Broken Back Subbase. Some agencies put a break point in the subbase layer on the high side of superelevation. The subbase parallels the finish grade up to a certain point, then extends at a downward slope until it intersects the shoulder or clear zone link.
  • Shoulder Breakover. Usually a maximum slope difference, or breakover, must be maintained between the travel lane and the shoulder, or between the paved and unpaved shoulder links.
  • Curbs-and-Gutters. Some agencies require that gutters on the high side of a superelevated road tip downward toward the low side, while others leave the gutters at their normal slope.
Note:
당신의 커스텀 subassembly를 만들때, 실행중에 AutoCAD가 AutoCAD Civil3D subassembly연산을 호출하고, 인터럽트하는 코드를 만드는 것을 피하라. 예를 들어, 단면 set을 만드는 것을 피하라.

회전축 Pivot 점 계산 노트

이 장은 편경사와 회전계산축을 사용하는 subassembly를 생성할때 호출되어야 하는 매서드를 설명한다.
  • 만약 assembly에 있는 한개의 subassembly가 잠재적 pivot으로 지정된다면, 그 사이에 있는 모든 subasembly 와 편경사를 사용하는 기준선은 편경사 횡단 경사데이타를 corridor에 보고해야 한다. 이때는 Autodesk.Civil.Runtime.CorridorState 매서드를 사용한다:
Public Sub SetAxisOfRotationInformation (ByVal isPotentialPivot As Boolean, ByVal superElevationSlope As Double, ByVal superElevationSlopeType As Autodesk.Civil.Land.SuperelevationCrossSegmentType, ByVal isReversedSlope As Boolean)
superElevationSlope 는 subassembly에서 사용된 횡단 경사이다. 회전축의 올바른 동작을 위해서, 그것은  superelevation 표에 있는 superElevationSlopeType에서 획득한 값이어야 한다. 만약 표에서 획득한 그 값이 어떤 방법으로든 조정되면, 회전축은 아마 동작하지 않을 것이다.
isReversedSlope  True로 설정한다. True는 적용된 횡단 경사가 음수임을 표시한다. 이 횡단 경사는 편경사 표에서 가져온 값이다.
  • The LaneSuperelevationAOR subassembly는 AutoCAD Civil 3D content에 제공되고, 회전축 pivot 점을 지원한다. 만약 LaneSuperelevationAOR(또는 pivot 점을 지원하는 커스텀 subassembly)가 assembly에 포함되지 않으면, Calculate Superelevation 위저드에서 정의된 pivot type은 무시된다. 그리고 기준선 Pivot 타입이 적용된다. 커스텀 subassembly는 SetAxisOfRotationInformation()을 호출할때 isPotentialPivot 인자에 True를 주는 것으로 회전축 pivot점을 지원할 수 있다.  
  • 분리 corwn된 도로에 중심 pivot을 결정하려면, pivot을 지원하는 subassembly에 지정된 crown 점을 사용한다. Corridor를 만들때 회전축 계산에 사용될 crown 점을 지정하려면, Autodeks.Civil.Runtime.CorridorState 매서드를 사용하라.:
Public Sub SetAxisOfRotationCrownPoint (ByVal nCrownPointIndex As UInteger)
  • assembly layout 모드에서 crown 점을 표시하려면, subassembly 속성 “SE AOR Crown Point For Layer”가 crown point의 인덱스로 설정되어야 한다. 이 속성을 설정하려면, Utilities 클래스에 있는 다음 매서드를 호출하라:
Public Shared Sub SetSEAORCrownPointForLayout (ByVal corridorState As CorridorState, ByVal nCrownPoint As Integer)
  • the axis of rotation calculation assumes that the recorded cross slope is applied to the full width of the subassembly in its calculation. The starting offset will be the smallest offset in a subassembly drawn to the right, and the largest offset for a subassembly drawn to the left. If the subassembly is applying the cross slope to just a portion of the subassembly, record the starting and ending offsets of this range with the corridor using the Autodesk.Civil.Runtime.CorridorState method:
  • Public Sub SetAxisOfRotationSERange (ByVal dApplySE_StartOffset As Double, ByVal dApplySE_EndOffset As Double)
  • Only one set of axis of rotation information can be recorded per assembly. This means that the calculated delta Y value is the same no matter which point in the subassembly is used as the attachment point. Therefore, if a subassembly applies multiple cross slopes, or a single cross slope affects only certain point in the subassembly, only the pivot location will be correctly calculated and recorded to the corridor.
  • 만약 subassembly가 편경사를 사용하지만, corridor에 편경사 횡단 경사 데이타를 기록하지 않는다면, corridor에게 알려줘야 한다. 그래서 corridor가 경고를 발행할 수 있도록 한다. 회전축 결과가 예측되지 않을 수 있다는 경고이다. Corridor에 알리기 위해, Utilities 클래스에 잇는 다음 매서드를 호출하라.
Public Shared Sub SetSEAORUnsupportedTag (ByVal corridorState As CorridorState)
  • 만약 subassembly가 조건부로 회전축을 지원한다면, unsupported flag를 clear할 필요가 있을수도 있다. flag를 clear하려면, 다음 매서드를 호출하라. 그 매서드는 Utilities class에 있다. :
Public Shared Sub ClearSEAORUnsupportedTag (ByVal corridorState As CorridorState)

Subassembly 도움말 파일 만들기

Each subassembly included in the AutoCAD Civil 3D Corridor Modeling catalog has a Help file that provides detailed construction and behavior information. You can display the Help file for the AutoCAD Civil 3D Corridor Modeling subassemblies using any of the following methods:
  • From a Tool Palette. Right-click a subassembly in a tool palette, then click Help.
  • From a Tool Catalog. Right-click a subassembly in a tool catalog, then click Help.
  • From the Subassembly Properties dialog box Parameters tab. Right-click a subassembly in the Prospector tree, then click Properties Parameters tab Subassembly Help.
When creating custom subassemblies, you should also create a custom Help file to accompany the subassembly. You can use a Microsoft Compiled HTML Help file (.chm) to create the subassembly Help file. The Help file content and style should be similar to that in the AutoCAD Civil 3D Subassembly Reference Help. The table below describes the sections that should be included, as a minimum, in subassembly Help files. This information is required so that users understand the subassembly behavior and intended use.
Section
Description
Title
The name of the selected subassembly should appear prominently as the top heading of the subassembly Help file.
Descriptions
A brief description of the subassembly that includes the type of component the subassembly creates (for example, a lane, median, or shoulder), special features, and situations it is designed to cover.
Subassembly Diagram
The subassembly diagram should be a schematic showing the geometry of the component that is created by the subassembly. Diagrams should label as many of the input parameters as feasible, especially those pertaining to dimensions and slopes. You may need to include multiple subassembly diagrams for different behavior and/or conditions in order to include all of the possible input items. The subassembly diagram should also show the subassembly reference point, which is the point on the subassembly where it is attached when building an assembly layout. It is useful to adopt diagramming conventions that help the user understand the operations. For example, the subassemblies included in the AutoCAD Civil 3D Corridor Modeling catalog use bold blue lines to represent links that are added to the assembly by the subassembly. This helps to show adjacent roadway components that the subassembly might attach to in a lighter line with a background color. Ideally, dimension lines and labels should also be a different color.
Attachment
Describes where the attachment point is located relative to the subassembly links.
Input Parameters
Describes each of the user-definable input parameters that can be specified when using the subassembly. These should precisely match the parameter names and order seen by the user when using the assembly layout tool, and should describe the effect of each parameter. These are best presented in a table that includes a description of each parameter, the type of input expected, and default values for metric or imperial unit projects. For input parameters for slope values, note that there are two common ways of specifying slopes: as a percent value like -2%, or as a run-to-rise ratio like 4 : 1. Any slope parameter should clearly specify which type is expected. In the subassemblies included in the AutoCAD Civil 3D Corridor Modeling catalog, the convention is to precede the word “Slope” with the “%” character in the parameter name if a percent slope is expected. Otherwise a ratio value is required. Note the practice of using positive numeric values for both cut and fill slopes. If a slope parameter is known to be used only in a fill condition, it should not be necessary for the user to have to specify a negative slope value. However, in a more generic situation, for example with the LinkWidthAndSlope subassembly, a signed value may be necessary.
Target Parameters
Describes the parameters in the subassembly that can be mapped to one or more target objects.
Input parameters are defined when building an assembly in layout mode. Target parameters are substitutions that can be made for input parameters when applying the assembly to a corridor model. Typically, subassembly parameters that can use a target object to define a width or an offset can use the following types of objects to define that width or offset: alignments, AutoCAD polylines, feature lines, or survey figures. Similarly, subassembly parameters that can use a target object to define an elevation can use the following types of objects to define that elevation: profiles, AutoCAD 3D polylines, feature lines, or survey figures. Subassemblies that can use a target object to define a surface can only use a surface object to define that surface. A few subassemblies allow you to use pipe network objects as targets, such as the TrenchPipe subassemblies.
A typical scenario is a travel lane where the width is a numeric input parameter, which can use an alignment as a target parameter to replace the numeric width. The given numeric width is used when displaying the lane in layout mode. If an alignment is given, the width is calculated at each station during corridor modeling to tie to the offset of the alignment. For more information, see Setting and Editing Targets in the AutoCAD Civil 3D User's Guide Help.
Behavior
Describes the behavior of the subassembly in detail. If necessary, this section should include diagrams showing different behaviors in different conditions. This section should provide both the subassembly programmer and the end user with all of the information needed to understand exactly what the subassembly does in all circumstances. Subheadings are recommended if the Behavior section covers several different topics.
Layout Mode Operation
During the process of creating an assembly from subassemblies, also known as the assembly layout mode, specific information such as alignment offsets, superelevation slopes, profile elevations, and surface data, are not known. The Layout Mode Operation section of the subassembly Help file describes how the subassembly is displayed in the assembly layout mode. Layout mode refers to an assembly that has not yet been applied to a corridor. Some subassemblies behave differently in different situations. For example, a Daylight type of subassembly may create different geometric shapes depending on whether it is in a cut or fill situation. Shoulders may behave differently for normal crown and superelevated roadways. In layout mode, the subassembly designer must specify some arbitrary choices as to how the subassembly is displayed. It should appear as much like the final result in the corridor model as possible. Lanes and shoulders, for example, should be shown at typical normal crown slopes. Where there is alternate geometry, such as for the cut and fill daylight cases, both cases should be shown. Also, links that extend to a surface should be shown with arrowheads indicating the direction of extension.
Layout Mode Diagram
A diagram illustrating layout mode behavior and visual representation is useful if layout mode behavior and/or visual representation of the subassembly differs significantly between layout mode when the assembly and its associated subassemblies are applied to a corridor.
Point, Link, and Shape Codes
Describes the items that are hard-coded into the subassembly, including dimensions, point codes, link codes, and shape codes. Common practice is to reference the point, link, and shape codes to labels on the coding diagram.
Coding Diagram
The coding diagram has a twofold purpose. First, it labels the point, link, and shape numbers referred to in the previous section. Secondly, it provides the subassembly programmer with a numbering scheme for points, links, and shapes. These should correspond to the array indices used in the script for points, links, and shapes. This is to make it easier to later modify or add to the subassembly.
After creating the custom Help files for custom subassemblies, you must reference the Help files in the tool catalog .atc file associated with the subassemblies. For more information, see Sample Tool Catalog ATC File.

Subassembly 프로그램의 구조

이 절의 주제

Subassembly 탬플릿 (SATemplate.vb)

모든 커스텀 subassembly는 SATemplate 클래스에서 상속된 클래스로 정의된다. SATemplate는 override할수 있는 4개의 매서드를 제공한다. 이 매서드는 당신 소유의 클래스에서 override할 수 있다. 그 클래스는 당신의 subassembly의 기능을 제공하기 위한것이다. 그들은 다음 테이블에 설명된다.

Overridable Method
Overriding 목적
GetLogicalNamesImplement
(input: CorridorState)
대상 파라미터의 목록을 정의한다. “Set All Logical Names” dialog에 나타나는 목록이고, 이 dialog는 corridor 모델을 생성할때 사용된다.
GetInputParametersImplement
(input: CorridorState)
입력 파라미터의 목록을 정의한다. 이 파라미터는 이름, 타입, 그리고 기본값을 포함한다.
GetOutputParametersImplement
(input: CorridorState)
출력 파라미터의 목록을 정의한다. 이 파리미터는 이름, 타입, 그리고 기본값을 포함한다. 만약 파라미터가 입력과 출력용으로 사용된다면, 그 속성은 이 함수에서 지정된다.
DrawImplement
(input: CorridorState)
Override되어야 한다. 파리미터 접근을 위해 코드를 포함하고, subassembly의 쉐이프를 조정하는 코드를 포함하고, 그리고 당신의 subassembly를 구성하는 점, 링크, 쉐이프를 기존 assembly에 추가하는 코드를 포함한다.
SATemplate.vb<AutoCAD Civil 3D Install Directory>\Sample\Civil 3D API\C3DStockSubAssemblies directory 에 있다.

Corridor State Object

CorridorState 타입의 object에 대한 참조는 당신이 재정이 하는 SATemplate 매서드의 각각 으로 전달된다. CorridorState object는 커스텀 subassembly와 subassembly가 연결하는 현재 assembly의 점, 링크, 그리고 쉐이프의 collection사이의 기본 인터페이스이다. 그것은 subassembly의 형상에 영향을 줄수 있는 현재 선형, 종단, 측점, offset, elevation그리고 style을 참조한다.  그것은 또한 다양한 파라미터 버켓을 포함한다. 파라미터 버켓은 파라미터 수집을 위해 사용된다. 파라미터 타입은 boolean, long, double, string, alignment, profile, surface, 그리고 point이다. 각 파라미터는 정확한 이름과 값에 의해서 정의된다.
CorridorState 매서드는 corridor 설계를 위한 유용한 계산함수를 제공한다. 다음과 같다.:
IntersectAlignment
간격 띄우기 선형과 횡단을 가로 지르는 선의 교점을 찾는다.
IntersectLink
Assembly에 있는 링크와 횡단을 가로지르는 선의 교점을 찾는다.
IntersectSurface
지표면과 횡단을 가로지르는 선의 교점을 찾는다.
IsAboveSurface
Subassembly 점이 지표면의 위또는 아래에 있는지 결정한다.
SampleSection
지표면에서 횡단면 링크의 셋을 구성한다.
SoeToXyz
XyzToSoe
측점, offset, elevation 좌표와 x, y, z 좌표 사이를 변환한다.

지원 파일 (CodesSpecific.vb, Utilities.vb)

당신은 subassembly에서 2개의 지원 파일(CodesSpecific.vb와 Utilities.vb)를 사용할 수 있다.
Codesspecific.vb는 CodeType과 AllCodes 구조체와 전역변수 코드를 제공한다. - 모든 코드정보가 채워진 AllCodes 구조체의 인스턴스)
Utilities.vb는 몇가지 공유 핼퍼함수를 제공한다. 에러를 처리하고, subassembly geometry를 계산하고, code string을 부착하고 그리고 다른 작업들을 한다. 예를 들어, “parameter not found” 에러를 AutoCAD Civil 3D 이벤트 뷰어에 보고하려면 다음 라인을 사용하면 된다. :
Utilities.RecordError( _
  corridorState, _
  CorridorError.ParameterNotFound, _
  "Edge Offset", _
  "BasicLaneTransition")
다음 표는 Utility class에 있는 모든 함수의 목록이다.
Utility function
Description
RecordError
Sends an error message to the Event Viewer.
RecordWarning
Sends a warning to the Event Viewer.
AdjustOffset
For a given offset from an offset baseline, this function computes the actual offset from the base baseline.
GetVersion
Returns the version number of the subassembly as specified in the . atc file.
GetAlignmentAndOrigin
Returns the assembly and the origin point for the subassembly.
CalcElevationOnSurface
Given a surface Id, alignment Id, a station, and an offset from the station, this returns the elevation of the surface at that location.
GetRoundingCurve
Returns an array of points along a curve where it will be tessellated, given a series of parameters describing the curve and how it is to be tessellated.
CalcAlignmentOffsetToThisAlignment
Calculates the offset from this alignment to an offset target, and returns the XY coordinate of the offset target at the point perpendicular to this alignment's station
AddCodeToLink
Adds a series of code strings to a particular link. The parameter i identifies which set of code strings to use. The parameter iLinks contains the collection of all links in an applied subassembly. The parameter linkIndex identifies which link in the link collection is given the code strings. The strArrCode parameter is a two-dimensional array of code strings. The first dimension identifies which set of codes to use, and the second dimension contains a variable-length array of code strings.
AddCodeToPoint
Adds a series of code strings to a particular point. The parameter i identifies which set of code strings to use. The parameter iPoints contains the collection of all points in an applied subassembly. The parameter pointIndex identifies which point in the point collection is given the code strings. The strArrCode parameter is a two-dimensional array of code strings. The first dimension identifies which set of codes to use, and the second dimension contains a variable-length array of code strings.
IsProjectUnitsFeet
Returns True if the corridor is modeled in Imperial units, False if modeled in metric.
GetProjectUnitsDivisor
Returns the value to go from the general units of measurement to smaller units of measurement. If the corridor is modeled in feet, this will return 12 to allow you to compute the number of inches. If the corridor is modeled in meters, this will return 1000 to allow you to compute the number of millimeters.
GetSlope
Returns the percent slope of the alignment superelevation at the specified assembly section. The first parameter is a two-letter string indicates the part of the roadway to use. The first letter can be “S” for shoulder or “L” for lane. The second letter can be “I” for inside or “O” for outside. To determine the slope of the left side of the road, set the fourth parameter to True. To determine the slope of the right side, set the fourth parameter to False.
AddPoints
Given arrays of X and Y locations and code strings, this creates an array of Point objects (AeccRoadwayPoint objects) and a PointsCollection object (AeccRoadwayPoints object).
GetMarkedPoint
Given the string name of a point, returns the point object.
The CodesSpecific.vb and Utilities.vb files are located in the <AutoCAD Civil 3D Install Directory>\Sample\Civil 3D API\C3DStockSubAssemblies directory.

Sample VB.NET Subassembly

다음 클래스 모듈은 BasicLaneTransition subassembly를 정의한다. 이것은 Stock Subassemblies 카칼로그에 제공된다. 이것을 위한 원본 소스코드와 AutoCAD Civil 3D와 함께 설치된 다른 모든 subassembly는 <AutoCAD Civil 3D Install Directory>\Sample\Civil 3D API\C3DStockSubAssemblies\Subassemblies directory 에서 찾을 수 있다.
코드를 리뷰하기 전에 당신은 subassembly와 친해져야 한다. 그것이 subassembly coding diagram에서 절토및 성토 조건에서 동작하는 방식, 점과 링크 코드가 접근되는 방식, 그리고 점과 링크 개수가 지정되는 방식에 대해서 익숙해져야 한다. BasicLaneTransition subassembly Help를 참고하라.
Option Explicit On
Option Strict Off
Imports System.Math
Imports DBTransactionManager = Autodesk.AutoCAD.DatabaseServices.TransactionManager
' *************************************************************************
' *************************************************************************
' *************************************************************************
'          Name: BasicLaneTransition
'
'   Description: Creates a simple cross-sectional representation of a corridor
'                lane composed of a single closed shape.  Attachment origin
'                is at top, most inside portion of lane.  The lane can
'                transition its width and cross-slope based on the position
'                supplied by an optional horizontal and vertical alignment.
'
' Logical Names: Name        Type     Optional   Default value    Description
'                --------------------------------------------------------------
'                TargetHA    Alg      yes        none             Horizontal alignment to transition to
'                TargetVA    Profile  yes        none             Vertical alignment to transition to
'
'    Parameters: Name            Type     Optional    Default Value    Description
'                ------------------------------------------------------------------
'                Side            long     yes        Right           specifies side to place SA on
'                Width           double   yes        12.0             width of lane
'                Depth           double   yes         0.667           depth of coarse
'                Slope           double   yes        -0.02               cross-slope of lane
'                TransitionType  long     yes        2                hold grade, move to offset HA
'                InsertionPoint  long     yes        kCrown           Specifies insertion point of the lane either at (a) Crown or (b) Edge of Travel Way
'                CrownPtOnInside Long     no         g_iTrue         Specifies that inside edge of travelway to be coded as Crown
' *************************************************************************
Public Class BasicLaneTransition
   Inherits SATemplate
   Private Enum InsertionPoint
       kCrown = 0
       kEdgeOfTravelWay = 1
   End Enum
   Private Enum TransitionTypes ' Transition types supported
       kHoldOffsetAndElevation = 0
       kHoldElevationChangeOffset = 1
       kHoldGradeChangeOffset = 2
       kHoldOffsetChangeElevation = 3
       kChangeOffsetAndElevation = 4
   End Enum
   ' --------------------------------------------------------------------------
   ' Default values for input parameters
   Private Const SideDefault = Utilities.Right
   Private Const InsertionPointDefault = InsertionPoint.kCrown
   Private Const CrownPtOnInsideDefault = Utilities.IFalse
   Private Const LaneWidthDefault = 12.0#
   Private Const LaneDepthDefault = 0.667
   Private Const LaneSlopeDefault = -0.02    '0.25 inch per foot
   Private Const HoldOriginalPositionDefault = TransitionTypes.kHoldOffsetAndElevation
   Protected Overrides Sub GetLogicalNamesImplement(ByVal corridorState As CorridorState)
       MyBase.GetLogicalNamesImplement(corridorState)
       ' Retrieve parameter buckets from the corridor state
       Dim oParamsLong As ParamLongCollection
       oParamsLong = corridorState.ParamsLong
       ' Add the logical names we use in this script
       Dim oParamLong As ParamLong
       oParamLong = oParamsLong.Add("TargetHA", ParamLogicalNameType.OffsetTarget)
       oParamLong.DisplayName = "690"
       oParamLong = oParamsLong.Add("TargetVA", ParamLogicalNameType.ElevationTarget)
       oParamLong.DisplayName = "691"
   End Sub
   Protected Overrides Sub GetInputParametersImplement(ByVal corridorState As CorridorState)
       MyBase.GetInputParametersImplement(corridorState)
       ' Retrieve parameter buckets from the corridor state
       Dim oParamsLong As ParamLongCollection
       oParamsLong = corridorState.ParamsLong
       Dim oParamsDouble As ParamDoubleCollection
       oParamsDouble = corridorState.ParamsDouble
       ' Add the input parameters we use in this script
       oParamsLong.Add(Utilities.Side, SideDefault)
       oParamsLong.Add("InsertionPoint", InsertionPointDefault)
       oParamsLong.Add("CrownPtOnInside", CrownPtOnInsideDefault)
       oParamsDouble.Add("Width", LaneWidthDefault)
       oParamsDouble.Add("Depth", LaneDepthDefault)
       oParamsDouble.Add("Slope", LaneSlopeDefault)
       oParamsLong.Add("TransitionType", HoldOriginalPositionDefault)
   End Sub
   Protected Overrides Sub DrawImplement(ByVal corridorState As CorridorState)
       ' Retrieve parameter buckets from the corridor state
       Dim oParamsDouble As ParamDoubleCollection
       oParamsDouble = corridorState.ParamsDouble
       Dim oParamsLong As ParamLongCollection
       oParamsLong = corridorState.ParamsLong
       Dim oParamsOffsetTarget As ParamOffsetTargetCollection
       oParamsOffsetTarget = corridorState.ParamsOffsetTarget
       Dim oParamsElevationTarget As ParamElevationTargetCollection
       oParamsElevationTarget = corridorState.ParamsElevationTarget
       '---------------------------------------------------------
       ' flip about Y-axis
       Dim vSide As Long
       Try
           vSide = oParamsLong.Value(Utilities.Side)
       Catch
           vSide = SideDefault
       End Try
       Dim dFlip As Double
       dFlip = 1.0#
       If vSide = Utilities.Left Then
           dFlip = -1.0#
       End If
       '---------------------------------------------------------
       ' Transition type
       Dim vTransitionType As Long
       Try
           vTransitionType = oParamsLong.Value("TransitionType")
       Catch
           vTransitionType = HoldOriginalPositionDefault
       End Try
       '---------------------------------------------------------
       ' Insertion Ponit
       Dim vInsertionPoint As Long
       Try
           vInsertionPoint = oParamsLong.Value("InsertionPoint")
       Catch
           vInsertionPoint = InsertionPointDefault
       End Try
       Dim vCrownPtOnInside As Long
       Try
           vCrownPtOnInside = oParamsLong.Value("CrownPtOnInside")
       Catch
           vCrownPtOnInside = CrownPtOnInsideDefault
       End Try
       '---------------------------------------------------------
       ' BasicLaneTransition dimensions
       Dim vWidth As Double
       Try
           vWidth = oParamsDouble.Value("Width")
       Catch
           vWidth = LaneWidthDefault
       End Try
       Dim vDepth As Double
       Try
           vDepth = oParamsDouble.Value("Depth")
       Catch
           vDepth = LaneDepthDefault
       End Try
       Dim vSlope As Double
       Try
           vSlope = oParamsDouble.Value("Slope")
       Catch
           vSlope = LaneSlopeDefault
       End Try
       '-------------------------------------------------------
       ' Get version, and convert values if necessary
       Dim sVersion As String
       sVersion = Utilities.GetVersion(corridorState)
       If sVersion <> Utilities.R2005 Then
           'need not change
       Else
           'R2005
           'convert %slope to tangent value
           vSlope = vSlope / 100
       End If
       Dim nVersion As Integer
       nVersion = Utilities.GetVersionInt(corridorState)
       If nVersion < 2010 Then
           vCrownPtOnInside = Utilities.ITrue
       End If
       '---------------------------------------------------------
       ' Check user input
       If vWidth <= 0 Then
           Utilities.RecordError(corridorState, CorridorError.ValueShouldNotBeLessThanOrEqualToZero, "Width", "BasicLaneTransition")
           vWidth = LaneWidthDefault
       End If
       If vDepth <= 0 Then
           Utilities.RecordError(corridorState, CorridorError.ValueShouldNotBeLessThanOrEqualToZero, "Depth", "BasicLaneTransition")
           vDepth = LaneDepthDefault
       End If
       ' Calculate the current alignment and origin according to the assembly offset
       Dim oCurrentAlignmentId As ObjectId
       Dim oOrigin As New PointInMem
       Utilities.GetAlignmentAndOrigin(corridorState, oCurrentAlignmentId, oOrigin)
       '---------------------------------------------------------
       ' Define codes for points, links and shapes
       Dim sPointCodeArray(0 To 4, 0) As String
       Dim sLinkCodeArray(0 To 2, 0 To 1) As String
       Dim sShapeCodeArray(0 To 1) As String
       FillCodesFromTable(sPointCodeArray, sLinkCodeArray, sShapeCodeArray, vCrownPtOnInside)
       '---------------------------------------------------------
       ' Get alignment and profile we're currently working from
       Dim offsetTarget As WidthOffsetTarget 'width or offset target
       offsetTarget = Nothing
       Dim elevationTarget As SlopeElevationTarget 'slope or elvation target
       elevationTarget = Nothing
       Dim dOffsetToTargetHA As Double
       Dim dOffsetElev As Double
       If corridorState.Mode = CorridorMode.Layout Then
           vTransitionType = TransitionTypes.kHoldOffsetAndElevation
       End If
       Dim dXOnTarget As Double
       Dim dYOnTarget As Double
       Select Case vTransitionType
           Case TransitionTypes.kHoldOffsetAndElevation
           Case TransitionTypes.kHoldElevationChangeOffset
               'oHA must exist
               Try
                   offsetTarget = oParamsOffsetTarget.Value("TargetHA")
               Catch
                   'Utilities.RecordError(corridorState, CorridorError.ParameterNotFound, "Edge Offset", "BasicLaneTransition")
                   'Exit Sub
               End Try
               'get offset to targetHA
               If False = Utilities.CalcAlignmentOffsetToThisAlignment(oCurrentAlignmentId, corridorState.CurrentStation, offsetTarget, Utilities.GetSide(vSide), dOffsetToTargetHA, dXOnTarget, dYOnTarget) Then
                   Utilities.RecordWarning(corridorState, CorridorError.LogicalNameNotFound, "TargetHA", "BasicLaneTransition")
                   dOffsetToTargetHA = vWidth + oOrigin.Offset
               Else
                   If (dOffsetToTargetHA = oOrigin.Offset) Or ((dOffsetToTargetHA > oOrigin.Offset) And (vSide = Utilities.Left)) Or _
                       ((dOffsetToTargetHA < oOrigin.Offset) And (vSide = Utilities.Right)) Then
                       Utilities.RecordWarning(corridorState, CorridorError.ValueInABadPosition, "TargetHA", "BasicLaneTransition")
                       dOffsetToTargetHA = vWidth + oOrigin.Offset
                   End If
               End If
           Case TransitionTypes.kHoldGradeChangeOffset
               'oHA must exist
               Try
                   offsetTarget = oParamsOffsetTarget.Value("TargetHA")
               Catch
                   'Utilities.RecordError(corridorState, CorridorError.ParameterNotFound, "Edge Offset", "BasicLaneTransition")
                   'Exit Sub
               End Try
               'get offset to targetHA
               If False = Utilities.CalcAlignmentOffsetToThisAlignment(oCurrentAlignmentId, corridorState.CurrentStation, offsetTarget, Utilities.GetSide(vSide), dOffsetToTargetHA, dXOnTarget, dYOnTarget) Then
                   Utilities.RecordWarning(corridorState, CorridorError.LogicalNameNotFound, "TargetHA", "BasicLaneTransition")
                   dOffsetToTargetHA = vWidth + oOrigin.Offset
               Else
                   If (((dOffsetToTargetHA > oOrigin.Offset) And (vSide = Utilities.Left)) Or _
                       ((dOffsetToTargetHA < oOrigin.Offset) And (vSide = Utilities.Right))) Then
                       Utilities.RecordWarning(corridorState, CorridorError.ValueInABadPosition, "TargetHA", "BasicLaneTransition")
                       dOffsetToTargetHA = vWidth + oOrigin.Offset
                   End If
               End If
           Case TransitionTypes.kHoldOffsetChangeElevation
               'oVA must exist
               Try
                   elevationTarget = oParamsElevationTarget.Value("TargetVA")
               Catch
                   'Utilities.RecordError(corridorState, CorridorError.ParameterNotFound, "Edge Elevation", "BasicLaneTransition")
                   'Exit Sub
               End Try
               Dim db As Database = HostApplicationServices.WorkingDatabase
               Dim tm As DBTransactionManager = db.TransactionManager
               Dim oProfile As Profile = Nothing
               'get elevation on elevationTarget
               Try
                   dOffsetElev = elevationTarget.GetElevation(oCurrentAlignmentId, corridorState.CurrentStation, Utilities.GetSide(vSide))
               Catch
                   Utilities.RecordWarning(corridorState, CorridorError.LogicalNameNotFound, "TargetHA", "BasicLaneTransition")
                   dOffsetElev = corridorState.CurrentElevation + vWidth * vSlope
               End Try
           Case TransitionTypes.kChangeOffsetAndElevation
               'both oHA and oVA must exist
               Try
                   offsetTarget = oParamsOffsetTarget.Value("TargetHA")
               Catch
                   'Utilities.RecordError(corridorState, CorridorError.ParameterNotFound, "Edge Offset", "BasicLaneTransition")
                   'Exit Sub
               End Try
               Try
                   elevationTarget = oParamsElevationTarget.Value("TargetVA")
               Catch
                   'Utilities.RecordError(corridorState, CorridorError.ParameterNotFound, "Edge Elevation", "BasicLaneTransition")
                   'Exit Sub
               End Try
               'get elevation on elevationTarget
               Try
                   dOffsetElev = elevationTarget.GetElevation(oCurrentAlignmentId, corridorState.CurrentStation, Utilities.GetSide(vSide))
               Catch
                   Utilities.RecordWarning(corridorState, CorridorError.LogicalNameNotFound, "TargetHA", "BasicLaneTransition")
                   dOffsetElev = corridorState.CurrentElevation + vWidth * vSlope
               End Try
               'get offset to targetHA
               If False = Utilities.CalcAlignmentOffsetToThisAlignment(oCurrentAlignmentId, corridorState.CurrentStation, offsetTarget, Utilities.GetSide(vSide), dOffsetToTargetHA, dXOnTarget, dYOnTarget) Then
                   Utilities.RecordWarning(corridorState, CorridorError.LogicalNameNotFound, "TargetHA", "BasicLaneTransition")
                   dOffsetToTargetHA = vWidth + oOrigin.Offset
               Else
                   If (dOffsetToTargetHA = oOrigin.Offset) Or ((dOffsetToTargetHA > oOrigin.Offset) And (vSide = Utilities.Left)) Or _
                       ((dOffsetToTargetHA < oOrigin.Offset) And (vSide = Utilities.Right)) Then
                       Utilities.RecordWarning(corridorState, CorridorError.ValueInABadPosition, "TargetHA", "BasicLaneTransition")
                       dOffsetToTargetHA = vWidth + oOrigin.Offset
                   End If
               End If
       End Select
       '---------------------------------------------------------
       ' Create the subassembly points
       Dim corridorPoints As PointCollection
       corridorPoints = corridorState.Points
       Dim dX As Double
       Dim dy As Double
       dX = 0.0#
       dy = 0.0#
       Dim oPoint1 As Point
       oPoint1 = corridorPoints.Add(dX, dy, "")
       ' compute outside position of lane
       Select Case vTransitionType
           Case TransitionTypes.kHoldOffsetAndElevation
               ' hold original position (always used in layout mode)
               dX = vWidth
               dy = Abs(vWidth) * vSlope
           Case TransitionTypes.kHoldElevationChangeOffset
               ' hold original elevation, move offset to that of TargetHA
               'dX = Abs(dOffsetToTargetHA - corridorState.CurrentSubassemblyOffset)
               dX = Abs(dOffsetToTargetHA - oOrigin.Offset)
               dy = Abs(vWidth) * vSlope
           Case TransitionTypes.kHoldGradeChangeOffset
               ' hold original grade, move offset to that of TargetHA
               ' (also used if TargetVA is not defined)
               'dX = Abs(dOffsetToTargetHA - corridorState.CurrentSubassemblyOffset)
               dX = Abs(dOffsetToTargetHA - oOrigin.Offset)
               dy = Abs(dX) * vSlope
           Case TransitionTypes.kHoldOffsetChangeElevation
               ' hold original offset, but change elevation to that of TargetVA
               dX = vWidth
               'dY = dOffsetElev - corridorState.CurrentSubassemblyElevation
               dy = dOffsetElev - oOrigin.Elevation
           Case TransitionTypes.kChangeOffsetAndElevation
               ' move position to that of TargetHA, and elevation to that of TargetVA
               dX = Abs(dOffsetToTargetHA - oOrigin.Offset)
               dy = dOffsetElev - oOrigin.Elevation
       End Select
       '------------------------------------------------------------------
       Dim dActualWidth As Double
       dActualWidth = dX
       Dim dActualSlope As Double
       If 0 = dActualWidth Then
           dActualSlope = 0.0#
       Else
           dActualSlope = dy / Abs(dActualWidth)
       End If
       '------------------------------------------------------------------
       Dim oPoint2 As Point
       oPoint2 = corridorPoints.Add(dX * dFlip, dy, "")
       dX = dX - 0.001
       dy = dy - vDepth
       Dim oPoint3 As Point
       oPoint3 = corridorPoints.Add(dX * dFlip, dy, "")
       dX = 0.0#
       dy = -vDepth
       Dim oPoint4 As Point
       oPoint4 = corridorPoints.Add(dX, dy, "")
       If vInsertionPoint = InsertionPoint.kCrown Then
           Utilities.AddCodeToPoint(1, corridorPoints, oPoint1.Index, sPointCodeArray)
           Utilities.AddCodeToPoint(2, corridorPoints, oPoint2.Index, sPointCodeArray)
           Utilities.AddCodeToPoint(3, corridorPoints, oPoint3.Index, sPointCodeArray)
           Utilities.AddCodeToPoint(4, corridorPoints, oPoint4.Index, sPointCodeArray)
       Else
           Utilities.AddCodeToPoint(2, corridorPoints, oPoint1.Index, sPointCodeArray)
           Utilities.AddCodeToPoint(1, corridorPoints, oPoint2.Index, sPointCodeArray)
           Utilities.AddCodeToPoint(4, corridorPoints, oPoint3.Index, sPointCodeArray)
           Utilities.AddCodeToPoint(3, corridorPoints, oPoint4.Index, sPointCodeArray)
       End If
       '---------------------------------------------------------
       ' Create the subassembly links
       Dim oCorridorLinks As LinkCollection
       oCorridorLinks = corridorState.Links
       Dim oPoint(1) As Point
       Dim oLink(3) As Link
       oPoint(0) = oPoint1
       oPoint(1) = oPoint2
       oLink(0) = oCorridorLinks.Add(oPoint, "") 'L1
       oPoint(0) = oPoint2
       oPoint(1) = oPoint3
       oLink(1) = oCorridorLinks.Add(oPoint, "") 'L2
       oPoint(0) = oPoint3
       oPoint(1) = oPoint4
       oLink(2) = oCorridorLinks.Add(oPoint, "") 'L3
       oPoint(0) = oPoint4
       oPoint(1) = oPoint1
       oLink(3) = oCorridorLinks.Add(oPoint, "") 'L4
       Utilities.AddCodeToLink(1, oCorridorLinks, oLink(0).Index, sLinkCodeArray)
       Utilities.AddCodeToLink(2, oCorridorLinks, oLink(2).Index, sLinkCodeArray)
       '---------------------------------------------------------
       ' Create the subassembly shapes
       Dim corridorShapes As ShapeCollection
       corridorShapes = corridorState.Shapes
       corridorShapes.Add(oLink, sShapeCodeArray(1))
       '---------------------------------------------------------
       '---------------------------------------------------------
       ' Write back all the Calculated values of the input parameters into the RoadwayState object.
       ' Because they may be different from the default design values,
       ' we should write them back to make sure that the RoadwayState object
       ' contains the Actual information of the parameters.
       oParamsLong.Add(Utilities.Side, vSide)
       oParamsLong.Add("InsertionPoint", vInsertionPoint)
       oParamsLong.Add("CrownPtOnInside", vCrownPtOnInside)
       oParamsDouble.Add("Width", Math.Abs(dActualWidth))
       oParamsDouble.Add("Depth", vDepth)
       oParamsDouble.Add("Slope", dActualSlope)
       oParamsLong.Add("TransitionType", vTransitionType)
   End Sub
   Protected Sub FillCodesFromTable(ByVal sPointCodeArray(,) As String, ByVal sLinkCodeArray(,) As String, ByVal sShapeCodeArray() As String, ByVal CrownPtOnInside As Long)
       If CrownPtOnInside = Utilities.ITrue Then
           sPointCodeArray(1, 0) = Codes.Crown.Code
       Else
           sPointCodeArray(1, 0) = ""
       End If
       sPointCodeArray(2, 0) = Codes.ETW.Code
       sPointCodeArray(3, 0) = Codes.ETWSubBase.Code 'P4
       If CrownPtOnInside = Utilities.ITrue Then
           sPointCodeArray(4, 0) = Codes.CrownSubBase.Code 'P3
       Else
           sPointCodeArray(4, 0) = "" 'P3
       End If
       sLinkCodeArray(1, 0) = Codes.Top.Code
       sLinkCodeArray(1, 1) = Codes.Pave.Code
       sLinkCodeArray(2, 0) = Codes.Datum.Code
       sLinkCodeArray(2, 1) = Codes.SubBase.Code
       sShapeCodeArray(1) = Codes.Pave1.Code
   End Sub
End Class

Subassembly 툴 카탈로그

이 절의 주제

Overview

Autodesk 툴 카탈로그는 사용자화된 subassembly의 그룹을 조직화 하고, AutoCAD Civil 3D user가 사용할 수 있도록 한다. Autodesk 툴 카탈로그는 .atc(Autodesk Tool Catalog) 확장자의 xml형식의 파일을 사용해서 정의된다. 당신은 또한 카탈로그를 윈도우 registry에 등록되도록 해야 하기 때문에 카탈로그 registry 파일을 생성할 필요가 있다. .atc파일과 registry파일에 있는 몇몇 항목은  GUID(Global Unique Identifiers)같은 알려진유일한 식별자를 포함해야 한다. 새로운 GUID는 GuidGen.exe를 사용해서 생성될 수 있다. GuidGen.exe는 많은 Microsoft developement 제품에 포함되어 있고, Microsoft Web site에서 무료로 다운로드 할 수 있다.
subassembly를 위한 툴 카탈로그 만들기
  1. Notepad나 다른 적당한 편집기를 사용해서, <Name>ToolsCatalog.atc이름의 ASCII text 파일을 생성하라.<Name>은 이 새로운 툴 카탈로그의 이름이다.  이 파일의 내용에 대한 정보는 다음을 참조하라. Creating a Tool Catalog ATC File.
Note: ATC 파일의 XML 태그는 대소문자를 구분한다. 당신의 태그가 이 장에서 설명된 태그의 대소문자와 일치하도록 하라.
  1. 당신의 툴 카탈로그가 저장되는 위치에 .atc 파일을 저장하라. 기본 위치는 . (현재 디렉토리)이다.
  2. 옵션 파일을 생성하라, 카탈로그에 표시될 아이콘을 위한 이미지  그리고 subassembly를 위한 도움말 파일같은 것을 생성하고, 적당한 참조위치에 이런 파일들을 배치하라.
  3. Notepad나 다른 text 편집기를 사용해서, .reg 확장자의 툴 카탈로그를 위한 registry 파일을 생성하라. 더 많은 정보는Creating a Tool Catalog Registry File 를 보라.
  4. .reg 파일에서 더블클릭을 해서 툴 카탈로그를 등록하라. 한번만 등록하면, subassembly 툴 카탈로그는 AutoCAD Civil 3D 컨텐츠 브라우져에 표시될 것이다.

툴 카탈로그 ATC 파일 생성하기

이 절의 주제

툴 카탈로그 ATC 파일 샘플

툴 카탈로그 .atc 파일 샘플은 Autodesk subassembly 툴 카탈로그의 컨텐츠와 구성을 정의한다. 이들은 일반적으로 파일 관리를 할수 있도록 유지하기위해 파일을 별도의 파일로 분할한다. : 툴의 모든 카탈로그들의 목록과 한개의 카탈로그 안에 있는 툴의 목록이다.
Note:
ATC 파일에 있는 XML 태그는 대소문자를 구분한다. 당신의 파일에 있는 태그가 이 장에서 정의된 태그와 일치하도록 해야한다.

주 카탈로그 파일 예제

다음은 “Autodesk Civil 3D Metric Corridor Catalog.atc.” 파일의 일부이다. 그것은 툴 카탈로그의 목록을 포함한다. 컨텐츠의 설명을 위해서 샘플 다음에 오는 표를 보라. 이 발췌는 툴의 “Getting Started”카탈로그만을 포함한다.
1)  <Catalog option="0">
2)     <ItemID idValue="{0D75EF58-D86B-44DF-B39E-CE39E96077EC}"/>
3)     <Properties>
4)        <ItemName resource="9250" src="AeccStockSubassemblyScriptsRC.dll"/>
5)        <Images option="0">
6)           <Image cx="93" cy="123" src=".\Images\AeccCorridorModel.png"/>
7)        </Images>
8)        <Description resource="9201" src="AeccStockSubassemblyScriptsRC.dll"/>
9)        <AccessRight>1</AccessRight>
10)       <Time createdUniversalDateTime="2003-01-22T00:31:56" modifiedUniversalDateTime="2006-09-04T13:28:12"/>
11)    </Properties>
12)    <Source>
13)       <Publisher>
14)          <PublisherName>Autodesk</PublisherName>
15)       </Publisher>
16)    </Source>
17)    <Tools/>
18)    <Palettes/>
19)    <Packages/>
20)    <Categories>
21)       <Category option="0">
22)          <ItemID idValue="{4F5BFBF8-11E8-4479-99E0-4AA69B1DC292}"/>
23)          <Url href=".\\C3D Metric Getting Started Subassembly Catalog.atc"/>
24)          <Properties>
25)             <ItemName resource="9212" src="AeccStockSubassemblyScriptsRC.dll"/>
26)             <Images option="0">
27)                <Image cx="93" cy="123" src=".\Images\AeccGenericSubassemblies.png"/>
28)             </Images>
29)             <Description resource="9213" src="AeccStockSubassemblyScriptsRC.dll"/>
30)             <AccessRight>1</AccessRight>
31)          </Properties>
32)          <Source/>
33)       </Category>
34)  
35) <!-- Other category items omitted -->
36)  
37)    </Categories>
38)    <StockTools/>
39)    <Catalogs/>
40) </Catalog>
Line Number
Description
1-40
<Catalog> 섹션은 카탈로그 파일의 전체 콘텐츠를 포함한다.
2
<ItemID> 은 카탈로그의 GUID를 정의한다. 이 카테고리를 식별하기 위해서는 , 같은 GUID가 registry 파일에서 사용되어야 한다.
3-11
이 섹션은 카테고리의 일반적인 속성을 정의한다.
4
<ItemName>은 카테고리 브라우저에서 카테고리 아이콘 아래에 표시되는 이름을 정의한다. 여기서, 우리는 국제화를 지원하는 스트링리소스를 사용한다. 당신은 “<ItemName>Name</ItemName>” 줄을 사용해서 상수 문자열을 지정할수도 있다.
5-7
<Images>는 카탈로그 브라우저에서 카탈로그를 표현하는 아이콘을의 이미지 파일을 정의한다.카탈로그와 subassembly에 사용되는 이미지는 64x64픽셀 이미지여야 한다. 유효한 이미지 파일 종류는 .bmp, .gif. jpg그리고 .png이다.
8
<Description>은 카테고리에 대한 문자열 설명을 포함한다. 이 경우, 우리는 국제화를 지원하기 위해 문자열 리소스를 사용한다. 당신은 “<Descriptio>String</Description>” 라인을 사용해서 문자열 상수를 지정할 수 있다.
10
<Time> 은 universal date/time 포멧으로 카탈로그가 만들어진 시간과 날짜를 정의한다.이 정보는필요하지만, 사용되지는 않는다. 임의의 날짜 또는 시간은 주어질 수 있다.
12-16
<Source> 는 카탈로그의 소스/ 작성자를 정의한다.
17-19
툴, 팔레트, 패키지를 위한 빈 부분이다.
20-36
<Categories> 그룹은 카테고리의 목록을 정의한다, 서브카테고리또는 subassembly 툴을 포함하고 있을 수있다.
21-33
“Getting Started” 카테고리의 정의이다. 이 블럭은 분할된 파일에서 모든 카테고리 정보를 로드하기 위해 설계되었다. 카테고리 정보는 Tool File Example에서 설명된 것처럼 <Category>를 사용해서 .atc 파일 1개만 사용하기를 원한다면 이 파일에 배치될 수 있다.
22
<ItemID>는 이 카테고리를 위한 유일한 GUID를 정의한다. 이것은 분할된 카테고리 .atc 파일과 같은 GUID이어야 한다.
23
<Url> 은 카테고리 .atc파일의 위치를 지정한다.
24-31
카테고리의 속성
25
<ItemName>은 이 툴의 카테고리의 이름을 정의한다. 이 경우, 우리는 국제화를 지원하기 위해 string 리소스를 사용한다. 당신은 “<ItemName>Name</ItemName>” 라인을 사용해서 상수 문자열을 지정할수도 있다.
26-28
사용자에게 카테고리를 인식수 있도록 하기위해 사용되는 이미지를 설정한다.
29
<Description>은 카테고리 위한 문자열 설명을 포함한다. 이 경우, 우리는 국제화를 지원하기 위해서 문자열 리소스를 사용한다. 당신은 “<Description>String</Description>”줄을 사용해서 상수문자열을 지정할 수도있다.
32
Source를 위한 빈 정의 부분
39
StockTools를 위한 빈 정의 부분

툴 파일 예제

다음은 “Autodesk Metric Getting Started Subassembly Catalog.atc” 파일의 일부이다. 이것은 “Getting Started” 카탈로그에 있는 모든 툴들을 포함한다. 일 발췌는 “BasicBarrier” 툴만 포함하고 있다.
1)  <Category>
2)     <ItemID idValue="{4F5BFBF8-11E8-4479-99E0-4AA69B1DC292}"/>
3)     <Properties>
4)        <ItemName src="AeccStockSubassemblyScriptsRC.dll" resource="9212"/>
5)        <Images>
6)           <Image cx="93" cy="123" src=".\Images\AeccGenericSubassemblies.png"/>
7)        </Images>
8)             <Description src="AeccStockSubassemblyScriptsRC.dll" resource="9213"/>
9)        <AccessRight>1</AccessRight>
10)       <Time createdUniversalDateTime="2002-09-16T14:23:31" modifiedUniversalDateTime="2004-06-17T07:08:09"/>
11)    </Properties>
12)    <CustomData/>
13)    <Source/>
14)    <Palettes/>
15)    <Packages/>
16) <Tools>
17) <Tool>
18)    <ItemID idValue="{F6F066F4-ABF2-4838-B007-17DFDDE2C869}"/>
19)    <Properties>
20)            <ItemName resource="101" src="AeccStockSubassemblyScriptsRC.dll"/>
21)       <Images>
22)          <Image cx="64" cy="64" src=".\Images\AeccBasicBarrier.png"/>
23)       </Images>
24)       <Description resource="102" src="AeccStockSubassemblyScriptsRC.dll"/>
25)       <Keywords>_barrier subassembly</Keywords>
26)       <Help>
27)          <HelpFile>.\Help\C3DStockSubassemblyHelp.chm</HelpFile>
28)          <HelpCommand>HELP_HHWND_TOPIC</HelpCommand>
29)          <HelpData>SA_BasicBarrier.htm</HelpData>
30)       </Help>
31)       <Time createdUniversalDateTime="2002-04-05T21:58:00" modifiedUniversalDateTime="2002-04-05T21:58:00"/>
32)    </Properties>
33)    <Source/>
34)    <StockToolRef idValue="{7F55AAC0-0256-48D7-BFA5-914702663FDE}"/>
35)    <Data>
36)       <AeccDbSubassembly>
37)          <GeometryGenerateMode>UseDotNet</GeometryGenerateMode>
38)          <DotNetClass Assembly=".\C3DStockSubassemblies.dll">Subassembly.BasicBarrier</DotNetClass>
39)          <Resource Module="AeccStockSubassemblyScriptsRC.dll"/>
40)          <Content DownloadLocation="http://www.autodesk.com/subscriptionlogin"/>
41)          <Params>
42)             <Version DataType="String" DisplayName="Version" Description="Version">R2007</Version>
43)             <TopWidth     DataType="Double" TypeInfo="16" DisplayName="105" Description="106">0.15</TopWidth>
44)             <MiddleWidth  DataType="Double" TypeInfo="16" DisplayName="107" Description="108">0.225</MiddleWidth>
45)             <CurbWidth    DataType="Double" TypeInfo="16" DisplayName="109" Description="110">0.57</CurbWidth>
46)             <BottomWidth  DataType="Double" TypeInfo="16" DisplayName="111" Description="112">0.6</BottomWidth>
47)             <TopHeight    DataType="Double" TypeInfo="16" DisplayName="113" Description="114">0.9</TopHeight>
48)             <MiddleHeight DataType="Double" TypeInfo="16" DisplayName="115" Description="116">0.45</MiddleHeight>
49)             <CurbHeight   DataType="Double" TypeInfo="16" DisplayName="117" Description="118">0.075</CurbHeight>
50)          </Params>
51)       </AeccDbSubassembly>
52)       <Units>m</Units>
53)    </Data>
54) </Tool>
55)  
56) <!-- Other tool items omitted -->
57)  
58) </Tools>
59) <StockTools/>
60) </Category>
Line Number
Description
1-59
<Category>는 subassembly 목록이다.
2
<ItemID>는 이 카테고리를 위한 유일한 GUID를 정의한다. 그것은 상위 카탈로그 .atc파일과 동일한 GUID가 되어야 한다.
3-11
카테고리의 속성들
4
<ItemName>은 이 툴의 카테고리의 이름을 정의한다.이 경우, 우리는 국제화를 지원하기 위해 문자열 리소스를 사용한다. 당신은 “<ItemName>Name</ItemName>”줄을 사용해서 상수 문자열을 지정할 수도 있다.
5-7
사용자에게 카테고리를 인실할수 있도록 하기위해 사용할 이미지를 지정한다.
8
<Description>은 카테고리에 대한 문자열 설명을 포함한다. 이 경우, 우리는 국제화를 지원하기 위해 문자열 리소스를 사용한다. 당신은 “<Descriptio>String</Description>” 라인을 사용해서 문자열 상수를 지정할 수 있다.
12-15
사용자 데이타, Source, 팔레트, 패키지를 위한 빈 정의.
16-57
<Tools>는 모든 분할된 subassembly를 포함한다.
17-53
<Tool>은 한개의 subassembly를 표현한다.
18
<ItemID> 은 이 subassembly를 위한 유일한 GUID를 정의한다.
19-32
subassembly의 속성들
20
<ItemName>은 이 subassembly의 이름을 정의한다. 이 경우 우리는 문자열 리소스를 사용해서 국제화를 지원한다. 당신은 “<ItemName>Name</ItemName>”줄을 사용해서 문자열 상수를 지정할 수도 있다.
21-23
사용자에게 subassembly를 인식시키기 위해 사용되는 이미지를 설정한다.
24
<Description>은 이 subassembly의 이름을 정의한다. 이경우, 우리는 국제화를 지원하기 위해 문자열 리소스를 사용한다. 당신은 “<Description>String</Description>” 라인을 사용해서 상수 문자열을 지정할수도 있다.
25
subassembly를 설명하는 키워드.
27
<HelpFile> 은 도움말 파일의 파일명과 경로를 정의한다.
28
<HelpCommand> 도움말 파일을 표시하기 위해 사용되는 command를 정의한다.
29
<HelpData>는 표시할 도움말 파일내의 특정 주제이다.
31
<Time>은 범용 date/time 형식으로 카탈로그가 만들어졌었던 시간과 일자를 정의한다. 이 정보는 필요하지만, 사용되지는 않는다. 임의의 일자또는 시간이 주어질수도 있다.
33
비어 있는 Source 태그이다.
34
<StockToolRef> 는 카탈로그 툴에 대해 구체적인 GUID를 정의한다. 이것은 {7F55AAC0-0256-48D7-BFA5-914702663FDE} 의 idValue를 사용해야 한다.
35-52
Subassembly의 특성을 설명한다.
36-50
툴을 subassembly로 인식한다.
37
<GeometryGenerateMode>는 새로운 태그이다. 이 태그는 subassembly의 source 코드를 설명한다. 그것은 “UseDotNet”또는 “UseVBA” 값을 가질 수있다. 만약 이 태그가 사용되지 않는다면, “UseVBA”로 간주된다.
38
<DotNetClass>는 새로운 태그인데, .NET assembly와 subassembly를 포함하고 있는 클래스를 나열한다. VBA에서는 <Macro> 태그로 인식된다. ATC 파일에 지정된 모든 패스는 ATC 파일의 패스에 상대적이어야 한다.
39
subassembly 툴에 의해 사용된 리소스 문자열과 이미지들을 포함하고 있는 .dll이다.
40
<Content>는 새로운 태그인데, 만약 로컬머신에 있지 않다면, 당신이 subassembly를 다운로드할수 있는 위치를 지정한다. 만약 subassembly가 다운로드되지 않았다면, 위치는 DownloadLocation 속성에 포함된 위치가 이벤트뷰어에 표시된다.
41-50
<Params> 는 subassembly 툴과 관련된  입력파라미터의 이름을 정의한다. 이 목록은 subassembly의 Properties 페이지에 표시된다. 그들은 .atc파일에 나타나는 순서로 표시된다. 각 파라미터는 한줄로 정의된다.
42-49
각 파라미터는 다음과 같이 설명된다.:
Parameter name - 파라미터의 내부이름(e.g., “CrownHeight”). 이것은 파라미터 버킷으로 저장되거나 검색될때 사용되어야 하는 이름이다.
DateType - 파라미터 값을 저장할때 사용되는 변수의 종류를 정의한다. Long, Double 또는 String 으로 정의된다. 더 많은 정보는, Tool Catalog Data Type Information 를 보라.
DisplayName - subassembly Properties 페이지에서 파라미터를 위해 표시되는 이름을 정의한다. 이것은 사용자가 각 파라미터를 인지하기 위해 보는 것이다.
Description - 입력파라미터의 설명을 제공한다. 파라미터 이름이 subassembly Properties 페이지에서 하이라이트될때, 그 설명은 페이지의 아래쪽에 나타난다.
52
<Units> 은 subassembly가 기대하는 단위의 종류를 설명한다. 유효한 값은 미터인 경우 “m” 또는 피트인 경우”foot”이다.

툴 카탈로그 커버 페이지 만들기

AutoCAD Civil 3D Content 브라우저에서 새로운 마탈로그를 클릭할때 표시될 입문 content를 만들기 위해서는  .html파일을 사용하라. 당신은 모든의 html 편집기를 사용할 수 있다, 그리고 커버 페이지는 당신이 원하는 만큼 간단하거나 포괄적일 수 있다. 일반적으로, 커버 페이지는 카탈로그에서 지원되는 툴의 개요를 제공하고, 그들이 어떻게 사용될지에 대한 설명을 한다.
관례에 따르면, 커버페이지는 <Name>-ToolCatalogCoverPage.html로 명명되고, “<Name>”은 새로운 툴 카탈로그의 이름이다. .html파일의 위치는 .atc파일에서 지정된다. 이 파일은 보통 .atc 파일 자체와 같은 디렉토리에 위치된다.

툴 카탈로그 레지스트리 파일 만들기

각 subassembly 툴 카탈로그는 AutoCAD Civil 3D에 의해서 사용될 수 있기 전에 윈도우 레지스트리에 등록되는 것을 필요로 한다. 이것을 하는 한가지 방법은 .reg 파일을 만드는 것이다. .reg파일은 레지스트리에 추가되기 위한 새 키, 변수 이름, 값을 포함하는 텍스트 파일이다. .reg파일을 더블클릭하면 레지스트리가 수정될 것이다. 이 과정 후에, .reg파일은 더이상 필요하지 않다.
다음은 Autodesk Civil 3D Imperial Corridor Catalog.atc 카탈로그 파일을 등록하는 .reg파일의 내용이다. 내용의 설명을 위해서는 샘플 뒤에 있는 표를 보라.
1)  REGEDIT4
2)
3)  [HKEY_CURRENT_USER\Software\Autodesk\Autodesk Content Browser\60]
4)
5)  [HKEY_CURRENT_USER\Software\Autodesk\Autodesk Content Browser\60\RegisteredGroups]
6)  
7)  [HKEY_CURRENT_USER\Software\Autodesk\Autodesk Content Browser\60\RegisteredGroups\Roads Group]
8)  "ItemID"="{5BD79109-BC69-41eb-9AC8-7E9CD469C8D3}"
9)  "ItemName"="Roads Group"
10)  
11)  
12)  [HKEY_CURRENT_USER\Software\Autodesk\Autodesk Content Browser\60\RegisteredCatalogs]
13)  
14)  [HKEY_CURRENT_USER\Software\Autodesk\Autodesk Content Browser\60\RegisteredCatalogs\Autodesk Civil 3D Imperial Corridor Catalog]
15)  "ItemID"="{410D0B43-19B3-402f-AB41-05A6E174AA3F}"
16)  "Image"=".\\Images\\AeccRoadway.png"
17)  "Url"="C:\\Documents and Settings\\All Users\\Application Data\\Autodesk\\C3D2010\\enu\\Tool Catalogs\\Road Catalog\\Autodesk Civil 3D Imperial Corridor Catalog.atc"
18)  "DisplayName"="Civil 3D Subassemblies (Imperial Units)"
19)  "Description"="Imperial Units Subassemblies"
20)  "Publisher"="Autodesk"
21)  "ToolTip"="Autodesk Civil 3D Imperial Corridor Catalog"
22)  "GroupType"="{5BD79109-BC69-41eb-9AC8-7E9CD469C8D3}"
23)  
24)  
25)  [HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R18\ACAD-8000:409\AEC\60\General\Tools]
26)  "ToolContentRoot"="C:\\Documents and Settings\\All Users\\Application Data\\Autodesk\\C3D2010\\enu\\Tool Catalogs\\Road Catalog"
Line Number
Description
1
파일을 레지스트리 편집 파일로 식별한다.
3-9
이 구문들은 Autodesk Content Browser를 위한 그룹을 생성한다. 그룹 id 이름은 “Roads Group”이다. 각 그룹은 “ItemID”의 값으로 유일한 GUID를 가져야 한다. Roads 그룹은 AutoCAD Civil 3D 설치에 의해서 이미 등록되었다. 만약 당신이 마탈로그를 이 그룹에 추가한다면, 당신은 예제에서 본 GUID를 사용해야 한다.
12
Item이 Autodesk Content Browser의 Autodesk 카탈로그로 등록되고 있음을 식별한다.
14-22
이 구문들은 카탈로그 항목을 정의한다.
15
“ItemId”는 이 카탈로그를 위한 유일한 GUID이어야 한다. 이것은 카탈로그 .atc 파일에 있는 카탈로그 ItemID 값의 GUID와 일치해야 한다.
16
“Image”는 이 카탈로그를 위한 유일한 GUID이어야 한다. 이것은 카탈로그 .atc파일에 있는 카탈로그 ItemID값의 GUID와 일치해야 한다.
17
“URL”은 등록되고 있는 카탈로그 .atc파일에 대한 포인터이다.
18
“DisplayName”은 Autodesk Content Browser에서 카탈로그 아이콘 아래에 표시하는 문자이다.
19
“Description” - 툴 카탈로그의 설명.
20
“Publisher” - 툴 카탈로그의 제작자 / 게시자의 이름이다.
21
“ToolTip” - 커서가 카탈로그 브라우저에서 툴 카탈로그 위에 있을때 위에 툴팁으로 표시하는 문자이다.
22
“GroupType” - 툴카탈로그가 카탈로그 브라우저에서 속한 것을 정의하는 GUID이다. 이 GUID는 그룹정의에 있는 “ItemID”에 사용된 한개와 일치해야 한다.
26
.atc 카탈로그 파일이 위치한 디렉토리이다.

커스텀 subassembly 설치하기

당신이 커스텀 subassembly를 생성한 후에, 당신은 다른 AutoCAD Civil 3D 사용자 기계에 그것을 설치할 수 있다.
Note:
사용자에게 배포하기 위해 커스텀 subassembly를 수동으로설치하는 것 보다 subassembly 패키지 파일을 만드는 것이 더 간단한다. Exporting Subassemblies Using a Package File을 보라.
커스텀 subassembly 설치하기 :
  1. 컴파일된 AutoCAD Civil 3D subassembly .dll 라이브러리를 대상 디렉토리에 복사하라. 기본적으로 라이브러리는 <AutoCAD Civil 3D Install Directory>/Sample/Civil 3D API/C3DstockSubAssemblies에 위치해 있다.
  2. 툴 타칼로그 .atc 파일을 대상 디렉토리에 복사하라. 툴 카탈로그 파일은 보통 그 디렉토리에 위치된다. 이들을 생성하는 것에 대해서 더 많은 정보가 필요하면 Creating a Tool Catalog ATC File 를 보라.
  3. subassembly를 표현하는 image파일이나 도움말파일  같은 옵션파일을 대상 디렉토리에 복사하라. 이미지는 일반적으로 .에 위치하고 도움말 파일은 일반적으로 ,에 위치한다. .atc 파일이 올바른 경로정보를 가지고 있는한 어떤 디렉토리도 될수 있다. 도움말 파일 생성에 대한 정보는 Creating Subassembly Help Files 를 보라
  4. 레지스트리 (.reg) 파일을 사용해서 툴 카탈로그를 등록하라. 이 .reg 파일은 .atc파일과 step2와 3에서 설명한 카탈로그 이미지의 의 올바른 패스를 가져야 한다. 레지스트리 파일 생성하기에 대한 정보는, Creating a Tool Catalog Registry File 를 보라.

패키지 파일을 사용해서 커스텀 subassembly를 내보내기

당신은 필요한 파일을 패키지 파일로 복사해서 다른사람과 커스텀 subassembly를 공유할 수 있다.
.NET 또는 VAB를 사용해서 만들어진 커스텀 subassembly는 패키지 파일을 사용해서 내보내기와 가져오기가 될 수 있다. 패키지 파일은 커스텀 subassembly가 동작하는데 필요한 모든 파일을 포함한다. 패키지 파일이 만들어진 후에, 사용자들은 AutoCAD Civil 3D로 패키지 파일을 가져오기 할수 있고, 그들은 사용자 subassembly 를 직접 툴 팔레트 또는 카탈로그로 복사할수 있다. subassembly 패키지파일을 가져오기하는 것에 대한 더 많은 정보는 AutoCAD Civil 3D User’s Guid에 있는 Sharing Subassemblies 를 보라.
AutoCAD Civil 3D content의 다른 종류와 같이, subassembly는 Autodesk Civil Engineering 커뮤니티 사이트를 통해서 다른 사람들과 공유될 수 있다. Autodesk Civil Engineering we bite에 접속하기 위해 http://civilcommunity.autodesk.com/로 가라, 그리고 Content Sharing을 클릭하라.
패키지 파일을 만들기 위해, 당신은 커스텀 subassembly 를 구성하는 모든 파일과 subassembly를 폴더에 복사해야 한다. 그 폴더의 .zip 파일을 만들고, .zip을 .pkt로 파일 확장자를 변경하라.
Note:
폴리라인에서 생성된 Subassembly는 패키지 파일에 포함될 수 없다.패키지 파일은 .NET 이나 VBA를 사용해서 만들어진 커스텀 subassembly를 공유하기 위한 것이다.

패키지 파일 이름짓기

만약 당신이 하나의 subassembly를 공유하고 있다면, 그것은 당신이 그 패키지 파일을 subassembly와 같은 이름으로 명명기를 권장한다. 예를 들어, 당신이 만약 OpenChannel로 명명된 subassembly를 내보내기할 계획이라면, 패키지파일은 OpenChannel.pkt로 명명하라. 만약 당신이 하나의 패키지 파일에 있는 여러개의 subassembly를 내보내기할 계획이라면, 거기에 포함되어 있는 subassembly의 종류를 쉽게 식별하는 쉬운 이름을 폴더 이름으로 사용하라.예를 들어, DitchSubassemblies.pkt 처럼.

필요한 Subassembly 파일들

다음 표는 하나 또는 그 이상의 subassembly를 성공적으로 내보내기하고 가져오기를 하기 위해 패키지파일에 포함되어야 하는 파일을 설명한다.
File
Description
.atc file(s)
subassembly의 모양과 동작을 정의하는 유효한 .atc 파일 또는 subassembly가 요구된다. 당신은 하나 또는 그 이상의 .atc 파일을 패키지 파일에 포함시킬 수 있다. 예를 들어, 당신은 한개 또는 그 이상의 subassembly를 정의하는 한개의 .atc 파일을 가지거나, 한개 또는 여러개의 subassembly를 각각 정의하는 여러개의 .atc파일을 가질수 있다.만약 패키지 파일이 여러개의 .atc 파일을 포함한다면, 각각의 .atc 파일은 유일한 이름을 가져야 한다. 만약 그들이 동일한 .pkt파일에 있는 파일들을 가르키고 있다면, .atc 파일에 있는 모든 참조 경로는 상대경로이어야 한다.
.dll or .dvb file(s)
.dll 파일은 NET을 사용해서 정의된 subassembly를 위해 필요하다. .dvb 파일은  VBA를 사용해서 정의된 subassembly를 위해서 필요하다. 패키지 파일은 .dll과 .dvb파일을 모두 포함할 수 있다.
Help file(s)
도움말 파일은 subassembly 기능이 제대로 동작하는데 꼭 필요하지는 않다. 그러나 도움말 파일은 다른 사람이 subassembly를 사용하는 방법을 이해하는데 필요하다.그러므로, 당신은 도움말 파일을 각각의 subassembly와 함께 항상 포함하는 것을 권장한다. 각각의 subassembly를 위한 도움말 파일은.atc 파일에서 지정되고, 다음에 나오는 모든 형식이 될 수 있다 : .dwf, .doc, .pdf, .txt, .chm, .hlp. 더 많은 정보를 위해서는, Creating Subassembly Help Files 를 보라.
Image file(s)
각각의 이미지 파일은 툴 팔레트에 표시되고, subassembly모양의 개념적 그래픽 표현을 제공한다.

이 절의 주제
  • 패키지 파일을 사용해서 커스텀 subassembly를 내보내기

패키지 파일을 사용해서 커스텀 subassembly를 내보내기

패키지 파일 만들기
  1. 요구되는 모든 subassembly 파일들을 폴더에 복사하라. 폴더는 subassembly 를 위해 요괴는 파일 또는 당신이 내보내기 하려는 subassembly만 포함한다.
  2. 그 폴더의 내용으로 .zip 파일을 만들어라.
  3. .zip 확장자를 .pkt로 변경하라.
패키지(.pkt) 파일은 만들어 지고, 다른 사용자들과 공유할 수 있다.