zoukankan      html  css  js  c++  java
  • 将外部图块插入当前图形(c#代码)

    在使用C#开发AutoCad工具的过程中,需要将外部定义好的dwg图块文件调入到当前文件中,在网上查阅了许多相关资料,所涉及的并不多,整理起来如下:
     1 public ObjectId InsertBlock(string fileName)
     2 {
     3     ObjectId blockId;
     4     //图形数据库读取外部图块
     5     Database blockDatabase = new Database(falsetrue);
     6     blockDatabase.ReadDwgFile(fileName, System.IO.FileShare.Read, falsestring.Empty);
     7     blockDatabase.CloseInput(true);
     8 
     9     Database db = HostApplicationServices.WorkingDatabase;
    10     using(Transaction trans = db.TransactionManager.StartTransaction())
    11     {
    12         BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForWrite);
    13         string blockName = SymbolUtilityServices.GetBlockNameFromInsertPathName(fileName);
    14         //将外部图块插入到当前模型空间
    15         blockId = db.Insert(blockName, blockDatabase, false);
    16         trans.Commit();
    17     }
    18     return blockId;
    19 }
  • 相关阅读:
    render :template 和 render :parital
    routes.rb和link_to的一些规则
    rails程序文件名命名规范
    Ruby的模型关系随笔
    Ruby的require相关知识
    rails中的form_for
    rails中的session
    RubyMine不能调试Rails项目的问题
    序列化后的json串与解析json串实体间的关系
    mysql还原数据库
  • 原文地址:https://www.cnblogs.com/figo/p/1122276.html
Copyright © 2011-2022 走看看