乐筑天下

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

[编程交流] Can't Select an object fr

[复制链接]

7

主题

18

帖子

11

银币

初来乍到

Rank: 1

铜币
35
发表于 2022-7-6 21:05:11 | 显示全部楼层 |阅读模式
        Hi there,
        I find the code that can help me to select an object from Model Space but it gives me an error I tried to solve it but I failed can you please help me.

        Kindly find the attached pictures to be more clear.
        Code:
        Private Sub CommandButton1_Click()
        Dim CADObject As AcadLWPolyline
        Dim i As Integer
        Dim x As Double, y As Double
        Open "D:\ExtractCoordinatesOfALWPolylineLWPolylineCordinates.txt" For Output As #1
        Dim basePnt As Variant
        ThisDrawing.Utility.GetEntity CADObject, basePnt, "Select a Light Weight Polyline"""
        Dim Cords As Variant
        Cords = CADObject.Coordinates
        For i = LBound(Cords) To UBound(Cords) Step 2
        x = Format(CADObject.Coordinates(i), "0.000")
        y = Format(CADObject.Coordinates(i + 1), "0.000")
        Print #1, x; y
        Next i
        Dim length As Double
        length = Format(CADObject.length, "0.000")
        Print #1, vbCrLf; "Length; of; the; Selected; LW; polyline Is "; length
        Print #1, vbCrLf; "Number; of; Vertices; of; the; Selected; polyline Is "; (UBound(Cords) + 1) / 2
        Close (1)
        End Sub

         
         
         
         
        220515vvd1p8v310t3td36.jpg
        220517zbsysxh3lils3h60.jpg
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 22:34:49 | 显示全部楼层
 
        Maybe look carefully at this line what is extra ?
         
        ThisDrawing.Utility.GetEntity CADObject, basePnt, "Select a Light Weight Polyline"""
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 14:33 , Processed in 0.563277 second(s), 59 queries .

© 2020-2025 乐筑天下

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