Sunday, November 21, 2010

Tạo Windows Form trong AutoCAD .Net

Showing a splash-screen from your AutoCAD .NET application

(http://through-the-interface.typepad.com/through_the_interface/2007/06/showing_a_splas.html)

Thanks once again to Viru Aithal for the inspiration behind this post, although I did write most of the code, this time. :-)
Adding a splash screen can give a touch of class to your application, assuming it's done non-intrusively. This post focuses on how best to do so within AutoCAD, and use the time it's displayed to perform initialization for your application.
The first thing you need to do is add a Windows Form to your project:
Splash_screen_1
You should select the standard "Windows Form" type, giving an appropriate name (in this case I've used "SplashScreen", imaginatively enough).
Splash_screen_2
Once this is done, you should set the background for the form to be your preferred bitmap image, by browsing to it from the form's BackgroundImage property:
Splash_screen_3
Now we're ready to add some code. Here's some C# code that shows how to show the splash-screen from the Initialize() method:

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Prompts; // This is the name of the module

namespace SplashScreenTest
{
  public class Startup : IExtensionApplication
  {
    public void Initialize()
    {
      SplashScreen ss = new SplashScreen();

      // Rather than trusting these properties to be set
      // at design-time, let's set them here
      ss.StartPosition =
        System.Windows.Forms.FormStartPosition.CenterScreen;
      ss.FormBorderStyle =
        System.Windows.Forms.FormBorderStyle.None;
      ss.Opacity = 0.8;
      ss.TopMost = true;
      ss.ShowInTaskbar = false;

      // Now let's disply the splash-screen
      Application.ShowModelessDialog(
        Application.MainWindow,
        ss,
        false
      );
      ss.Update();

      // This is where your application should initialise,
      // but in our case let's take a 3-second nap
      System.Threading.Thread.Sleep(3000);

      ss.Close();
    }
    public void Terminate()
    {
    }
  }
}
Some notes on the code:
  • I used a sample application called "Prompts" - you should change the using directive to refer to your own module name.
  • We're setting a number of properties dynamically (at runtime), rather than stepping through how to set them at design-time.
  • We've set the splash screen to be 80% opaque (or 20% transparent). This is easy to adjust.
  • Some of the additional properties may be redundant, but they seemed sensible to set (at least to me).
Here's the result... I've set up my application to demand-load when I invoke a command, which allowed me to load a DWG first to show off the transparency of the splash-screen (even though the above code doesn't actually define a command - so do expect an "Unknown command" message, if you do exactly the same thing as I have). You may prefer to set the module to load on AutoCAD startup, otherwise.
Splash_screen_4

Update:
Roland Feletic brought it to my attention that this post needed updating for AutoCAD 2010. Thanks, Roland!
I looked into the code, and found that the call to ShowModelessDialog needed changing to this:
      Application.ShowModelessDialog(
        Application.MainWindow.Handle,
        ss,
        false
      );
I also found I had to add an additional assembly reference to PresentationCore (a .NET Framework 3.0 assembly).

Sunday, November 07, 2010

Layer Manager font error - Lỗi hộp thoại Layer Manager (LA)

I had this error and Autodesk Support traced it to my display settings.
I was using Windows Classic Style in Windows XP (Display Properites->Appearance->Windows and buttons). When I switchd to Windows XP Style the Layer Manager opened.
Note that this problem only happened to me with the new modeless Layer Properties Manager ( LAYERDLGMODE = 1 ). I did not get this error when using classic layer manager ( LAYERDLGMODE = 0 ). 

Nói chung  là có thể do Windows Style (display setting) trong Windows. Lỗi này xuất hiện khi biến LAYERDLGMODE = 1, khi đặt LAYERDLGMODE = 0 thì mọi chuyện ổn cả.

Wednesday, November 03, 2010

Khám phá những phím tắt trên Windows 7

(Dân trí) - Nắm bắt những phím tắt trên Windows sẽ giúp người dùng sử dụng máy tính được nhanh chóng thuận tiện hơn. Bài viết dưới đây sẽ giới thiệu một vài phím tắt hữu dụng trên Windows 7 mà có thể bạn chưa biết.

Thành thạo các phím tắt sẽ giúp người dùng không cần phải sử dụng đến chuột để thao tác, điều này giúp làm việc trên máy tính được hiệu quả hơn.

Lưu ý: trong các phím được sử dụng, phím Windows là phím có biểu tượng cửa sổ, nằm giữa 2 phím Ctrl và Alt trên bàn phím.
 

Những phím tắt với chức năng Aero:

Aero là tính năng làm tăng hiệu ứng hiển thị cho Windows, giúp giao diện Windows 7 trở nên bóng bẩy và đẹp mắt hơn, chẳng hạn hiệu ứng thanh taskbar trong suốt, cửa sổ trong suốt…

Tuy nhiên Aero sử dụng khá nhiều tài nguyên trên hệ thống, do vậy, với những máy tính có cấu hình không quá mạnh, Windows sẽ tự động tắt chức năng này.

Trong trường hợp Windows không mặc định kích hoạt chức năng Để kích hoạt chức năng Aero trên Windows, từ desktop, bạn kích chuột phải và chọn Personalize. Từ cửa sổ Personalize hiện ra, bạn chọn 1 trong những kiểu giao diện có sử dụng hiệu ứng Aero từ danh sách.
 

Nếu máy tính đủ khả năng hỗ trợ Aero, bạn sẽ được chuyển về mẫu giao diện mới, và thanh taskbar cũng như thanh tiêu đề các cửa sổ trở nên trong suốt, cũng như xuất hiện thumbnails các cửa sổ đang được mở ở trên taskbar…

Dưới đây là một vài phím tắt của Windows sử dụng hiệu ứng Aero:

- Nhấn tổ hợp phím “Windows” + “Spacebar” (thanh dài) để biến tất cả các cửa sổ trở nên trong suốt.
 

- “Windows” + “Home”: thu nhỏ toàn bộ các cửa sổ, ngoại trừ cửa sổ đang được chọn.

- “Windows” + phím mũi tên trái (tương ứng phải): đưa cửa sổ về một nửa màn hình bên trái (hoặc bên phải). Với cách thức này, bạn có thể đưa 2 cửa sổ nằm song song ở 2 nửa của màn hình, thuận tiện trong việc so sánh hoặc đối chiếu nội dung nào đó.

- “Windows” + phím mũi tên lên (tương ứng xuống): đưa cửa sổ về kích cỡ thu nhỏ hoặc lớn tối đa.

- “Windows” + “Tab”: chuyển đổi cửa sổ để chọn lựa với hiệu ứng 3D. Nhấn phím Tab để lựa chọn.

Những phím tắt tác động lên cửa sổ và thanh Taskbar:

- “Windows” + D (hoặc M): thu nhỏ toàn bộ các cửa sổ đang mở để quay về desktop.

- “Alt” + “Tab”: chuyển đổi các cửa sổ đang mở. Nhấn phím Tab để chọn lựa.

- “Alt” + “Ctrl” + “Tab”: hiển thị danh sách các cửa sổ đang mở. Sử dụng phím mũi tên trái phải để chọn lựa cửa sổ cần sử dụng. Với tổ hợp phím “Alt” + “Tab” ở trên, bạn phải bấm và giữ phím Alt trong quá trình chọn lựa cửa sổ, nhưng với tổ hợp phím này, bạn có thể chỉ sử dụng các phím qua lại để chọn lựa mà không cần giữ các nút khác.
 

- “Windows” + T: di chuyển tới các cửa sổ đang mở trên taskbar. Giữ phím “Windows” và nhấn phím T để di chuyển theo chiều từ trái sang phải. Khi đến được biểu tượng của cửa sổ cần thiết, nhấn Enter để mở cửa sổ đó.

- “Windows” + “Alt” + T: tương tự như trên, nhưng di chuyển theo chiều ngược lại, từ phải sang trái.

- “Windows” + B: chuyển trỏ chuột về mục hiển thị các biểu tượng ẩn trên taskbar. Nhấn Enter hoặc phím Space để hiển thị chúng.
 

- “Windows” + 1 (từ 1 đến 9): kích hoạt các phần mềm được đánh dấu trên taskbar, theo thứ tự từ 1 đến 9 (từ trái qua phải).

- “Windows” + “Alt” + 1 (từ 1 đến 9): mở jump list của các biểu tượng trên Taskbar.
 
Chế độ nhiều màn hình:

Nếu bạn đang sử dụng máy tính với kết nối nhiều màn hình hoặc kết nối giữa laptop và màn hình lcd, kết nối máy chiếu… thì các phím tắt sau đây có thể sẽ hữu dụng.

- “Windows” + “Shift” + phím trái (tương ứng phải): chuyển cửa sổ hiện tại sang màn hình khác.

- “Windows” + P: chọn lựa chế độ hiển thị máy chiếu.
 

Hiệu ứng kính lúp: là hiệu ứng cho phép phóng lớn một vị trí nào đó trên màn hình.

- “Windows” + “+”: kích hoạt hiệu ứng kính lúp. Một hộp thoại hiện ra cho phép bạn chọn lựa khu vực để phóng lớn. Nhấn tiếp tổ hợp phím “Windows” + “+” để tăng mức độ phóng lớn. Nhấn “Windows” + “-“ để thu nhỏ.
 

- “Ctrl” + “Alt” + F: sau khi đã kích hoạt hiệu ứng kính lúp, nhấn tổ hợp phím này để đưa toàn bộ màn hình về hiệu ứng kính lúp.

- “Ctrl” + “Alt” + I: tương tự, nhấn tổ hợp phím này để đưa về hiệu ứng âm bản.

- “Windows” + “Esc”: thoát khỏi hiệu ứng kính lúp và trở lại bình thường.

Trên đây là một vài phím tắt không chỉ hữu ích khi làm việc và thao tác trên máy, mà cũng có thể hữu ích để khám phá thêm các tính năng mới trên Windows 7 mà có thể bạn chưa biết.

Phạm Thế Quang Huy

Friday, October 22, 2010

Tài liệu về Civil 3D - Documents about Civil 3D

(Sẽ được cập nhật liên tục - Will be updated regularly)

Tuesday, October 12, 2010

Import Styles and Settings trong Civil 3D 2011

Trong Civil 3D 2011, khi muốn sử dụng các styles và setting từ những file đã có sẵn, sử dụng:
  • Để import các styles: dùng lệnh AeccImportStyles
  • Để import các styles và settings: dùng lệnh AeccImportStylesAndSettings
 Tham khảo: http://civil3dguru.blogspot.com/2010/06/undocumented-aec-style-commands-civil.html

Ý tưởng: tạo mô đun có chức năng:
  • Cho phép import các styles và settings bằng cách lựa chọn tệp nguồn; chọn các styles hoặc settings cần import; chọn cách thức import (ghi đè, bỏ qua, đổi tên...)

TCVN 4054-2005: Đường ô tô - Yêu cầu thiết kế

TCVN 4054-2005 : Đường ô tô - Yêu cầu thiết kế 
Download: http://www.mediafire.com/?36bvn4juiw56f

Mở rộng đường cong với C3D 2011

Mở rộng đường cong với Civil 3D 2011
  1. Khai báo trong file Design Standard với các chú ý sau:
    • Tạo mở rộng dạng tra bảng: Nhập số làn xe, chiều rộng ứng với số làn xe đó (VD 2 làn [x3.5m], tổng là 7.0m)
    • Tạo bảng độ mở rộng theo: Vận tốc (các vận tốc đều có độ mở rộng như nhau theo TCVN); bán kính cong và độ mở rộng tương ứng (ứng với 2 làn xe)
  2. Tạo Alignment offset:
    • Nhớ chọn vào mục Add Widening
    • Chọn khoảng cách offset (giá trị này không hề ảnh hưởng đến độ mở rộng làn)
    • Chọn kiểu mở rộng (ở đây sẽ chọn theo file Design Standard)
    • Chú ý chọn đúng kiểu mở rộng, cách tính chiều dài chuyển tiếp (giá trị này lấy chính bằng đoạn nối siêu cao)
    • Chọn bề rộng tiêu chuẩn của làn. Do tiêu chuẩn thiết lập theo 3.5m nên bề rộng làn cũng chọn là 3.5m.
    • Chọn số làn bên trái và phải: nếu số làn bên trái (hoặc phải) lớn hơn 1 thì độ mở rộng sẽ được nhân lên tương ứng. Công thức độ mở rộng ở mỗi bên là:
      [số làn] * [độ mở rộng theo tiêu chuẩn] /2 * [số làn ở mỗi bên]

Sunday, October 03, 2010

Siêu cao trong Civil 3D - Superelevation Civil 3D

Cách 1:
Siêu cao trước hết sẽ được tính tự động trong file tiêu chuẩn thiết kế, dựa trên các thông số Bán kính cong, Chiều dài đường cong chuyển tiếp, Bảng siêu cao, Công thức tính siêu cao.
Lưu ý về công thức tính siêu cao: nên lập theo trình tự sau (ví dụ theo TCVN: đoạn siêu cao lấy trùng với đoạn chuyển tiếp và mở rộng):
  • transitionformula formula="{t}/({e}+{c})*{e}" type="LCtoFS"
  • transitionformula formula="{p}*{t}-{t}/({e}+{c})*{c}" type="LCtoBC"
  • transitionformula formula="{t}/({e}+{c})*{c}" type="NCtoLC"
  • transitionformula formula="{t}/({e}+{c})*{c}" type="LCtoRC"
  • transitionformula formula="{t}*({s}-{c})/({e}+{c})" type="NStoNC"


Cách 2: 
Import từ file CSV, cấu trúc file như sau (link):
  1. Curve number
  2. Station
  3. Critical station type
  4. Curve length
  5. Left Outside Shoulder
  6. Left Outside Lane
  7. Left Inside Lane
  8. Left Inside Shoulder
  9. Right Outside Shoulder
  10. Right Outside Lane
  11. Right Inside Lane
  12. Right Inside Shoulder
 Ý tưởng: có thể dựa trên file csv, lập mô đun tính toán lại siêu cao cho đơn giản hơn





Superelevation Specification Variables
Use the following set of variables to calculate transition distances.
{e} Độ dốc siêu cao. Phụ thuộc vào vận tốc và bán kính, tra theo bảng thiết kế.
The full superelevation rate. This rate is determined from the superelevation rate table, based on the design speed and curve radius.
{t} Đọc từ bảng chiều dài chuyển tiếp, dựa trên vận tốc và bán kính.
The value that is read from the transition length tables, based on the design speed and the curve radius. This value may not be an actual length, but some other value, such as a transition rate from which the length can be calculated.
{c} Độ dốc mặt đường thông thường.
The unsuperelevated normal lane slope (positive). This value is defined by the user in the Superelevation Properties dialog box.
{s} Độ dốc lề đường thông thường.
The unsuperelevated normal shoulder slope (positive). This value is defined by the user in the Superelevation Properties dialog box.
{w} Bề rộng từ điểm quay đến mép ngoài quay siêu cao.
The nominal width from the pivot point to the outermost edge-of-traveled way. This value is defined by the user in the Superelevation Properties dialog box.
{l} Chiều dài của đường cong chuyển tiếp.
The length of the spiral, if a spiral is involved in the transition. This is the actual length of the spiral element in the curve group.
{p}The fractional part of the transition length before the start of the curve or after the end of the curve.
{q}The rate of increase of centripetal acceleration traveling along a curve at a constant speed.
{v}

The variables in the previous table are used to calculate the following distances:
NCtoLC Normal Crown point to Level Crown point (runout)
LCtoFS Level Crown point to Full Super point (runoff)
LCtoRC Level Crown point to Reverse Crown point
LCtoBC Level Crown point to Beginning of Curve
NCtoFS Normal Crown point to Full Super point (used instead of LCtoFS on undivided planar roads) for example the length of the superelevation transition
NCtoBC Normal Crown point to Beginning of Curve (used instead of LCtoBC on undivided planar roads)
NStoNC Normal Shoulder point to Normal Crown point (used for the Breakover Removal Method of superelevated shoulders)

Use this section to view examples of the XML formats you can use for various superelevation attainment methods.

Standard Attainment Method Example
The following example shows the XML format you can use to calculate transition stations for undivided, crowned roadways using the AASHTO standard methodology:
 
 
 
 
 
This example defines an attainment method whose name is "AASHTO 2001 - Crowned Roadway" which uses the standard adverse crown removal method of attaining superelevation. This example includes a calculation for the transition distance needed for shoulder breakover removal (type="NStoNC").

Planar Transition Attainment Method Example
This example shows an undivided planar road. The roadway is not crowned, and there is no adverse crown removal.
The Planar attainment method requires two formulas: one for curves that oppose the direction of the normal cross slope and one for curves that continue in the direction of the normal cross-slope. The following illustration shows normalized slope superelevation, where the unsuperelevated road is tilted downward from left to right. Therefore the curve to the left requires a longer transition than the curve to the right:

In the following example, the Continuing section defines the Normal Crown to Full Superelevation distance runoff length {t} (derived from the transition length tables), minus the runoff length times the normal roadway slope {c} divided by the full superelevation rate {e}. The second formula defines the distance from Normal Crown to the Beginning of Curve as a percentage of {t} based on the variable {p} minus {c} divided by {e}.
The Opposing section defines the overall transition distance to be the runoff length {t}. The distance to the Beginning of Curve is a percentage of {t} based on the variable {p}, and the distance between the Normal Crown and Level Crown stations is {t} * {c} / {e}.

Transitions Defined by Roadway Width and Transition Rate
Not all organizations use tables that give transition length directly. The following table defines the full superelevation rate and the as a function of design speed and curve radius. In this situation, the value is used to derive the transition length based on the normal width of the roadway. The Transition Length tables define the value instead of the actual transition length.

Radius (m) 90 km/h 100km/h 110km/h 120km/h

E% E% E% E% n/a
7000 NC n/a NC n/a NC n/a NC n/a
5000 NC n/a NC n/a NC n/a 2.0 0.31
3000 2.0 0.39 2.0 0.34 2.0 0.32 2.0 0.31
2500 2.0 0.39 2.0 0.34 2.0 0.32 2.0 0.31
2000 2.0 0.39 2.0 0.34 2.0 0.32 2.3 0.32
1500 2.0 0.39 2.0 0.34 2.2 0.33 3.0 0.33
1400 2.0 0.39 2.0 0.34 2.4 0.33 3.2 0.34
1300 2.0 0.39 2.0 0.34 2.6 0.33 3.5 0.34
1200 2.0 0.39 2.2 0.35 2.8 0.34 3.8 0.35
1000 2.0 0.39 2.6 0.36 3.7 0.35 4.5 0.37
900 2.2 0.40 2.9 0.37 3.7 0.36 5.0 0.38
800 2.5 0.40 3.3 0.38 4.2 0.38 5.7 0.39
700 2.9 0.41 3.7 0.39 4.8 0.39 6.0 0.40
600 3.4 0.42 4.4 0.41 5.6 0.41

500 4.0 0.44 5.2 0.43 6.0 0.42

400 5.0 0.46 6.0 0.45



300 6.0 0.48





The following example shows attainment methods and formulas for two types of roadways based on the previous table. The variable {w} is the normal roadway width from pivot point to edge-of traveled-way, defined in the Superelevation wizard.

Saturday, October 02, 2010

Import points: Station-Offset-Elev

Import points: Station-Offset-Elev

Creates points along an alignment by importing points from an ASCII (text) file that contains station, offset, and elevation information.

The file you import can contain the station, offset, elevation, and description of each point. The elevation can be expressed as either a single value (elevation) or a rod reading with instrument height (rod, hi).

ASCII (text) files that use the following layouts (formats) can be imported:

  • Station, Offset
  • Station, Offset, Elevation
  • Station, Offset, Rod, Hi
  • Station, Offset, Description
  • Station, Offset, Elevation, Description
  • Station, Offset, Rod, Hi, Description

Use commas or spaces as delimiters (separators) in the file. Include one or more comment lines in the file by putting a semi-colon (;) or a pound sign (#) in the first column of a comment line.

The following is an example of data in an ASCII (text) file that is formatted using the Station, Offset, Elevation format:

#station, offset, elevation: subdivision 1
0 20.0 112.00
10 23.5 114.64
20 22.5 116.56
30 23.0 116.32
40 22.0 115.83

The first line in this example is a comment line that is ignored when the points are imported. Each of the remaining lines contains the station, offset, and elevation for a point. The file is delimited by spaces.

Before you import the file, you are prompted to describe the format of the ASCII (text) file. You can also be prompted to specify invalid indicator values for station/offsets, elevations, and rod heights.

Point settings, styles, layers, point groups, and description keys can all affect how a point is created or how it is displayed in the drawing. For more information, see Before You Create Points.

Ý tưởng: tạo module cho phép

  • Chuyển đổi giữa các loại file số liệu
  • Chọn file chứa trắc ngang (TDN, PRN, Station-Offset-Elev.)
  • Chọn alignment
  • Chọn vùng cần import dữ liệu (from Sta -> Sta)
  • Import các điểm, tạo Point group nếu cần
  • Tạo các Sample Line tại các trắc ngang có số liệu

Wednesday, September 29, 2010

Hướng dẫn thiết kế kết cấu cọc ván thép - Design manual of steel sheet pile structures

  1. Tập đoàn Nippon Steel, Trường đại học Giao thông Vận tải, Hướng dẫn thiết kế kết cấu cọc ván thép - Design manual of steel sheet pile structures
  2. Arcelor Mittal Piling Handbook - Sổ tay thiết kế cọc ván thép (Mediafire link)
  3. Sheet piling catalogue - Catalogue cọc ván thép (File 1, File 2, File 3File 4)
  4. Arcelor Mittal Piling Case study - Các trường hợp thực tế (Mediafire link)

Không hiện hộp thoại Open/Save As trong AutoCAD

Không hiện hộp thoại Open/Save As trong AutoCAD
Cách làm: thiết lập biến hệ thống FILEDIA bằng 1