latour_g 发表于 2019-11-20 16:53:46

实体夹具预览不适用于注释块

嗨,标题说明了一切,我在插入块时使用实体夹具来查看块预览。除了注释性块之外,它工作正常,没有预览显示。注释性块需要做些什么吗?下面是我的一段代码:    point 3d pt = new point 3d(0,0,0);。
block reference br = new block reference(pt,Bt);。
brTransformBy(编辑,CurrentUserCoordinateSystem);。
brScaleFactors = (bAnno)?新Scale3d(1,1,1):新Scale3d(nScale,nScale,n scale);。

if (bAnno)。
{。
BlockTableRecord btr 2 =(block tablerecord)tr,GetObject(br,BlockTableRecord,OpenMode。for write);。
btr2注释性=注释性状态,真实;。
ObjectContextManager ocm = db,ObjectContextManager。
ObjectContextCollection OCC = ocm,GetContextCollection(" ACDB _注释刻度");。
对象上下文,AddContext(btr2,occ。当前上下文);。
}。

insert jig ent jig = new insert jig(br);。
工具,SetFocusToDwgView();。
提示结果pr = ed,拖动(entJig);。
字符串c = pr,StringResult谢谢!。
**** Hidden Message *****

Hanauer 发表于 2019-11-21 07:51:33

对我来说,夹具与块注释性工程。
是否在当前空间(当前空间)中添加了块引用。AppendEntity(br)?
将当前注释性比例添加到块参照的位置(br。添加上下文(occ。当前上下文)?
尝试替换ObjectContexts。AddContext(btr2,occ。当前上下文);带br。添加上下文(occ。当前上下文);
示例https://www . keanw . com/2015/05/jigging-an-AutoCAD-block-with-attributes-using-net-redux . html

var currentSpace = (BlockTableRecord)tr.GetObject(m_db.CurrentSpaceId, OpenMode.ForWrite);
br.TransformBy(m_doc.Editor.CurrentUserCoordinateSystem);
currentSpace.AppendEntity(br);
tr.AddNewlyCreatedDBObject(br, true);
if (btr.Annotative == AnnotativeStates.True)
{
   ObjectContextManager ocm = m_db.ObjectContextManager;
   ObjectContextCollection occ = ocm.GetContextCollection("ACDB_ANNOTATIONSCALES");
   br.AddContext(occ.CurrentContext);
}
else
{
      br.ScaleFactors = new Scale3d(br.UnitFactor);
}

latour_g 发表于 2019-11-21 09:59:50

现在的工作代替ObjectContexts。AddCo
页: [1]
查看完整版本: 实体夹具预览不适用于注释块