• 大小: 6.57MB
    文件类型: .rar
    金币: 2
    下载: 2 次
    发布日期: 2021-04-07
  • 语言: 其他
  • 标签: Teigha  Net  OpenDwg  CAD  

资源简介

Teigha_Net_4.00_10 的一些使用例子,包括保存DWG文件,读取,增加,修改实体等操作。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Teigha.DatabaseServices;
using Teigha.Runtime;
using Teigha.Geometry;
using Teigha.GraphicsInterface;
using Teigha.GraphicsSystem;

namespace RepText
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender EventArgs e)
        {
            using (Services ser = new Services())
            {
                string fname = “D:\\aaa.dwg“;
                Database db = new Database(falsefalse);
                db.ReadDwgFile(fnameSystem.IO.FileShare.Readfalsenull);
                using (var trans = db.TransactionManager.StartTransaction())
                {
                    BlockTableRecord btrec = (BlockTableRecord)trans.Getobject(db.CurrentSpaceId OpenMode.ForWrite);
                    foreach (objectId objid in btrec)
                    {
                        Entity ent = trans.Getobject(objidOpenMode.ForWrite) as Entity;
                        if (ent.GetType().Name == “DBText“)
                        {
                            DBText txt = (DBText)ent;
                            if (txt.TextString == “aaa“)
                            {
                                txt.TextString = “bbb“;
                            }
                        }
                    }
                    trans.Commit();
                }
                db.Save();
                db.Dispose();
            }

        }

        private void button2_Click(object sender EventArgs e)
        {
            using (Services svc = new Services())
            {
                string fname = “D:\\aaa.dwg“;
                Database db = new Database();
                using (var tr = db.TransactionManager.StartTransaction())
                {
                    Point3d pt1 = new Point3d(0 0 0);
                    string str = “aaa“;
                    DBText txt = new DBText();
                    txt.Position = pt1;
                    txt.TextString= str;
                    BlockTableRecord btr = (BlockTableRecord)tr.Getobject(db.CurrentSpaceId OpenMode.ForWrite);
                    btr.AppendEntity(txt);
                    tr.AddNewlyCreatedDBobject(txt true);
                    tr.Commit();
                    db.SaveAs(fnameDwgVersion.AC1800);
                    db.Dispose();
                }
            }

        }

        private void button3_Click(object sender EventArgs e)
        {
            using (Services svc = new Services())
            {
                string fname = “D:\\aaa.dwg“;
                Database db = new Database(falsefalse);
                db.ReadDwgFile(fname System.IO.FileShare.Readfalse  null)

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        144  2016-01-22 14:06  RepText\RepText\app.config

     文件     112128  2014-06-02 19:56  RepText\RepText\bin\Debug\ExCommands_4.00_10.tx

     文件      97792  2014-06-02 19:56  RepText\RepText\bin\Debug\ExFieldEvaluator_4.00_10.tx

     文件     145408  2014-06-02 19:56  RepText\RepText\bin\Debug\GripPoints_4.00_10.tx

     文件        381  2014-06-03 06:43  RepText\RepText\bin\Debug\mgd.manifest

     文件     122368  2014-06-02 19:56  RepText\RepText\bin\Debug\ModelerGeometry_4.00_10.tx

     文件     415744  2014-06-02 19:56  RepText\RepText\bin\Debug\msvcp100.dll

     文件     768512  2014-06-02 19:56  RepText\RepText\bin\Debug\msvcr100.dll

     文件      49664  2014-06-02 19:56  RepText\RepText\bin\Debug\PlotstyleServices_4.00_10.tx

     文件     409088  2014-06-02 19:56  RepText\RepText\bin\Debug\PSToolkit_4.00_10.dll

     文件      31232  2014-06-02 19:56  RepText\RepText\bin\Debug\RasterProcessor_4.00_10.tx

     文件     350720  2014-06-02 19:56  RepText\RepText\bin\Debug\RecomputeDimBlock_4.00_10.tx

     文件      10240  2016-01-22 17:14  RepText\RepText\bin\Debug\RepText.exe

     文件        144  2016-01-22 14:06  RepText\RepText\bin\Debug\RepText.exe.config

     文件      24064  2016-01-22 17:14  RepText\RepText\bin\Debug\RepText.pdb

     文件      11600  2016-01-22 17:14  RepText\RepText\bin\Debug\RepText.vshost.exe

     文件        144  2016-01-22 14:06  RepText\RepText\bin\Debug\RepText.vshost.exe.config

     文件        490  2010-03-17 22:39  RepText\RepText\bin\Debug\RepText.vshost.exe.manifest

     文件    2400768  2014-06-02 19:56  RepText\RepText\bin\Debug\RxRasterServices_4.00_10.tx

     文件     838656  2014-06-02 19:56  RepText\RepText\bin\Debug\sisl.dll

     文件     685568  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_AcisBuilder_4.00_10.dll

     文件       9728  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_Alloc_4.00_10.dll

     文件     299008  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_BrepRenderer_4.00_10.dll

     文件      72704  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_Br_4.00_10.dll

     文件     336384  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_DbRoot_4.00_10.dll

     文件    9137152  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_Db_4.00_10.dll

     文件     113192  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_DgnDb_4.00_10.tx

     文件     361984  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_DgnImport_4.00_10.tx

     文件     578048  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_DynBlocks_4.00_10.tx

     文件    1050624  2014-06-02 19:56  RepText\RepText\bin\Debug\TD_Ge_4.00_10.dll

............此处省略45个文件信息

评论

共有 条评论