三维建模VB程序Word文档格式.docx

上传人:b****7 文档编号:21883204 上传时间:2023-02-01 格式:DOCX 页数:13 大小:446.60KB
下载 相关 举报
三维建模VB程序Word文档格式.docx_第1页
第1页 / 共13页
三维建模VB程序Word文档格式.docx_第2页
第2页 / 共13页
三维建模VB程序Word文档格式.docx_第3页
第3页 / 共13页
三维建模VB程序Word文档格式.docx_第4页
第4页 / 共13页
三维建模VB程序Word文档格式.docx_第5页
第5页 / 共13页
点击查看更多>>
下载资源
资源描述

三维建模VB程序Word文档格式.docx

《三维建模VB程序Word文档格式.docx》由会员分享,可在线阅读,更多相关《三维建模VB程序Word文档格式.docx(13页珍藏版)》请在冰豆网上搜索。

三维建模VB程序Word文档格式.docx

PublicobjEXPAsNewClsFunExp’公式对象

PublicsngS(359)AsSingle’距离

PublicsngV(359)AsSingle’速度

PublicsngA(359)AsSingle’加速度

PublicsngPreDat()AsSingle’批量计算得到的结果

PublicsngXY()AsSingle’坐标

PublicsngPoint()AsSingle’离散点

PublicSubInit()’初始化,数组及公式

ErasesngS

ErasesngV

ErasesngA

ReDimsngXY(359,l)’默认为360个点

ReDimstrStruFunc(3,l)’机构形式公式

’偏置尖顶直动从动件

strstruFunc(0,0)=”e*Cos(i*pi/180)+(Sqr(r*r-e*e)+s)*Sin(i*pi/180)”

strstruFunc(0,1)=”-e*Sin(i*pi/180)+(Sqr(r*r-e*e)+s)*Cos(i*pi/180)”

’偏置滚子直动从动件

’对心平底直动从动件

’摆动滚子从动件对心平底直动从动件

’摆动滚子从动件

EndSub

’升程等速运动规律

PublicFuncttionNomal_UP_EQ(ByValwAsSingle,ByValhAsSingle,ByVali0AsSingle)AsBoolean

DimiAsInteger

t=Int(i0)

OnErrorResumeNext

Fori=0Tot

sngS(i)=i*h/10

sngV(i)=w*h/10

sngA(i)=0

IfErrThen

sngS(i)=0

sngV(i)=0

EndIf

Next

IfErrThen

Nomal_UP_EQ=False

Else

Normal_UP_EQ=True

EndIf

EndFunction

’升程等加速等减速运动规律

’升程余弦加速运动规律

’升程正弦加速运动规律

’远休程

PublicFunctionFar_NoMove(ByValhAsSingle,ByVali0AsSingle,ByVali1AsSingle)AsBoolean

DimtAsInteger

t=Int(i0+i1)

Fori=Int(i0)Tot

sngS(i)=h

’回程等速运动规律

’回程等加速等减速运动规律

’回程余弦加速运动规律

’回程正弦加速运动规律

’近休程

PublicFunctionNear_NoMove(ByValhAsSingle,ByVali0AsSingle,ByVali1

AsSingle,ByVali2AsSingle)AsBoolean

DimIAsInteger

t=Int(i0+i1+i2)’-l

Fori=tTo359

Near_NoMove=False

Near_NoMove=True

’公式化输入升程

PublicFunctionCustom_Up(ByValstrFuncAsString,ByValwAsSingle,

ByValhAsSingle,ByVali0AsSingle)AsBoolean

DimobjTExpAsNewClsFunExp

=strFunc

IfNotThen

Custom_Up=False

ExitFunction

DimstrKeyAsString’检查变量是否正确

strKey=”i,h,i0”

If<

>

3Then

”h”,h

”10”,i0

DimtAsInteger

onErrorResumeNext

Fori=0Tot

”i”,i

sngS(i)=(0)

Custom_Up=True

’公式化输入回程

’只允许输入数字,使用时放在keypress事件中AndInStr,”.”)=0Then

iValue=0

EndIf

EndIf

FilterNumber=iValue

’将所有数据显示到列表中

PublicFunctionLvAddLine(ByRefobjListAsListView,ByValintIAsInteger,ByValSAsSingle,ByValvAsSingle,ByValAAsSingle,ByValXAsSingle,ByValYAsSingle)AsBoolean

DimiAsInteger

DimobjItemAsListItem

i=OnErrorResumeNext

SetobjItem=&

i,CStr(intI))

(1)=CStr(S)

(2)=CStr(v)

(3)=CStr(A)

(4)=CStr(X)

(5)=CStr(Y)

LvAddLine=False

LvAddLine=True

EndFunction

’添加离散点到ListView列表中

PublicFunctionPointList_Add(ByRefobjListAsListView,ByValsngXAsSingle,ByValsngSAsSingle)AsBoolean

DimiCountAsInteger

’判断数据不重复,重复则修改原数据

