• 导入部件并创建添加到新建装配中


    从atc文件中导入部件但挡墙dwg中,

    工具选项板对应的atc文件与创建部件pkt文件中的atc文件稍有区别,

    主要体现在dll文件的路径上,

    另外数据类型名称,

    需要首字母大写,

    比如Double不能写成double,

    如果是小写,

    导入过程中识别不了部件的参数...

    测试代码如下:

    public void C_SaiTest()
    {
        Document acDoc = Application.DocumentManager.MdiActiveDocument;
        Database acCurDb = acDoc.Database;
        Editor ed = acDoc.Editor;
        CivilDocument civilDoc = CivilApplication.ActiveDocument;
        var rootkey = HostApplicationServices.Current.UserRegistryProductRootKey;
        RegistryKey key = Registry.CurrentUser.OpenSubKey(rootkey);
        var rrf = key.GetValue("RoamableRootFolder").ToString();
        //部件的GUID
        string guid = "55729DA9-FCBF-465B-A4D1-E2E88DD56F50";
    
        using (Transaction tr = acDoc.TransactionManager.StartTransaction())
        {
            //ESSubassembly.atc为路基选项板对应的atc文件
            var saId = civilDoc.SubassemblyCollection.ImportSubassembly("双线铁路路基",
                        rrf + @"\Support\ToolPalette\Palettes\ESSubassembly.atc",
                            guid, Point3d.Origin);
            var id = civilDoc.AssemblyCollection.Add("双线铁路路基", AssemblyType.Other, Point3d.Origin);
            //var sa = saId.GetObject(OpenMode.ForWrite) as Subassembly;
            //ed.WriteMessage("\n" + sa.ParamsDouble.Count);
            var ass = id.GetObject(OpenMode.ForWrite) as Assembly;
            ass.AddSubassembly(saId);
            tr.Commit();
        }
    }
  • 相关阅读:
    MessageDigest类提供MD5或SHA等加密算法
    23种设计模式之策略设计模式
    n & (n-1)
    ubuntu 常用软件配置
    minicom 没有tx 信号
    usb 驱动
    全局变量的危害
    编写安全代码:小心volatile的原子性误解
    ADB Server Didn’t ACK ,failed to Start Daemon 解决方法
    字长
  • 原文地址:https://www.cnblogs.com/myzw/p/16056038.html
Copyright © 2020-2023  润新知