Dungnguyen Posted October 15, 2020 Posted October 15, 2020 Chào tất cả các bạn! Mình đến từ Việt Nam. Sau thời gian tìm hiểu về Lisp những vẫn dốt nên mạo mụi lên đây xin nhờ sự giúp đỡ mọi người. Hiện tại mình đang viết lisp xuất chiều dài thanh Pline ra Block ATT nhưng không biết cách nào dùng function Field của Lee Mac để link vào chiều dài. Ví dụ: Chiều dài tường: 123456m ====> 123456 mình muốn link field vào. Mong được sự giúp đỡ của các bạn! TT.lsp BLOCK.dwg Quote
BIGAL Posted October 15, 2020 Posted October 15, 2020 Use google translate Hello all of you! I'm from Vietnam. After learning about Lisp, she was still ignorant, so she came up here asking for help. Currently I am writing lisp export length Pline bar to Block ATT but do not know how to use Function Field of Lee Mac to link to the length. Example: Wall length: 123456m ====> 123456 I want to link field to. Looking forward to your help! Try this (defun c:lens (/ ent obj atlength pt atts att obj2) (while (setq ent (entsel "\nPick object")) (setq obj (vlax-ename->vla-object (car ent))) (setq atlength nil) (if (vlax-property-available-p obj "Circumference") (setq atlength (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-Objectid obj)) ">%).Circumference \\f \"" "%lu2%pr3" "\">%")) ) (if (vlax-property-available-p obj "Length") (setq atlength (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-Objectid obj)) ">%).Length \\f \"" "%lu2%pr3" "\">%")) ) (if (= atlength nil) (alert "object not supported for length") (progn (setq pt (getpoint "\nPick insert point")) (command "-insert" "Block" pt 1 1 0 "" "") (setq obj2 (vlax-ename->vla-object (entlast))) (setq atts (vlax-invoke obj2 'getattributes)) (foreach att atts (if (= (vla-get-tagstring att) "L") (vla-put-textstring att atlength) ) (command "regen") ) ) ) ) (princ) ) 1 Quote
Dungnguyen Posted October 16, 2020 Author Posted October 16, 2020 27 minutes ago, BIGAL said: Use google translate Hello all of you! I'm from Vietnam. After learning about Lisp, she was still ignorant, so she came up here asking for help. Currently I am writing lisp export length Pline bar to Block ATT but do not know how to use Function Field of Lee Mac to link to the length. Example: Wall length: 123456m ====> 123456 I want to link field to. Looking forward to your help! Try this (defun c:lens (/ ent obj atlength pt atts att obj2) (while (setq ent (entsel "\nPick object")) (setq obj (vlax-ename->vla-object (car ent))) (setq atlength nil) (if (vlax-property-available-p obj "Circumference") (setq atlength (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-Objectid obj)) ">%).Circumference \\f \"" "%lu2%pr3" "\">%")) ) (if (vlax-property-available-p obj "Length") (setq atlength (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-Objectid obj)) ">%).Length \\f \"" "%lu2%pr3" "\">%")) ) (if (= atlength nil) (alert "object not supported for length") (progn (setq pt (getpoint "\nPick insert point")) (command "-insert" "Block" pt 1 1 0 "" "") (setq obj2 (vlax-ename->vla-object (entlast))) (setq atts (vlax-invoke obj2 'getattributes)) (foreach att atts (if (= (vla-get-tagstring att) "L") (vla-put-textstring att atlength) ) (command "regen") ) ) ) ) (princ) ) Không được bạn ơi! bạn có thể xem lisp mình gửi lên được không? 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.