第十章 可视界面

Private Sub UserForm_Initialize()

Dim ViewCen As Point3d

Dim MyView As View

For Each MyView In ActiveDesignFile.Views

cmbViews.AddItem MyView.Index

Next

cmbViews.ListIndex = 

ViewCen = ActiveDesignFile.Views().Center

ScrX.Value = ViewCen.X

scrY.Value = ViewCen.Y

End Sub

Sub SetZoom(ZoomValue As Long, OldZoomValue As Long)

ActiveDesignFile.Views(cmbViews.Text).Zoom  + (ZoomValue - OldZoomValue) / 

ActiveDesignFile.Views(cmbViews.Text).Redraw

End Sub

Sub SetPan(XPan As Long, YPan As Long)

Dim ViewOrigin As Point3d

ViewOrigin.X = XPan

ViewOrigin.Y = YPan

ViewOrigin.Z = 

ActiveDesignFile.Views(cmbViews.Text).Center = ViewOrigin

ActiveDesignFile.Views(cmbViews.Text).Redraw

End Sub

Private Sub scrZoom_Change()

SetZoom ScrZoom.Value, ScrZoom.Tag

ScrZoom.Tag = ScrZoom.Value

End Sub

Private Sub scrZoom_Scroll()

SetZoom ScrZoom.Value, ScrZoom.Tag

ScrZoom.Tag = ScrZoom.Value

End Sub

Private Sub scrX_Change()

SetPan ScrX.Value, scrY.Value

End Sub

Private Sub scrX_Scroll()

SetPan ScrX.Value, scrY.Value

End Sub

Private Sub scrY_Change()

SetPan ScrX.Value, scrY.Value

End Sub

Private Sub scrY_Scroll()

SetPan ScrX.Value, scrY.Value

End Sub

本章回顾:

1.所有空间都有属性、方法和事件

2.访问空间的属性和方法的格式是:空间名,一个点号,属性和方法,需要时提供参数

3.程序运行时,用户与界面间的交互触发事件

4.用Show方法显示用户窗体

5.在窗口显示前,用Initialize事件设置值和增加控件

第十一章 MicroStation对象模型——对象

提供了库的对象模型,VBA中的对象浏览器最有帮助,VBA还包括其他有助于开发的工具,例如添加监视和自动列表功能

第十二章 MicroStation对象模型——枚举 Enumeration

枚举的优点:在分析代码时能更容易地看到所需参数的结果。

枚举成员名称经常以枚举名称或枚举名称的缩略版本开头。例如msdDesignFileFormatDWG 就是枚举名称“MsdDesignFileFormat”开头的。

MicroStation中所有的枚举都是以指定的三个字符“Msd”开头,所有的成员都以“msd”开头

第十四章 MicroStation对象模型——事件

对象具有方法、属性和事件。

P259

P155

第十五章 向文档中添加内容

使用冒号(:)把两行代码放到一行。将同一顶点的赋值放在一行上也增加了代码的易读性

Sub CreateLines()

Dim LinePoints1( To ) As Point3d

Dim LinePoints2( To ) As Point3d

Dim myLine1 As LineElement

Dim myLine2 As LineElement

Dim I As Long

For I =  To  Step 

LinePoints1(I).X = I ^  - I ^ : LinePoints1(I).Y = I + I ^ 

LinePoints2(I).X = I ^  - I ^ : LinePoints2(I).Y = -(I + I ^ )

Next I

Set myLine1 = CreateLineElement1(Nothing, LinePoints1)

Set myLine2 = CreateLineElement1(Nothing, LinePoints2)

ActiveModelReference.AddElement myLine1

ActiveModelReference.AddElement myLine2

End Sub

Sub CLines(ParamArray PointElems() As Variant)

If (UBound(PointElems) + ) Mod  <>  Then

MsgBox "Invaid number of point elements", vbCritical

Exit Sub

End If

If (UBound(PointElems) + ) <  Then

