기본 콘텐츠로 건너뛰기

라벨이 Block인 게시물 표시

[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 =...

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...

블럭의 색상 변경하기

사용 함수 : ArxSetBlockRefColor(AcDbBlockReference* pBlkRef , const int& colorIndex) /** \brief The ArxSetBlockDefColor function \param objId a parameter of type const AcDbObjectId& \param colorIndex a parameter of type const int& \return void */ void ArxSetBlockDefColor(const AcDbObjectId& objId , const int& colorIndex) { USES_OKEYS; AcDbBlockTableRecord* pRcd; try { ARXOK(acdbOpenObject(pRcd,objId,AcDb::kForRead)); ////////////////////////////////////////////////////////////////////////// AcDbBlockTableRecordIterator* pIterator; if(Acad::eOk == pRcd->newIterator(pIterator)) { for(;pIterator && !pIterator->done();pIterator->step()) { AcDbEntity* pEnt; try { ARXOK(pIterator->getEntity(pEnt,AcDb::kForWrite)); if(pEnt->isKindOf(AcDbBlockReference::desc())) { AcDbObjectId blockId = AcDbBlockReference::cast(pEnt)->blockTableRecord(); pEnt->setColorIndex(c...