Bentley Communities
Bentley Communities
  • Site
  • User
  • Site
  • Search
  • User
Bentley 中国优先社区
  • Welcome to Bentley Communities
  • Bentley's Communities
  • Bentley 中国优先社区
  • Cancel
Bentley 中国优先社区
技术资料库 设置工作单位
    • Sign In
    Bentley 中国优先社区 requires membership for participation - click to join
    • -Bentley 中文技术资料库
      • +AutoPIPE
      • +Bentley Civil
      • +Bentley Navigator
      • +Bentley Substation
      • +BRCM
      • +BridgeMasterModeler/OpenBridgeModeler
      • +i-model / DgnDb
      • +LumenRT/ContextCapture
      • -MicroStation
        • +01-常见问题解答
        • +02-培训资料
        • +03-软件安装与配置
        • +04-图形用户界面
        • +05-辅助绘图
        • +06-二维绘图
        • +07-三维建模
        • +08-渲染和动画
        • +09-打印
        • +10-元素选择和操作/测量
        • +11-单元/组/图案化
        • +12-文字/标注/表格/报表
        • +13-自定义线型和多线
        • +14-单位和坐标系
        • +15-模型与参考文件
        • +16-视图和层
        • +17-动态视图和组图
        • +18-光栅/点云/实景
        • +19-DGN/DWG及格式转换
        • +20-实用工具
        • -21-二次开发
          • Addin程序集接口扩充
          • +MDL函数勘误
          • MDL程序员指南
          • +MicroStation二次开发专题文章
          • -MVBA小程序
            • Mstn V8i如何引用64位的Excel
            • MVBA中操作选择集小结
            • 在VBA代码中实现浏览文件夹功能
            • 将指定范围内的元素添加到选择集
            • 根据文件位置获取对应的元素
            • 根据文本节点号选中文本节点元素
            • 沿着B样条曲线放置单元
            • 添加数据库链接
            • 设置工作单位
            • 输出当前的颜色表
            • 通过VBA让电脑说话
          • 一步步学习MicroStation CE Addin(C#)开发
          • 一步步学习MicroStation CE MDL(C++)开发
          • 一步步学习MicroStation V8i Addin开发
          • 一步步学习MicroStation V8i MDL开发
          • 二次开发常见问题解答
          • 如何寻求Bentley代码级技术支持?
          • 学习Microstation交互式工具开发
          • 精选MicroStation二次开发文章
        • +22-其它
        • +23-MicroStation与iTwin交互
        • +24- Learning Tips
      • +MOSES
      • +OpenBuildings Designer
      • +OpenFlows
      • +OpenPlant
      • +OpenPlant Electrical CCK
      • Plaxis 地质分析
      • +ProjectWise
      • +ProStructures
      • +SACS
      • +STAAD.Pro
      • +SYNCHRO Pro
      • +其 它
      • +建筑设计之思考(赵大师专作)
      • +桥梁大师<BridgeMaster>
      • +现浇箱梁
      • +软件激活及授权
    • +iTwin 数字孪生平台
    • Bentley二次开发资料库
    • +常见问题汇总
    • Bentley-Learn 官方教学平台-使用方法
    • +中国优先社区使用指南
    • +Bentley学习资料库
    • +Bentley用户成功活动精选
    • +服务合作伙伴计划

     
     Questions about this article, topic, or product? Click here. 

    设置工作单位

    如下MVBA代码可以对当前模型重新设置其工作单位(Working Unit)。注意代码结尾处对SaveSettings的调用很重要,否则设置的工作单位将不被保存。

    Sub Main()
        Dim masterUnit As MeasurementUnit
        Dim subUnit As MeasurementUnit
        masterUnit.System = msdMeasurementSystemMetric
        masterUnit.Base = msdMeasurementBaseMeter
        masterUnit.Label = "m"
        masterUnit.UnitsPerBaseDenominator = 1
        masterUnit.UnitsPerBaseNumerator = 1
        
        subUnit.System = msdMeasurementSystemMetric
        subUnit.Base = msdMeasurementBaseMeter
        subUnit.Label = "mm"
        subUnit.UnitsPerBaseDenominator = 1
        subUnit.UnitsPerBaseNumerator = 1000
        
        ActiveModelReference.masterUnit = masterUnit
        ActiveModelReference.subUnit = subUnit
        ActiveModelReference.StorageUnit = masterUnit
        ActiveModelReference.UORsPerStorageUnit = 10000
        SaveSettings
    End Sub
    • Share
    • History
    • More
    • Cancel
    • Yongan.Fu Created by Bentley Colleague Yongan.Fu
    • When: Sun, Sep 18 2016 10:45 PM
    • Yongan.Fu Last revision by Bentley Colleague Yongan.Fu
    • When: Wed, Mar 8 2023 12:55 AM
    • Revisions: 2
    • Comments: 0
    • Sign in to reply
    Recommended
    Related
    Communities
    • Home
    • Getting Started
    • Community Central
    • Products
    • Support
    • Secure File Upload
    • Feedback
    Support and Services
    • Home
    • Product Support
    • Downloads
    • Subscription Services Portal
    Training and Learning
    • Home
    • About Bentley Institute
    • My Learning History
    • Reference Books
    Social Media
    •    LinkedIn
    •    Facebook
    •    Twitter
    •    YouTube
    •    RSS Feed
    •    Email

    © 2023 Bentley Systems, Incorporated  |  Contact Us  |  Privacy |  Terms of Use  |  Cookies