辅助设计学习笔记

辅助设计学习笔记

ID:63513038

大小:65.54 KB

页数:2页

时间:2021-08-25

辅助设计学习笔记_第1页
辅助设计学习笔记_第2页
资源描述:

《辅助设计学习笔记》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、学习好资料欢迎下载添加第一个类AddTextPublicFunctionAddText(ByValtextStringAsString,ByValinsertStringAsVariant,ByValheightAsDouble)AsAcadTextDebug.Assert(VarType(insertPoint)=vbArray+vbDouble)Debug.Assert(UBound(insertPoint)=2)SetAddText=ThisDrawing.ModelSpace.AddText(insertPoin

2、t,Width,textString)EndFunction添加第二个类AddMTextPublicFunctionAddMText(ByValinsertPointAsVariant,ByValWidthAsDouble,ByValtextStringAsString)AsAcadMTextDebug.Assert(VarType(insertPoint)=vbArray+vbDouble)Debug.Assert(UBound(insertPoint)=2)SetAddMText=ThisDrawing.ModelS

3、pace.AddMText(insertPoint,Width,textString)EndFunction添加第三个类AddTextInRectanglePublicFunctionAddTextInRectangle(ByValpoint1AsVariant,ByValpoint2AsVariant,ByValtextStringAsString,OptionalratioAsDouble=0.7)AsAcadTextDebug.Assert(VarType(point1)=vbArray+vbDouble)Debu

4、g.Assert(UBound(point1)=2)Debug.Assert(VarType(point2)=vbArray+vbDouble)Debug.Assert(UBound(point2)=2)’计算矩形的宽、高和中心点DimrectHeightAsDouble,rectWidthAsDouble,centerPointAsVariantrectHeight=Abs(point1(1)-point2(1))rectWidth=Abs(point1(0)-point2(0))centerPoint=Math.Ge

5、tMiddlePointBetween2Point(point1,point2)‘创建文字,计算其高宽比DimtextAsAcadTextSettext=AddText(textString,centerPoint,rectHeight)DimminPointAsVariant,maxPointAsVarianttext.GetBoundingBoxminPoint,maxPointDimtextHeightAsDouble,TextWidthAsDoubletextHeight=Abs(minPoint(1)-maxP

6、oint⑴)TextWidth=Abs(minPoint(0)-maxPoint(0))学习好资料欢迎下载’根据矩形的宽、高和文字的容纳比例确定文字的高或宽DimheightRatioAsDoubleheightRatio=textHeight/TextWidthIf(heightRatio>rectHeight/rectWidth)ThentextHeight=rectHeight*ratioElseTextWidth=rectWidth*ratiotextHeight=TextWidth*heightRatioEnd

7、If'缩放和移动文字text.Alignment=acAlignmentBottomCentertext.AlignmentPoint=centerPointtext.height=textHeightSetAddTextInRectangle=textEndFunction主函数程序:PublicSubCreateText()Dimpoint1(0To2)AsDouble,point2(0To2)AsDoubleSetPoint3dpointl,0,0,0SetPoint3dpoint2,20,5,0DimmSpace

8、AsNewclsModelSpacemSpace.AddTextInRectanglepointl,point2,"cadhelp"mSpace.AddRectanglepointl,point2EndSub

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。