기본 콘텐츠로 건너뛰기

7월, 2010의 게시물 표시

Why does AutoCAD insert my blocks in wrong scale?

인도 몇몇 직원들에게 PlantWAVE에 대해서 간단히 DEMO를 진행하던 도중에 KEY PLAN/NORTH MARK를 INSERT했는데, 프로그램에서 지정한 SCALE대로 insert가 되지 않아 한참을 당황했습니다. 다행이 직원의 도움을 받아 해결했습니다. 아래는 CAD Forum에 올라와 있는 내용입니다. Blocks and Xrefs contain their insertion unit settings, which are used for automatic scale conversion (rescale) when they are inserted/attached to a drawing using other units. These units are defined in the INSUNITS (default units), INSUNITSDEFSOURCE (source units) and INSUNITSDEFTARGET (target units) variables. In older AutoCAD versions, these variables were used only for the block inserts/drags from DesignCenter. AutoCAD 2006 (and higher) uses them for all methods of insertion of blocks, xrefs and images. If your blocks are inserted in an improper scale (e.g. scaling 0.254, 12, 10 or 1000), you have probably wrong (different) settings of your block insertion units. Set INSUNITS e.g. to 0 (unitless) - then both the INSUNITSDEFxxxx variables will apply - set them also to 0. Also make sure you are us

XM MDL Programming - #2(다이얼로그 생성하기)

이번에는 다이얼로그를 생성하는 방법을 알아봅시다. V7에서는 다이얼로그 하나 생성하기가 어려웠었는데, XM 이후부터는 MFC 다이얼로그를 상속해서 사용하니까 MFC에 익숙한 사람은 아무 어려움 없이 사용할수 있습니다. 한 마디로 쉬워요. 아시다시피 모달/모달리스 다이얼로그가 있는데 모달 보다는 모달리스 다이얼로그가 유용하게 사용됩니다. 다이얼로그가 실행되어 있는 동안에 MSTN으로 왔다 갔다 하면서 작업을 해야 하니까요.(그리고 모달 다이얼로그는 그냥 DoModal() 함수를 호출하면 되니까 별로 할것도 없어요) MS Visual Studio에서 리소스에서 다이얼로그를 하나 만듭니다. 여기서 조금 이상한데요. 모달리스 다이얼로그를 만들기 위해서는, Dialog Frame을 NONE으로 Style을 Child로 설정해야 한다고 합니다. 다이얼로그와 대응하는 클래스를 하나 생성합니다.(이때 CDialog를 상속하도록 합니다.) 생성한 클래스에서 부모 클래스를 첨부한 클래스로 변경합니다. 클래스 인스턴스를 하나 생성합니다. 인스턴스에서 Create()함수를 호출하여 모달리스 다이얼로그를 생성하면 됩니다. CBasicAppDlg* pDlg = new CBasicAppDlg("Basic Dialogbased MDL"); if(pDlg) pDlg->Create(); 아주 쉽죠~~~ 첨부 파일

XM MDL Programming - #1

