明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1450|回复: 4

飞时达方格原地貌标高改至指定值

[复制链接]
发表于 2023-8-4 20:19:02 | 显示全部楼层 |阅读模式
在基坑侧壁回填土方计算中,如果有支护桩或者地连墙支护,而且冠梁顶面有平台和放坡情况的话,(即原地貌横断面存在垂直边坡的情况)飞时达原地貌就不能随便编辑了,另外开一张图算了再粘贴过来又麻烦,此lisp是在先不编辑垂直坡地原地貌的情况下先计算,然后再修改,再重新计算,懒得另外开图(前提是支护桩底原地貌是平面)

  1. ;; Set Attribute Values  -  Lee Mac 修改增强属性块属性
  2. ;; Sets attributes with tags found in the association list to their associated values.
  3. ;; blk - [vla] VLA Block Reference Object
  4. ;; lst - [lst] Association list of ((<tag> . <value>) ... )
  5. ;; Returns: nil

  6. (defun LM:vl-setattributevalues ( blk lst / itm )
  7.     (foreach att (vlax-invoke blk 'getattributes)
  8.         (if (setq itm (assoc (vla-get-tagstring att) lst))
  9.             (vla-put-textstring att (cdr itm))
  10.         )
  11.     )
  12. )

  13. ;(vla-get-tagstring (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'getattributes) )

  14. ; (vlax-invoke (vlax-ename->vla-object (car (entsel))) 'getattributes)
  15. ;; Get Attribute Values  -  Lee Mac 获取增强属性块属性
  16. ;; Returns an association list of attributes present in the supplied block.
  17. ;; blk - [vla] VLA Block Reference Object
  18. ;; Returns: [lst] Association list of ((<tag> . <value>) ... )

  19. (defun LM:vl-getattributevalues ( blk )
  20.     (mapcar '(lambda ( att ) (cons (vla-get-tagstring att) (vla-get-textstring att))) (vlax-invoke blk 'getattributes))
  21. )

  22. ;(setq lst '(("ZBG-BG" . "24444.85") ("SBG-BG" . "28888.81") ("SS-ZZ" . "8883.96") ("CDBG-BG" . "") ("SS-CD" . "") ("CD-ZZ" . "")))
  23. ;(LM:vl-setattributevalues (vlax-ename->vla-object (car (entsel))) lst )

  24. ;(cdr(assoc "ZBG-BG" '(("ZBG-BG" . "24.85") ("SBG-BG" . "28.81") ("SS-ZZ" . "3.96") ("CDBG-BG" . "") ("SS-CD" . "") ("CD-ZZ" . ""))))


  25. (defun c:fsdbg  (  / ybtc aa1 lst zbg sbg ss-zz lsta blk)
  26. (setq ybtc (vla-get-layer (vlax-ename->vla-object (car (entsel "\n请选择飞时达方格样本图元块:"))) ) )
  27.   (setq lsta (ssget "x" (list '(0 . "INSERT") (cons 8 ybtc )) ))
  28. (setq i 0)
  29. (setq aa1(getreal "\n请输入原地貌平面高程:"))
  30. (while  (< i (sslength lsta))
  31. (setq blk (ssname lsta i))
  32. (setq lst (LM:vl-getattributevalues (vlax-ename->vla-object blk)))
  33. (setq sbg (read(cdr(assoc "SBG-BG" lst))) )
  34.   (setq ss-zz (-  sbg aa1  ))
  35.   (setq lst (subst (cons "ZBG-BG"  (rtos aa1 2 3))  (assoc "ZBG-BG" lst) lst) )      
  36.   (setq lst (subst (cons "SS-ZZ"  (rtos ss-zz 2 3))  (assoc "SS-ZZ" lst) lst) )
  37. ;(setq zbg (read(cdr(assoc "ZBG-BG" lst))) )
  38. ;(setq ss-zz (read(cdr(assoc "SS-ZZ" lst))) )

  39. (LM:vl-setattributevalues  (vlax-ename->vla-object blk) lst )
  40.   (setq i (+ i 1))

  41.   )


  42. ;(vla-get-layer (vlax-ename->vla-object (car (entsel))) )


  43. (princ)
  44. )

本帖子中包含更多资源

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

x
 楼主| 发表于 2023-8-5 11:03:22 | 显示全部楼层
  1. ;(vlax-get-or-create-object "Ket.application")
  2. ;(vlax-get-or-create-object "Excel.application")
  3. ;;提取 CAD 属性
  4. (defun Get_Attrib (ed / o l)
  5. (setq o (vlax-Ename->vla-Object ed))
  6. (if (= (vla-Get-HasAttributes o) ':vlax-true)
  7.     (mapcar '(lambda(x)(setq l (vl-list* (vla-Get-TagString x)(vla-Get-TextString x) l)))
  8.         (vlax-safearray->list (vlax-variant-value (vla-GetAttributes o))))
  9. )l
  10. )
  11. ;————————————————
  12. ;版权声明:本文为CSDN博主「yxp_xa」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
  13. ;原文链接:https://blog.csdn.net/yxp_xa/article/details/72742260
  14. ;(Get_Attrib (car(entsel)))
  15. ;(Get_Attrib (car(entsel)))
  16. ;选择对象: ("CD-ZZ" "" "SS-CD" "" "CDBG-BG" "" "SS-ZZ" "10.99" "SBG-BG" "25.62" "ZBG-BG" "14.63")
 楼主| 发表于 2023-8-29 21:39:58 | 显示全部楼层
  1. (setq doc(vla-get-ActiveDocument(vlax-get-acad-object)))
  2. (setq bName (cdr(assoc 2 (entget (car(entsel))))))

  3. (setq b(vla-item (vla-get-Blocks doc) bName))

  4. (vla-AddAttribute b    1.5 8 "表示长度" (vlax-3D-point '(0 1 0)) "height" "777")
  5. ;(command "attsync" "n" bname)  (entget(car(nentsel)))
  6. (vla-AddAttribute b    1.5 8 "表示长度" (vlax-3D-point '(0 -1 0)) "height2" "666")
发表于 2024-8-18 17:34:39 | 显示全部楼层
很好→很棒!很好~很棒!!很好……很棒!!!
发表于 7 天前 | 显示全部楼层
看看下载试试
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-18 06:30 , Processed in 0.165361 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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