Fori=1ToIf(i).Text=CStr(sngX)Then

(i).SubItems

(1)=CStr(sngS)

PointList_Add=True

’在这里要寻找合适的点

I=objItem=&

i,CStr(sngX))

(1)=CStr(sngS)

PointList_Add=Fa1se

Eise

PointList_Add=True

’读离散点数据到数组

PublicFunctionPointList2Arr(ByRefobjUpListAsListView,objDownListAs

ListView)AsBoolean

DimiCountUpAsInteger

DimiCountDownAsInteger

DimintXAsInteger

’读取数据

ErasesngPoint()

iCountUP=IfiCountUp+iCountDown=0then

PointList2Arr=False

’定义大小,加上远休和近休

ReDimsngPoint(iCountUp+CountDown+i1+i3-l,l)

’添加升程数据

intX=0

Fori=1ToiCountUp

sngPoint(i-1,0)=CSng((i).Text)

sngPoint(i-1,1)=CSng((i).SubItems

(1))/1000

’远休

intX=iCountUp

Fori=Toi1-1

sngPoint(i+iCountUp,0)=i+i0

sngPoint(i+iCountUp,I)=h

’添加回程数据

Fori=1ToiCountDown

sngPoint(i+iCountUp+i1-1,0)=CSng(i).Text)+i0+i1

sngPoint(i+iCountUp+i1-1,1)=CSng(i)=Subltems

(1))/1000

Next

’近休数据

Fori=0Toi3-1

sngPoint(i+iCountUp+i1+iCountDown,0)=I+i0+i1+i2

sngPoint(i+iCountUp+i1+iCountDown,1)=0

PointList2Arr=False

PointList2Arr=True

EndIf

’机构形式公式计算

PublicFunctionStructComputer(ByValintStruAsInteger)AsBoolean

DimiAsInteger

DimobjFuncXAsClsFunExp

DimobjFuncYAsClsFunExp

DimintPointCountAsInteger’离散点个数

’根据选择创建坐标

SelectCaseintCreate

Case0,2’公式计算,360个点

ReDimsngXY(359,1)

Casel’离散点

intPointCount=UBound(sngPoint)

’离散点数据出错

StructComPuter=False

ReDimsngXY(intPointCount,1)

EndSelect

’套用X坐标公式进行计算

SetobjFuncX=NewClsFunExp

=strStruFunc(intStru,0)

’解析数据

IfNotThen

’套用Y坐标公式进行计算

SetobjFuncY=NewClsFunExp

=strStruFunc(intStru,1)

’解析

’代入各机构机构模型所需的参数

”e”,e

”r”,r

~~~~~~

~~~~~

DimuAsSingle

DimuuAsSingle

SelectCaseintCreate’计算值

Case0,2’常用规律和公式

Fori=0To359’计算

”v”,sngV(i)

”s”,sngS(i)

”a”,sngA(i)

sngXY(i,0)=(CSng(i),”i”)

sngXY(i,1)=(CSng(i),”I”)

Casel’离散点输入

Fori=0TointPointCount

”I”,sngPoint(i,0)

”s”,sngPoint(i,1)

sngXY(i,0)=(0)

”i”,sngPoint(i,0)

”s”,sngPoint(i,l)

sngXY(i,l)=(0)

EndSelect

StructComputer=False

StructComPuter=True

’根据生成的sngxY()坐标,输出到SW系统中

’传递的参数必须是XY(n,l)二维数组

PublicFunctionModelOut(iXY()AsSingle)AsBoolean

DimiCount

DimswAppAsObject

DimPartAsObject

DimSelMgrAsObject

DimboolstatusAsBoolean

DimlongstatusAsLong,longwarningsAsLong

DimFeatureAsObject

DimAnnotationAsObject

IfUBound(iXY,2)<

1Then’判断数据大小是否正确

ModelOut=False

iCount=UBound(iXY,l)’计算点的个数

SetswApp=’创建Sw对象

MsgBox”无法创建Sldworks对象!

”,vbOKOnly+vbInformation

ModelOut=False

=True

SetPart=(“D:

\Solidworks2006\lang\chinese-simplified

\Tutorial\”,0,0#,0#)

IfErrThen

MsgBox”无法打开Part文档!

”,vbOKOnly+vbInformation

boolstatus=前视”,”PLANE”,0,0,0,Fa1se,0,Nothing,0)

0,0,0,r0,0’画基圆

Fori=0ToiCount’把点云转化为曲线

PartSketchSplineiCount+1-I,iXY(I,0),iXY(i,1),0

Nexti

0,iXY(0,0),iXY(0,1),0

True

Boolstatus=样条曲线1@草图1”,

“EXTSKETCHSEGMENT”,0,0,0,False,0,Nothing,0)

“*上下二等角轴测”,s

Boolstatus=样条曲线l@草图1”,

True,False,False,6,0,d,,

False,False,False,False,0,0,False,False,False,False,l,1,1,0,0,False

ModelOut=True

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 农学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1