기본 콘텐츠로 건너뛰기

라벨이 Attribute인 게시물 표시

[EYESHOT] BlockReference의 Attribute를 Text로 생성

두 도면 비교를 쉽게 하기 위해 BlockReference를 Explode 시키기로 했습니다. Attribute를 제외한 다른 항목들은 Expolode한 결과를 그대로 사용하면 되는데 Attribute는 Explode한 결과가 Explode하기 전과 달랐습니다. 이를 해결하기 위해 여러 방법을 시도해 봤는데 그 결과가 만족스럽지 못했습니다. Explode한 Attribute의 수가 화면에 보이는(Explode하기 전의) 수와 다를 경우도 있고, Attribute의 TAG를 찾지 못하는 경우도 있었습니다. 여러 방법을 시도하는 중 가장 합리적인 방법을 찾았습니다. 아래는 Attribute에 대응하는 Text를 생성하는 방법입니다. var attributes = blkref.Attributes.Where(x => x.Value.Visible).ToList(); foreach(var attr in attributes) { var pt = attr.Value.InsertionPoint.Clone() as devDept.Geometry.Point3D; var plane = attr.Value.Plane.Clone() as devDept.Geometry.Plane; string TextString = attr.Value.Value; #region 특수 문자 처리 TextString = TextString.Replace("%%", string.Empty); #endregion var txt = new Text(plane, pt, TextString, attr.Value.Height) { LayerName = LayerName, Color = color != Color.Empty ? color : GetAttributeColor(Layers, GetEntColor(Layers, blkref), attr.Value) ColorMethod =...

데이터 위주의 프로그래밍

동료가 새로운 프로젝트를 맡게되어 하던 일을 제가 이어 하게 되었습니다. 프로젝트 전반적인 내용은 알고 있는 상태였고 개발에 앞서 지금까지 작성한 코드를 리뷰하였습니다. 가장 눈에 띄는 부분은 클래스 데이터를 자동화하여 데이타베이스로 저장하는 구조였습니다. 클래스의 속성을 읽어와 자동으로 데이타베이스로 저장하는 SQL 구문을 작성하게 되어 있었습니다. 'EntityFramework을 사용하면 되지'하는 사람도 있을 것 같습니다. 이 글은 코드 리뷰에 대한 것임을 미리 말씀드립니다. var eqStructureProperties = typeof ( Document . EQStructure ) . GetProperties ( ) ; for ( int i = 0 ; i < eqStructureProperties . Length ; i ++ ) { string sColumnName = eqStructureProperties [ i ] . Name ; if ( sColumnName != "Entity" ) { object oValue = data . GetType ( ) . GetProperty ( sColumnName ) . GetValue ( data , null ) ; sColumns += string . Format ( "[{0}]," , sColumnName ) ; if ( Document . _notStringColumns . Contains ( sColumnName ) ) { sValues += string . Format ( "{0}," , oValue == null ? "" : oValue . ToString ( ) ) ; } else { sValues ...