乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
楼主: comcu

[编程交流] 创建多行

[复制链接]

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 18:21:31 | 显示全部楼层
Here is an example what you looking for
I don't like to use command line for entering
values, so I used InputBox instead:
 
  1. Sub DrawFrameTest()Dim strMStyle As StringDim structWid As DoubleDim frameWid As DoubleDim structHgt As DoubleDim frameHgt As DoubleDim beamWid As DoubleDim hnum As IntegerDim vnum As IntegerDim varpt As VariantDim hstep As DoubleDim vstep As DoubleDim pts(5) As DoubleDim movept(2) As DoubleDim oMLine As AcadMLineDim cMline As AcadMLineDim cnt As IntegerstrMStyle = "STANDARD"structWid = CDbl(InputBox("Structural Opening Width:", "Structural Width", "7733.0"))frameWid = CDbl(InputBox("Frame Width:", "Frame Width", "7712.0"))structHgt = CDbl(InputBox("Structural Opening Height:", "Structural Height", "2986.0"))frameHgt = CDbl(InputBox("Frame Height:", "Frame Height", "2966.0"))beamWid = CDbl(InputBox("Beam Width:", "Beam Width", "50.0"))ThisDrawing.SetVariable "CMLJUST", 1ThisDrawing.SetVariable "CMLSTYLE", strMStylehnum = CInt(InputBox("Number Of Horizontal Beams:", "Horizontal Beams", "4"))vnum = CInt(InputBox("Number Of Vertical Beams:", "Vertical Beams", "4"))varpt = ThisDrawing.Utility.GetPoint(, vbCr & "Pick lower left point of construction:")ThisDrawing.Regen acActiveViewport'calculationshstep = (frameWid - (beamWid * vnum)) / (vnum - 1)vstep = (frameHgt - (beamWid * hnum)) / (hnum - 1)pts(0) = varpt(0) - beamWid: pts(1) = varpt(1) + beamWid / 2: pts(2) = 0#pts(3) = pts(0) + frameWid: pts(4) = pts(1): pts(5) = 0#'horizontal beamsSet oMLine = ThisDrawing.ModelSpace.AddMLine(pts)oMLine.MLineScale = beamWidoMLine.UpdateDo While cnt < hnum - 1Set cMline = oMLine.CopycMline.MLineScale = beamWidcMline.Updatemovept(0) = varpt(0)movept(1) = varpt(1) + (cnt + 1) * (vstep + beamWid)movept(2) = 0#cMline.Move varpt, moveptcnt = cnt + 1Loop'vertical beamscnt = 0pts(0) = varpt(0) - beamWid / 2: pts(1) = varpt(1): pts(2) = 0#pts(3) = pts(0): pts(4) = pts(1) + frameHgt: pts(5) = 0#Set oMLine = ThisDrawing.ModelSpace.AddMLine(pts)oMLine.MLineScale = beamWidoMLine.Updatehstep = (frameWid - (beamWid * vnum)) / (vnum - 1)vstep = (frameHgt - (beamWid * hnum)) / (hnum - 1)Do While cnt < vnum - 1Set cMline = oMLine.CopycMline.MLineScale = beamWidcMline.Updatemovept(0) = varpt(0) + (cnt + 1) * (hstep + beamWid)movept(1) = varpt(1)movept(2) = 0#cMline.Move varpt, moveptcnt = cnt + 1LoopEnd Sub
 
~'J'~
回复

使用道具 举报

34

主题

105

帖子

91

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
224
发表于 2022-7-6 18:23:20 | 显示全部楼层
Fixo,
 
thank you. it worked really well.
 
I will try to develop it further.
 
Many thanks,
 
Col
回复

使用道具 举报

1

主题

1069

帖子

1050

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
69
发表于 2022-7-6 18:30:57 | 显示全部楼层
You're welcome
Cheers
 
~'J'~
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 16:35 , Processed in 1.799326 second(s), 56 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表