기본 콘텐츠로 건너뛰기

7월, 2011의 게시물 표시

Dimension 환경 설정하기

고객사로부터 아래와 같이 Dimension을 표기해 달라는 요청이 들어왔습니다. Dimension을 Dual로 표기해 달라는 것인데, 상단에는 ft-inch로 하단에는 metric으로 표기해 달라는 것이었습니다. 이렇게 표기 가능하도록 MSTN J7의 Dimension 환경 설정을 해보도록 하겠습니다. [Dimension Settings --> Units] Format을 AEC로 선택합니다. Primary Dimension 설정: -> Units을 Feet로 설정합니다. Secondary Dimension 설정: -> Show Secondary Units를 체크합니다. 이렇게 해야만 하단에 Dimension이 표기가 됩니다. -> Units을 Millimeters로 설정합니다. -> Label : 하단에 표기될 단위를 입력합니다. 입력하지 않으면 MM로 표기됩니다. 이렇게 설정하고 나서도 상단의 Dimension 단위 표기가 우리가 원하던 것과 다를 수 있습니다. 상단의 Dimension 단위 설정은 "Setting-->Design File-->Working Units"에서 하실 수 있습니다. Unit Names의 Master Units,Sub Units에서 원하는 단위를 입력하면 됩니다. 이렇게 하면 거의 원하는 Dimension 형식대로 표기할 수 있습니다. 마지막으로 하단의 Dimension을 감싸는 []표기 입니다. 이것을 Dimension Prefix,Suffix라고 하는데 이것은 "Dimension Settings-->Custom Symbols"에서 설정할 수 있습니다. 이렇게 해서 원하는 형식대로 Dimension을 표기할 수 있습니다. 주의) 결과 이미지를 보시면 하단의 Dimension Text가 []사이의 가운데에

C# 프로젝트 오픈 문제

오늘 아침 현재 진행중인 C# 프로젝트는 수정할려고 오픈했는데... 아래와 같은 메세지를 뿌리면서 VS가 오픈을 거부하는 것이 아니겠습니까? Project 'WindowsFormsApplication1' could not be opened because the Microsoft Visual C# 2008 compiler could not be created. Please re-install Visual Studio. 어제 퇴근할 때까지 멀쩡하던 것이 말입니다. 아니 곰곰히 생각해 보니 퇴근할때 컴퓨터를 종료할때 뭔 업데이트를 한다길래 업데이트를 하긴 했습니다만... 그래서 VS2008을 제거/설치를 한 2번 가량 했는데도 여전히 같은 에러를 뱉고 거부하는 것이었습니다. 그래서 구글링을 한 결과... The solution was to run "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe" /ResetSkipPkgs 구글신의 도움으로 문제를 해결했습니다.^^;;

VS의 intellisense가 말썽일때...(VS2005,VS2008)

제가 사용하는 VS2005의 경우 프로젝트를 오픈하고 나면 "Updating Intellisense"라는 문구가 상태바 하단에 표시되고 나서 조금 지나면 VS가 먹통이 되는 현상이 발생했습니다. 심하면 시스템 자체 먹통이 되어 버리고요... 이런 현상이 있으신 분들은 링크 로 가셔서 hotfix를 설치하시면 문제가 해결됩니다. (SP1이 미리 설치되어 있어야 합니다.)

Element 탐색하기 - 두 번째

