明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
楼主: 树櫴希德

收藏73哥函数 程序---列出文件夹下所有子文件荚或者文件名

[复制链接]
发表于 2021-3-5 16:21 | 显示全部楼层
感谢楼主的分享
发表于 2021-3-24 17:28 | 显示全部楼层
谢谢,已收藏
 楼主| 发表于 2021-4-28 17:02 | 显示全部楼层
  1. (defun StrType(a / b c d e);;字符串分离全角、符号、字母、数字,存在问题:连续小数点与数字相连不能精确分离数字和小数点
  2.     (setq b(vl-string->list a))
  3.     (while b
  4.       (setq a(car b)b(cdr b)c(last d))
  5.       (if(or(not d)
  6.       (and(< 0 a 32)(< 0 c 32));;非打印字符
  7.       (or(= 46 a)(= 46 c)(and(< 47 a 58)(< 47 c 58)));数字和小数点
  8.       (vl-every'(lambda(x)(vl-some'(lambda(y)(<(car y)x(cadr y)))'((31 48)(57 65)(90 98)(122 129))))(list a c));其它字符包括小数点
  9.       (vl-every'(lambda(x)(vl-some'(lambda(y)(<(car y)x(cadr y)))'((64 91)(96 123))))(list a c));;字母
  10.       (and(> a 128)(> c 128)));;全角字符
  11.   (if(> a 128)(setq d(vl-list*(car b)a d)b(cdr b))(setq d(cons a d)))
  12.   (setq e(cons(reverse d)e)d(if(> a 128)(list(car b)a)(List a))b(if(> a 128)(cdr b)b))))
  13.     (mapcar'vl-list->string(reverse(cons(reverse d)e))))

发表于 2021-8-26 08:34 | 显示全部楼层
感谢大神分享
 楼主| 发表于 2022-6-14 22:58 | 显示全部楼层

收藏广州SCS数据转南方CASS  DAT  EXCEL VBA  

  1. Sub 转换()
  2. Dim numcol As Integer
  3. Dim numrow As Long
  4. Dim i As Long
  5. Dim x As Integer
  6. Dim numperrow As Integer
  7. numperrow = InputBox("请输入每行要填的数据行的数目:")

  8. Dim myRange As Range
  9. Set myRange = Application.InputBox("选择区域", Type:=8)

  10. myRange.Name = "数据"


  11. Range("数据").Select
  12. numrow = Selection.Rows.Count '数据区的行数
  13. numcol = Selection.Columns.Count '数据区的列数
  14. x = numperrow * numcol


  15. Range("a1").Select
  16. For i = 1 To numrow '以数据的每一行为单位进行剪切
  17. Range("数据").Rows(i).Cut
  18. ActiveSheet.Paste
  19. Selection.Offset(, numcol).Select
  20. If (i Mod numperrow) Then '判断是否要换行
  21. Else: Selection.Offset(1, -x).Select
  22. End If
  23. Next i
  24. End Sub

 楼主| 发表于 2022-6-17 11:26 | 显示全部楼层
本帖最后由 树櫴希德 于 2022-6-17 11:32 编辑

  1. (defun chains(es fuz / e a b s pts);;链式选择,选择首尾相连的线
  2. (setq s(ssadd))
  3.    (while es
  4.     (setq e(car es)es(cdr es)
  5.     p1(mapcar'+'(0 0)(vlax-curve-getStartPoint e))p2(mapcar'+'(0 0)(vlax-curve-getendPoint e)))
  6.     (foreach a(S2E(ssget"CP"(list p1(list(car p1)(cadr p2))p2(list(car p2)(cadr p1)))'((0 . "arc,*spline,*polyline,line"))))
  7.       (or(SSMEMB a s)
  8.    ((lambda()
  9.       (setq p1(mapcar'+'(0 0)(vlax-curve-getStartPoint a))
  10.       p2(mapcar'+'(0 0)(vlax-curve-getendPoint a)))
  11.       (and(vl-some'(lambda(x)(or(equal p1 x fuz)(equal p2 x fuz)))pt)
  12.     (setq es(cons a es)pt(vl-list* p1 p2 pt))
  13.     (ssadd a s)))))))
  14.   (sssetfirst'nil s)
  15.   )
 楼主| 发表于 2022-6-17 11:34 | 显示全部楼层
  1. (defun chains(es fuz / e a b s pts)
  2. (setq s(ssadd))
  3.   (while es
  4.     (setq e(car es)es(cdr es)
  5.           p1(mapcar'+'(0 0)(vlax-curve-getStartPoint e))p2(mapcar'+'(0 0)(vlax-curve-getendPoint e)))
  6.     (foreach a(S2E(ssget"CP"(list p1(list(car p1)(cadr p2))p2(list(car p2)(cadr p1)))'((0 . "arc,*spline,*polyline,line"))))
  7.       (or(SSMEMB a s)
  8.          ((lambda()
  9.             (setq p1(mapcar'+'(0 0)(vlax-curve-getStartPoint a))
  10.                   p2(mapcar'+'(0 0)(vlax-curve-getendPoint a)))
  11.             (and(vl-some'(lambda(x)(or(equal p1 x fuz)(equal p2 x fuz)))pt)
  12.                 (setq es(cons a es)pt(vl-list* p1 p2 pt))
  13.                 (ssadd a s)))))))
  14.   (sssetfirst'nil s))
 楼主| 发表于 2022-6-18 17:31 | 显示全部楼层
树櫴希德 发表于 2022-6-14 22:58
收藏广州SCS数据转南方CASS  DAT  EXCEL VBA

  1. Public Sub 表格加1()
  2. Dim myRange As Range

  3. Set myRange = Application.InputBox("选择区域", Type:=8)

  4. For Each x In myRange

  5. x.Formula = x + 1

  6. Next x

  7. End Sub
 楼主| 发表于 2022-6-19 15:35 | 显示全部楼层


EXCEL 表格根据内容转置  但是效果不好
  1. Public Sub mm()
  2. Dim numcol As Integer
  3. Dim numrow As Long
  4. 'Dim mypos As Integer
  5. Dim i As Long

  6. Dim myRange As Range
  7. Set myRange = Application.InputBox("选择区域", Type:=8)

  8. myRange.Name = "数据"


  9. Range("数据").Select
  10. numrow = Selection.Rows.Count '数据区的行数
  11. numcol = Selection.Columns.Count '数据区的列数

  12. Range("a1").Select

  13.   
  14.   
  15.   For Each Rng In myRange
  16.   Rng.Cut
  17. ActiveSheet.Paste

  18. Selection.Offset(, numcol).Select



  19. If (InStr(Rng, "begin") = 0) Then    '判断是否要换行   Cells(Rng + 1, 0).Select
  20.     Else: Selection.Offset(1, -1 * Rng.Column).Select
  21. End If




  22. Next Rng
  23.   

  24. End Sub

发表于 2022-6-21 08:39 | 显示全部楼层
VBA? 发贴楼主应该把自己的经典或者优化别人的分享出来。
发帖用别人的可不太好!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-6 01:43 , Processed in 0.328126 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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