明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1279|回复: 1

[原创]仿Stretch命令的几何变形

[复制链接]
发表于 2008-6-21 13:23:00 | 显示全部楼层 |阅读模式
本帖最后由 作者 于 2008-6-21 13:35:56 编辑


在图示中有一四边形ABCD,如果用Stretch命令,可得AB''C'D
编程要求原线段是AB=10,当AB=20时,
AD和BC线段不变,四边形变形后几何形状如AB‘C’D
解决方法如下,首先将获取四边形的实体数据
"m1","m2","m3","m4","m5","m6","m7","m8","m9","m10","m11","m12"
"AcDbLine",2129989240,416.61467,431.12093,960.02511,614.21426,0
"AcDbLine",2129989264,960.02511,614.21426,785.28137,810.08154,0
"AcDbLine",2129989272,416.61467,431.12093,320.71871,859.04836,0
"AcDbLine",2129989280,320.71871,859.04836,785.28137,810.08154,0
获取数据的源程序如下。
  1.   Dim LineData As AcadLine, ArcData As AcadArc
  2.   Close #1
  3.   Open "D:\ls.txt" For Output As #1
  4.   
  5.   Write #1, "m1", "m2", "m3", "m4", "m5", "m6", "m7", "m8", "m9", "m10", "m11", "m12"
  6.   
  7.   Dim Ent As AcadEntity
  8.   
  9.   For Each Ent In ThisDrawing.ModelSpace
  10.     m1 = Ent.ObjectName
  11.     m2 = Ent.ObjectID
  12.     Select Case Ent.ObjectName
  13.       Case "AcDbLine"
  14.         Set LineData = Ent
  15.         With LineData
  16.           m3 = Round(.StartPoint(0), 5)
  17.           m4 = Round(.StartPoint(1), 5)
  18.           m5 = Round(.StartPoint(2), 5)
  19.           m6 = Round(.EndPoint(0), 5)
  20.           m7 = Round(.EndPoint(1), 5)
  21.           m8 = Round(.EndPoint(2), 5)
  22.          
  23.         End With
  24.     End Select
  25.     Write #1, m1, m2, m3, m4, m6, m7, m8
  26.    
  27.   Next Ent
  28.   Ent.GetBoundingBox
  29.   Close #1
以下再做各线段相交点判断程序设计。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2008-6-25 11:54:00 | 显示全部楼层
感谢楼主提供,谢谢,正用的着
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-26 09:53 , Processed in 0.163013 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表