srikanth_0126 Posted May 30 Posted May 30 (edited) Hi, This is my first after so many days using this site. my block have multiple attributes for different types of lengths and one(DUCT_ID) attribute for sequence. i want to link objects length to block attribute(its a field)(MICRODUCT) by using TAG(DUCT_ID). HOW IT WORKS. command to select the objects then ask for DUCT_ID. then link the selected objects to MICRODUCT. i'm using lee mac length2 field for now. but in this lisp you have to select the block manually. but blocks our drawing usually in different location initially for easy to work. thanks in advance. Edited May 30 by srikanth_0126 Quote
srikanth_0126 Posted June 18 Author Posted June 18 Yes still trying myself. But not working Please help. @BIGAL Quote
BIGAL Posted June 20 Posted June 20 Sorry for the delay please try this. ; https://www.cadtutor.net/forum/topic/86153-link-selected-object-data-to-block-attribute-by-selecting-objects/ ; select block touching plines and get length of pline ; insert block with field attribute : By AlanH June 20204 (defun c:blkpl ( / ss x obj ins pt1 pt2 pt3 ss2 obj2 str2) (prompt "Select blocks touching plines" ) (setq ss (ssget '((0 . "INSERT")(2 . "AAAA")))) (if (= ss nil) (progn (alert "You have not selected block AAAA will exit now")(EXit)) ) (setvar 'attreq 0) (repeat (setq x (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1))))) (setq ins (vlax-get obj 'Insertionpoint)) (setq atts (vlax-invoke obj 'Getattributes)) (setq attstr (vlax-get (nth 0 atts) 'Textstring)) (setq pt1 (mapcar '+ ins (list -5.0 -5.0 0.0))) (setq pt2 (mapcar '+ ins (list 5.0 -5.0 0.0))) (setq pt3 (mapcar '+ ins (list 5.0 5.0 0.0))) (setq pt4 (mapcar '+ ins (list -5.0 5.0 0.0))) (setq pts (list pt1 pt2 pt3 pt4 pt1)) (setq ss2 (ssget "F" pts '((0 . "LWPOLYLINE")))) (setq obj2 (vlax-ename->vla-object (ssname ss2 0))) (setq str (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-Objectid obj2)) ">%).Length \\f \"%lu6\">%") ) (command "-insert" "duct_callout" "S" 1 (getpoint "\npick a point for block ") 0) (setq obj (vlax-ename->vla-object (entlast))) (setq atts (vlax-invoke obj 'Getattributes)) (vla-put-textstring (nth 0 atts) attstr) (vla-put-textstring (nth 1 atts) str) ) (setvar 'attreq 1) (princ) ) (c:blkpl) 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.