MsgBox "A minimum of 2 X,Y,Z points must be provided.", vbCritical

Exit Sub

End If

Dim LinePoints() As Point3d

ReDim LinePoints( To (UBound(PointElems) + ) \ ) As Point3d

Dim I As Long

Dim PointCounter As Long

Dim MyLine As LineElement

For I = LBound(PointElems) To UBound(PointElems) Step 

LinePoints(PointCounter).X = PointElems(I)

LinePoints(PointCounter).Y = PointElems(I + )

LinePoints(PointCounter).Z = PointElems(I + )

PointCounter = PointCounter + 

Next I

Set MyLine = CreateLineElement1(Nothing, LinePoints)

ActiveModelReference.AddElement MyLine

End Sub

Sub TestCLines()

CLines , , , , , , , , , , , , , , 

CLines , , , , , 

CLines , , , , , 

CLines , , , , 

CLines , , 

End Sub

建立形

Function CreatePolygon(CenterPoint As Point3d, NumOfSides As Long, Radius As Double) As ShapeElement

Dim myShape As ShapeElement

Dim ShapePoints() As Point3d

ReDim ShapePoints( To NumOfSides - ) As Point3d

Dim PointIndex As Long

Dim IncAngle As Double

IncAngle =  / NumOfSides

For PointIndex = LBound(ShapePoints) To UBound(ShapePoints)

ShapePoints(PointIndex) = Point3dAddAngleDistance(CenterPoint, Radians(IncAngle * PointIndex), Radius, )

Next

Set CreatePolygon = CreateShapeElement1(Nothing, ShapePoints)

End Function

Sub TestCreatePolygon()

Dim CPoint As Point3d

Dim myShape As ShapeElement

Dim I As Long

Dim Length As Double

Length = 

For I =  To  Step 

Set myShape = CreatePolygon(CPoint, I, Length)

Length = Length + 

ActiveModelReference.AddElement myShape

Next I

End Sub

Dim CPoint As Point3d

Dim myEllipse As EllipseElement

Dim rotMatrix As Matrix3d

Dim inputQueue As CadInputQueue

Dim intputMessage As CadInputMessage

Set inputQueue = CadInputQueue

Set inputMessage = inputQueue.GetInput(msdCadInputTypeDataPoint, msdCadInputTypeAny)

Do

Select Case inputMessage.InputTyoe

Case msdCadInputTypeDatePoint

CPoint = inputMessage.Point

Set myEllipse = CreateEllipseElement2(Nothing, CPoint, 0.5, 0.5, rotMatrix)

ActiveModelReference.AddElement myEllipse

Exit Do

Case msdCadInputTypeReset

Exit Do

End Select

Loop

MicroStation VBA 可视化界面的更多相关文章

  1. MicroStation VBA 操作提示

    Sub TestShowCommand() ShowCommand "画条线" ShowPrompt "选择第一个点" ShowStatus "选择第 ...

  2. MicroStation VBA基础

    实习笔记1 2016年8月1日 14:12 Option Explicit 缺省情况下,如果使用一个没有声明的变量,它将继承“Variant”类型.在模块.窗体和类的通用声明区使用“OptionExp ...

  3. awt可视化界面上传数据到mysql,jsp通过jdbc方式查询数据库,并将结果打印在网页上

    今天尝试写一个小demo实现下之前看过的代码,目的了解不同文件的数据访问,掌握如何获取前台数据,如何将数据库的数据在前端页面展示. awt可视化界面可已实现提交数据到数据库,也可查询数据在控制台打印. ...

  4. GDB-Dashboard-GDB可视化界面

    项目地址 https://github.com/cyrus-and/gdb-dashboard 项目介绍 gdb-dashboard是一个gdb的可视化界面,可以通过web或者终端来现实可视化信息,支 ...

  5. Ubuntu mysql安装,还有可视化界面

    安装mysql sudo apt-get install mysql-server sudo apt-get install mysql-client sudo apt-get install lib ...

  6. Solr学习笔记---部署Solr到Tomcat上,可视化界面的介绍和使用,Solr的基本内容介绍,SolrJ的使用

    学习Solr前需要有Lucene的基础 Lucene的一些简单用法:https://www.cnblogs.com/dddyyy/p/9842760.html 1.部署Solr到Tomcat(Wind ...

  7. docker swarm 集群及可视化界面的安装及配置

    docker swarm 集群及可视化界面的安装及配置 2016-12-14 16:08:46 标签:swarm consul registrator 原创作品,允许转载,转载时请务必以超链接形式标明 ...

  8. 可视化界面:ElasticSearch Head,最方便的是直接下载谷歌浏览器扩展程序

    可视化界面:ElasticSearch Head,最方便的是直接下载谷歌浏览器扩展程序

  9. 关于Eclipse上使用可视化设计界面(Java EE 使用可视化界面设计)

    Eclipse下可视化界面实现——WindowBulider安装 第一步: WindowBuilder官方下载安装说明地址:http://www.eclipse.org/windowbuilder/d ...

