前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >microstation vba起步——建立实体

microstation vba起步——建立实体

作者头像
hotqin888
发布2018-09-11 14:39:42
6250
发布2018-09-11 14:39:42
举报
文章被收录于专栏:hotqin888的专栏hotqin888的专栏

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://cloud.tencent.com/developer/article/1334335

 有人问ms中用vba如何建立一个实体。很简单的一个问题,对照vba.chm,找到method里的

CreateCylinder Method

Generate a Cylinder at origin with SmartSolidElement Type. 

Syntax

Set SmartSolidElement = object.CreateCylinder (Template, radius, height) 

The CreateCylinder method syntax has these parts:

Part Description 

object A valid object. 

radius A Double expression. radius of base plan.  

height A Double expression. height of the cylinder.  

Template An Element expression.  

Version

08.11.09

在ms的vba编辑器中写入

Sub Macro2()
Dim myshape1 As SmartSolidElement
Set myshape1 = SmartSolid.CreateCone(Nothing, 10, 5, 10)
ActiveModelReference.AddElement myshape1
myshape1.Rewrite
End Sub

运行就得到实体了。很简单,可是我找了一个上午。MicroStation_VBA_中文教程中丝毫没有提到如何建立实体。都是建立线、面……vba.chm中根本没有建立实体的代码例子。网络上根本搜不到。根据chm里的方法描述,起先代码是这样的

Sub Macro2()
Dim myshape1 As SmartSolidElement
Set myshape1 = CreateCone(Nothing, 10, 5, 10)
ActiveModelReference.AddElement myshape1
myshape1.Rewrite
End Sub

根本通不过。因为参考CreateShapeElement1这个方法如下,它的前面没有object啊。

Sub Macro2()
Dim myshape As ShapeElement
Dim shapepoints4(0 To 3) As Point3d
shapepoints4(0).x = 5
shapepoints4(0).y = 5
shapepoints4(1).x = 10
shapepoints4(1).y = 5
shapepoints4(2).x = 10
shapepoints4(2).y = 10
shapepoints4(3).x = 5
shapepoints4(3).y = 10
Set myshape = CreateShapeElement1(Nothing, shapepoints4, msdFillModeFilled)
myshape.FillColor = RGB(250, 250, 250)
ActiveModelReference.AddElement myshape
myshape.Rewrite
End Sub

 最后终于在ms的example文件夹下找到了一个例题SmartSolid.mvba,恍然大悟。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016年07月09日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档