앞서 Element를 탐색하는 방법을 알아봤는데 이번에는 또 다른 방법을 알아 보도록 하겠습니다. 이번에 알아볼 방법은 Callback함수를 이용하는 방법입니다. Callback함수를 등록시켜 놓으면 scan시 Element를 찾을때 마다 Callback함수를 호출합니다. 아래의 코드를 참조하세요 /*---------------------------------------------------------------------------------**//** author BentleySystems 03/04 +---------------+---------------+---------------+---------------+---------------+------*/ int CNeutralDataFile::ScanCallback ( MSElementDescr* pEd, void* pInfo, ScanCriteria* pScanCriteria ) { UNUSED_ALWAYS(pScanCriteria); CNeutralDataFile* pNeutralDataFile = (CNeutralDataFile*)(pInfo); pNeutralDataFile->WriteElementDescr(pEd , 0L); return SUCCESS; } /* @brief write element to file @author @date 2011.07.04 @param CStdioFile& */ void CNeutralDataFile::WriteToFile(/*CStdioFile* pStdioFile*/) { { ScanCriteria *scP = mdlScanCriteria_create (); /

SWEEP SURFACE V7 / MSTN/MDL/VBA

중국에서 Back Drawing을 만들때 Elbow 형상이 빠져서 나오지 않는다고 메일이 왔습니다. 대부분의 Elbow 형상은 회전 Surface(Surface of revolution)이었기 때문에 회전 Surface만을 처리해 왔었는데, 모델을 받아 보니 회전 Surface가 아니라 Sweep Surface였습니다. 이런 식으로도 Elbow 모델링을 하는구나 싶었습니다. 그런데 왜 이런 식으로 하는지 자세한 이유는 모르겠습니다. Ellipse두개를 Line 4개로 연결한 형상(SWEEP SURFACE)

Sheet 정보 추출하기

아래 코드를 참조하시기 바랍니다. DgnIndexItemP indexItem = NULL; DgnIndexIteratorP pIterator = mdlModelIterator_create(mdlModelRef_getDgnFile (mdlModelRef_getActive())); while(NULL != (indexItem = mdlModelIterator_getNext (pIterator))) { ModelID modelId = mdlModelItem_getModelID (indexItem); DgnModelRefP pModel = NULL; mdlModelRef_createWorking (&pModel,mdlModelRef_getDgnFile(mdlModelRef_getActive ()),modelId,TRUE,TRUE); if(mdlModelRef_isSheet (pModel)) { CDgnSheet DgnSheet(pModel); DgnSheet.GetSheetDefInfo(); //! sheet 정보를 text 파일로 출력(테스트용) DgnSheet.WriteToFile(_T("C:\\TEST.txt")); } mdlModelRef_freeWorking (pModel); } /* @brief get sheet definition @author humkyung @date 2011.07.04 **/ int CDgnSheet::GetSheetDefInfo() { if (mdlModelRef_isSheet (m_pModelRef)) { SheetDef *pSheetDef = NULL; //! sheet definition 생성(mdlSheetDef_new 함수를 통해서만 sheet definition을 생성할 수

SmartSolid에서 Surface 추출

아래의 코드를 이용해서 SmartSolid에서 Surface를 추출할수 있습니다. if(mdlKISolid_isSmartElement(pElmDescr , MASTERFILE , filePos)) { MSElementDescrP destP = NULL; mdlKISolid_beginCurrTrans(MASTERFILE); // SmartSolid를 suface 리스트를 추출 // destP에 추출한 surface 리스트가 담겨 있습니다. mdlKISolid_getSurfaceElements(&destP , pElmDescr , MASTERFILE , NULL); mdlKISolid_endCurrTrans(); WriteElementDescr(oFile , pDgnModelRef , destP , filePos , dUOR , DGNType); mdlElmdscr_freeAll (&destP); }

Problem with COM and MsExcel (Brunain Christophe)

■ 파이썬_02 [python-win32] Re: Problem with COM and MsExcel (Brunain Christophe) Niels Steen Krogh nielssteenkrogh@hotmail.com Wed, 02 Apr 2003 19:45:31 +0200 Previous message: [python-win32] Problem with COM and MsExcel Next message: [python-win32] "Casting" COM objects Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] -------------------------------------------------------------------------------- Hi! This script might help you - use CoInitialize ..... It helped me in a situation similar to yours. Good luck Niels from win32com . client import Dispatch from pythoncom import CoInitialize , CoUninitialize CoInitialize ( ) #start com thread - kan udelades, men vil mindske stabiliteten o = Dispatch ( "Excel.Application" ) #start excel o . Visible = 0 #excel k?rer i baggrunden o . Workbooks . Open ( Filename = 'c:\\dokumenter\\mappe14.xls' ) #get the workbook o . Workbooks ( 1 ) . Sheets ( 1 ) . Cells .

[python] dictionary sorting

■ 파이썬_02 [python] dictionary sorting 딕셔너리.. 맵에 데이터를 넣고 정렬할게 생겨서... 할려다 보니... 어찌해야 하나 고민이 되었습니다. 음... c++의 stl에서는 잘 되는것인데... 그래도 찾다보니 key값으로 sorting하는것은 dickeys = dic.keys() dickeys.sort() for i in dickeys: print i, dic[i] 그러면... value로 sorting 하는 방법은... diclist = [] for i in dic.keys(): diclist.append( (i, dic[i]) ) diclist.sort( key = lambda(x,y):y ) for i in diclist: print i[0], i[1] 음... 이 방법 이외에... from operator import itemgetter dict = {} dict['a'] = 2 dict['b'] = 1 dict['c'] = 5 print sorted(dict.iteritems(), key=itemgetter(1), reverse=True) 로 하게 되면... value의 값으로 정렬을 하게 된다는거... 음... python.. 쉬우면서도 어려운... ㅎㅎ

Recipe 440498: Win32com - Batch repathing of Autocad Xrefs

■ 파이썬_01 Recipe 440498: Win32com - Batch repathing of Autocad Xrefs ________________________________________ This script asks for a base directory and then changes all xrefs in all drawings in all subdirectories so that they use relative paths. To use it just copy it somewhere in your target directory structure and run. Python # Relative-refs.pyw """A short python script for repathing xrefs in Autocad.""" import win32com . client,os, os . path, tkFileDialog from Tkinter import * from tkMessageBox import askokcancel from time import sleep # Get a COM object for Autocad acad = win32com . client . Dispatch ( "AutoCAD.Application" ) def repath ( filename ) : print 'Repathing %s...' %filename doc = acad . Documents . Open ( filename ) blocks = doc . Database . Blocks # Internally xrefs are just blocks! xrefs = [ item for item in blocks if item . IsXRef]     if xrefs: for xref in x

Autocad Automation

■ 파이썬_01 Autocad Automation This example comes from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440493. It searches the ModelSpace collection for text objects. Once found it casts them and alter one of the text specific properties. To test this code AutoCAD must be started with a blank file open add at least one dtext object with 'Spam' as its value: import win32com . client acad = win32com . client . Dispatch ( "AutoCAD.Application" ) doc = acad . ActiveDocument # Document object ms = doc . ModelSpace # Modelspace "collection" count = ms . Count # Number of items in modelspace for i in range ( count ) : item = ms . Item ( i ) if 'text' in item . ObjectName . lower ( ) : # Text objects are AcDbText # once we know what it is we can cast it text = win32com . client . CastTo ( item , "IAcadText" ) if text . TextString = = "Spam"

Python

■ 파이썬_01 Nabble.addCssRule(document.styleSheets[0],'.nabble a:link','color:'+document.linkColor); Nabble.addCssRule(document.styleSheets[0],'.nabble a:visited','color:'+document.vlinkColor); if (!Nabble.isEmbedded) { document.write('Nabble | Old Nabble1'); } else if (false) { document.write('Back to the forum'); } Nabble | Old Nabble1 | Software ≫ SourceForge ≫ SWIG ≫ swig-user Login : Register Nabble.userHeader(3366); Swig Python/Autocad binding View: Threaded Chronologically All Messages Nabble.selectOption(Nabble.get("nabble.viewSelect"),Nabble.tview); New views 9 Messages ? Rating Filter: 0 1 2 3 4 5 Alert me if( Nabble.user == 799921 || Nabble.user == 77858) { document.writeln('Move thread'); } Swig Python/Autocad binding document.write(Nabble.ratingStars(3)); by document.write(' Mick Duprez document.write(''); document.write(Nabble.formatDateLong(new Date(1219651075018))); Aug 25, 20

WINDOW ERROR CODES

■ WINDOW ERROR CODES http://support.microsoft.com . Constant/value Description ERROR_SUCCESS  / The operation completed successfully. ERROR_INVALID_FUNCTION / Incorrect function. ERROR_FILE_NOT_FOUND / The system cannot find the file specified. ERROR_PATH_NOT_FOUND / The system cannot find the path specified. ERROR_TOO_MANY_OPEN_FILES / The system cannot open the file. ERROR_ACCESS_DENIED / Access is denied. ERROR_INVALID_HANDLE / The handle is invalid. ERROR_ARENA_TRASHED / The storage control blocks were destroyed. ERROR_NOT_ENOUGH_MEMORY / Not enough storage is available to process this command. ERROR_INVALID_BLOCK / The storage control block address is invalid. ERROR_BAD_ENVIRONMENT / The environment is incorrect. ERROR_BAD_FORMAT / An attempt was made to load a program with an incorrect format. ERROR_INVALID_ACCESS / The access code is invalid. ERROR_INVALID_DATA / The data is invalid. ERROR_OUTOFMEMORY / Not enough storage is