XM MDL 프로그래밍을 하면 크게 *.ma 파일과 *.dll 파일이 생깁니다. *.ma 파일에는 거의 아무런 정보를 가지고 있지 않고 dll의 링크 정보를 가지고 있습니다. 대부분의 소스 코드는 컴파일 되어 dll 파일로 생기게 됩니다. ma 파일은 전통적으로 MSTN 컴파일러로 만듭니다.(make 파일등이 필요합니다.) dll 파일은 MS Visual Studio 컴파일러가 만듭니다. 따라서 MS Visual Studio의 여러가지 기능들을 MDL Application에서 사용할수 있습니다.(MFC , STL , etc) MSTN XM용 MDL 프로그램을 만들기 위해서는 MS Visual Studio 2003을 사용하여야 합니다. 자 그럼 코드 조각을 살펴볼까요? 참, .ma 파일을 만드는 쪽에서는 main함수를 포함하지 않아야 합니다. 참 먼저 MFC DLL로 프로젝트를 하나 만들어야 합니다. /*******************************************************************************************/ /* -INFORMATION As you probably know, C++ mangles function names. This is how it lets you implement function overloading,when a function has multiple signatures and multiple implementations. Unfortunately,C++ mangles function names whether it needs to or not. For example, even when there is only one version of a function, C++ mangles its name. Unless you do something, C++ will change MdlMain to something that MicroStation can't unde

MDL Application Framwork

인도에서 일을 하는데 시간이 잘 안가네요. 아무리 자기 집이 보잘것 없더라도 집만한 곳이 없다는 말이 맞는것 같아요. MSTN XM 부터는 MS Studio의 기능을 사용하여 프로그램을 작성할수 있습니다. GUI도 MFC를 사용하여 작성할 수 있구요.(J에서 GUI를 작성하는 어려움에 비하면 엄청나게 발전한 것입니다.) 앞으로 MSTN XM에서의 몇가지 Sample Code를 올릴 예정입니다. 우선 resource 파일을 살펴보도록 합시다. #include rscdefs.h> #define DLLAPPID 1 /* associate app with dll */ /* MicroStation has it's own compiler and */ /*also has it's own development language*/ /*to create relationship between .ma and .dll*/ /*we need to do following step. which is entry point*/ DllMdlApp DLLAPPID = { // MDL Application name VC++DLL in MDLAPPS or %PATH% "BasicApp_Suther","BasicApp_Suther.dll" } 이 부분(11 ~ 15째 줄)이 J의 resource 파일 부분과 다른 부분인데요, 설명에서 알수 있듯이 .ma 파일과 연관된 .dll 파일을 정의하는 부분입니다. 이 부분을 통해서 코드의 대부분을 .ma 파일에 아닌 .dll 파일에 넣을수 있습니다.

Hatch Pattern의 Sub Entity들의 Symbology 변경하기

Hatch Pattern을 생성한 뒤 Hatch Pattern으로 생성되는 Sub Entity들의 Sub Entity들을 변경하는 방식입니다. 아래 코드는 V7(J)에서 테스트한 코드입니다. if(SUCCESS == mdlElmdscr_new(edP, NULL, newElement)) { mdlElement_setSymbology(edP, nColor, nWeight, nStyle); if(SUCCESS == mdlPattern_hatch(patternEdPP, edP, NULL, NULL, GetRadian(fAngle), 1.0 * unitVal, 0, FALSE, FALSE) ) { ptr = patternEdPP; do { mdlElement_setSymbology((ptr->el), nColor, nWeight, nStyle); }while(ptr = ptr->h.next); mdlElement_setSymbology((patternEdPP)->el, nColor, nWeight, nStyle); mdlElmdscr_add (patternEdPP); mdlElmdscr_display (patternEdPP, 0, NORMALDRAW); mdlElmdscr_freeAll (patternEdPP); mdlElmdscr_freeAll (edP); } else return FALSE; } ptr = patternEdPP; do { mdlElement_setSymbology((ptr->el), nColor, nWeight, nStyle); }while(ptr = ptr->h.next); 이 부분이 Sub Entity들의 Symbology를 변경하는 부분입니다.

소문자 a로 시작하는 폴더에 있는 Python 로딩

글 제목이 좀 이상하죠. 오늘 오후에 겪은 상황인데요... 기존의 프로젝트에서 Python을 임베드해서 잘 사용하고 있었습니다. 그 프로젝트 자체를 복사해서 aTech라는 폴더에 넣었습니다. 그리곤 실행을 하였더니 Python을 로딩하지 못하는게 아니겠습니까? 순간 당황했습니다. 뭔가 잘못됐나하고.. 이리 저리 삽질을 하는 동안 소문자 a로 시작하는 폴더 안에서만 이러한 현상이 발생하는 것을 알았습니다. 이해가 되지 않더군요. 이 이유를 한번 찾아봐야 겠어요... 2012.06.18 숫자를 포함한 폴더에서도 Python 코드를 Import할때 NULL을 리턴하는 현상을 발견했습니다.