Wednesday, January 19, 2011
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:
You should select the standard "Windows Form" type, giving an appropriate name (in this case I've used "SplashScreen", imaginatively enough).
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:
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:
Some notes on the code:

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:
I also found I had to add an additional assembly reference to PresentationCore (a .NET Framework 3.0 assembly).
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:
You should select the standard "Windows Form" type, giving an appropriate name (in this case I've used "SplashScreen", imaginatively enough).
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:
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()
{
}
}
}
- 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).
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
);
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
Wednesday, October 27, 2010
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)
- Civil 3D nói chung - Civil 3D in General
- Thiết kế nút giao - Intersection/Interchange design
- Thiết kế đường ống - Pipe Network
- Lập trình với Civil 3D - Programming with Civil 3D
- AutoCAD Civil 3D 2009 Developers Guide (Mediafire Link)
- AutoCAD Civil 3D 2011 Developers Guide (Mediafire Link)
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
Ý 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
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
- 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)
- 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):
Cách 2:
Import từ file CSV, cấu trúc file như sau (link):
Superelevation Specification Variables
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):
- Curve number
- Station
- Critical station type
- Curve length
- Left Outside Shoulder
- Left Outside Lane
- Left Inside Lane
- Left Inside Shoulder
- Right Outside Shoulder
- Right Outside Lane
- Right Inside Lane
- Right Inside Shoulder
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:
Subscribe to:
Posts (Atom)