随机推荐

  1. Socket开发框架之消息的回调处理

    在一般的Socket应用里面,很多时候数据的发送和接收是分开处理的,也就是我们发送一个消息,不知道这个请求消息什么时候得到应答消息,而且收到对应的应答消息的时候,如果操作界面的内容,也是需要特别处理的 ...

  2. Web API应用架构在Winform混合框架中的应用(3)--Winfrom界面调用WebAPI的过程分解

    最近一直在整合WebAPI.Winform界面.手机短信.微信公众号.企业号等功能,希望把它构建成一个大的应用平台,把我所有的产品线完美连接起来,同时也在探索.攻克更多的技术问题,并抽空写写博客,把相 ...

  3. Nancy FormsAuthentication使用

    1.新建UserDatabase类,实现IUserMapper接口 using System; using System.Collections.Generic; using System.Linq; ...

  4. [工具] GIF 动画每帧合并到一张 PNG

    功能:将 GIF 动画每帧合并到一张 PNG 需求:配合 ImageMagick 图像处理软件. 下载:[工具]Gif2Png_Aone_1.0.0.zip 使用方法: 请到 ImageMagick  ...

  5. 在VS 2012 配置SDL

    一.链接:http://pan.baidu.com/s/1kVaWteR 密码:zt81 下载两个文件夹.(如果不行就到 SDL官网 https://www.libsdl.org/ 和 SDL2_im ...

  6. Java一步一步构建web系统 在IDEA下用Maven搭建多模块项目

    1.需求 做一个项目会有很多模块,主要是方便复用,通过各个模块之间聚合.模块也可以独立出来,如公用类库,也可以在做其它项目中使用.该文的实例会有两个模块:分别为dallin-web模块,dallin- ...

  7. sql2000新建登陆用户错误“21002:[SQL-DMO] 用户***已经存在”的原因和解决方法【孤立用户解决方法】

    错误症状: 在SQL Server200中用附加数据库导入数据后,在新建登录时出现会出现错误21002:[SQL-DMO] 用户***已经存在.然后发现没建成的用户已经在登录列表里了.删除重建,问题依 ...

  8. Java继承中成员方法的overload(重载/过载)

    如果Java基础类有一个方法名被"过载"使用多次,在衍生类里对那个方法名的重新定义就不会隐藏任何基础类的版本.所以无论方法在这一级还是在一个基础类中定义,过载都会生效. publi ...

  9. java RSA加解密以及用途

    在公司当前版本的中间件通信框架中,为了防止非授权第三方和到期客户端的连接,我们通过AES和RSA两种方式的加解密策略进行认证.对于非对称RSA加解密,因为其性能耗费较大,一般仅用于认证连接,不会用于每 ...

  10. ASP.NET MVC Model绑定的简单应用

    Model绑定是 MVC 框架根据 HTTP 请求数据创建 .NET 对象的一个过程. 一.简单类型 1.单一值