AutoCAD图形查找块参考 [英] Autocad Drawing Find Block Reference

查看:183
本文介绍了AutoCAD图形查找块参考的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过使用acadblock找到acadblockreference(Autocad),但我找不到acadblock的acadentity,但是找不到该acadentity的acadblockreference.我怎么找到它.

-Amol

I am trying to find the acadblockreference (Autocad) by using the acadblock i got acadentity of acadblock but can not find the acadblockreference of that acadentity. How can i find it.

-- Amol

推荐答案

Autodesk在其站点上具有非常完整的API参考和大量示例.我建议您从那里开始,或者如果仍然遇到问题,请联系您的VAR.

但是,通常,ACAD工程图的结构类似于XML或组织分层结构的Excel对象模型.顶部是应用程序,下面是工程图,下面是图层,块等.要获得对块的引用,您必须知道块的名称,才能直接通过块集合或通过块集合访问它.遍历它,直到找到所需的那个.我知道,事实上,如果您搜索AutoDesk的网站和Google,就会有代码示例.
Autodesk has a very complete API reference and lots of examples on their site. I suggest you start there or reach out to your VAR if you still get stuck.

But, in general, ACAD drawings are structured sort of like XML or the Excel object model where the organization is hierarchical. At the top is the application, below that is the drawing(s), below that is layers, blocks, etc. To get a reference to a block you have to know the name of the block to access it directly through the block collection or iterate through it until you find the one you want. I know, for a fact, there are code examples out there if you search AutoDesk''s web site and Google.


最好查看API文档
让您知道从哪里开始:
您将无法直接访问必须在块表上进行迭代的块.

---------------------

Better to look in the API documentation
To give you an idea where to start:
You will not get direct access to a block you will have to iterate over the block table.

---------------------

using Autodesk.AutoCAD.DatabaseServices;


BlockTable _bt = (BlockTable)_t.GetObject(_cdb.BlockTableId, OpenMode.ForRead, false);
foreach (ObjectId btrId in _bt)
{
    BlockTableRecord _btr = (BlockTableRecord)_t.GetObject(btrId, OpenMode.ForRead, false);
    if (!_btr.IsAnonymous && !_btr.IsLayout && (_btr.IsFromExternalReference || _btr.IsFromOverlayReference))
    {
        Boolean _PathIsRelative = false;
        String _xrefPath = _btr.PathName;
        String _PathAbsolute = XRefRelink.Helper.RelativePath.GetPathAbsolute(_currentPath, _xrefPath);
        if (_PathAbsolute.ToUpper() != _xrefPath.ToUpper())


这篇关于AutoCAD图形查找块参考的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