Jakub Posted April 19, 2016 Posted April 19, 2016 Hi, Does exist a lisp that read a text label of point and paste it as attribute? For example: I have a point in CAD that has a text label describing Z coordinate. I need a lisp that read this height and paste into "Z" row in geometry. Then it transforms point from 2D to 3D. Where can I find this type of lisp? Thank you for helping me in advance. Quote
satishrajdev Posted April 20, 2016 Posted April 20, 2016 (edited) try this :- For Text :- (defun c:test (/ a b c d i) (if (setq a (ssget '((0 . "text")))) (repeat (setq i (sslength a)) (setq b (entget (ssname a (setq i (1- i))))) (setq c (cdr (assoc 10 b))) (setq d (subst (atof (cdr (assoc 1 b))) (caddr c) c)) (entmod (subst (cons 10 d) (assoc 10 b) b)) ) ) (princ) ) For Block.... Change the Attribute Tag "A" as per your block tag :- (defun c:test (/ a b c d i) (if (setq a (ssget '((0 . "insert")))) (repeat (setq i (sslength a)) (setq b (vlax-ename->vla-object (ssname a (setq i (1- i))))) (setq c (vlax-get b 'InsertionPoint)) (setq d (vl-some '(lambda (x) (if (eq (vla-get-tagstring x) "A") ; Change tag here (atof (vla-get-textstring x)) ) ) (vlax-invoke b 'GetAttributes) ) ) (vla-put-insertionpoint b (vlax-3d-point (subst d (caddr c) c)) ) ) ) (princ) ) Edited April 21, 2016 by satishrajdev Quote
CAD89 Posted April 21, 2016 Posted April 21, 2016 @Jakub - As far as I see in the properties palette, it says that you have nothing selected ... so with that in mind AutoCAD shows you the elevation of the cursor which in 2D view the default elevation of the cursor (or crosshairs whichever you prefer) will always be 0. In order for us to be able to offer you any help you must upload a sample file so we can see exactly what you are dealing with. @satishrajdev - I think that Jakub wants to elevate the block that represents the point and not only the text that is attached to it! Nice code btw. Best regards, CAD_89 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.