乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 89|回复: 1

[编程交流] Convert VB.NET 2013 to 2018,20

[复制链接]

6

主题

7

帖子

1

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-6 21:44:09 | 显示全部楼层 |阅读模式
I found a vb.net that should renumber sheet sets
         
         
  1. /* * © Andrey Bushman, 2013 * AutoCAD 2014 x64 Enu *  * AutoCAD references: * * AcCoreMgd.dll * AcDbMgd.dll * AcMgd.dll * Interop.ACSMCOMPONENTS19Lib.dll */using System;using System.Collections.Generic;using System.Linq;using System.Text; using cad = Autodesk.AutoCAD.ApplicationServices.Application;using App = Autodesk.AutoCAD.ApplicationServices;using Db = Autodesk.AutoCAD.DatabaseServices;using Ed = Autodesk.AutoCAD.EditorInput;using Rtm = Autodesk.AutoCAD.Runtime;using Comp = ACSMCOMPONENTS19Lib; [assembly: Rtm.CommandClass(typeof(Bushman.AutoCAD.SheetSetEditor.Commands))] namespace Bushman.AutoCAD.SheetSetEditor {     public class Commands {         const String ns = "bush"; // namespace         [Rtm.CommandMethod(ns, "test", Rtm.CommandFlags.Modal)]        public void Renumber() {            App.Document doc = cad.DocumentManager.MdiActiveDocument;            Db.Database db = doc.Database;            Ed.Editor ed = doc.Editor;            Comp.AcSmSheetSetMgr mng = new Comp.AcSmSheetSetMgr();            Comp.IAcSmEnumDatabase enumerator = mng.GetDatabaseEnumerator();            Comp.AcSmDatabase smDb = null;            while ((smDb = enumerator.Next()) != null) {                String fname = smDb.GetFileName();                Comp.AcSmSheetSet sheetset = smDb.GetSheetSet();                String name = sheetset.GetName();                String descr = sheetset.GetDesc();                ed.WriteMessage("\nSheet Set: {0}\n", name);                Comp.IAcSmEnumComponent encomp = sheetset.GetSheetEnumerator();                Comp.IAcSmComponent component = null;                while ((component = encomp.Next()) != null) {                    ProcessElement(ed, component, 0);                }                encomp.Reset();            }            enumerator.Reset();        }         // Recursive processing of the elements        void ProcessElement(Ed.Editor ed, Comp.IAcSmComponent component, Int32 level) {            ed.WriteMessage("\t{0}{1} (Subset)\n", new String('\t', level), component.GetName());            Array array = null;            component.GetDirectlyOwnedObjects(out array);            if (array != null) {                Int32 sheet_number = 0;                foreach (var item in array) {                    if (item is Comp.IAcSmSubset) {                        ProcessElement(ed, (Comp.IAcSmSubset)item, level + 1);                    }                    else if (item is Comp.IAcSmSheet) {                        Comp.IAcSmSheet sheet = (Comp.IAcSmSheet)item;                        ed.WriteMessage("\t\t{0}{1} (Sheet)", new String('\t', level), sheet.GetName());                        sheet.SetNumber(sheet_number.ToString()); // I get an exception here!                        ++sheet_number;                    }                    else if (item is Comp.IAcSmPersist) {                        Comp.IAcSmPersist persist = (Comp.IAcSmPersist)item;                        ed.WriteMessage("\t\t{0}Additional info: {1}", new String('\t', level), persist.GetTypeName());                    }                    else {                        ed.WriteMessage("\t\t{0}Unknown object: {1}", new String('\t', level), item.GetType().ToString());                    }                    ed.WriteMessage("\n");                }            }        }    }}
 
         
         
        ...I tried converting this vb.net from 2013 to 2018,2019,2020, but I just can get errors. So, I need your help.
         
         
         
         
         
         
回复

使用道具 举报

2

主题

261

帖子

20

银币

初来乍到

Rank: 1

铜币
8
发表于 2022-7-6 23:11:50 | 显示全部楼层
If you don't know how to use SSM, then why are you using it?
        What exactly do you want to do?
        Open your file, select the desired title block and enter the number - it's easy.
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 16:41 , Processed in 0.456237 second(s), 56 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表