PabloS Posted June 11 Share Posted June 11 Hi everyone, I hope you’re all doing well. I’m looking for some help with creating an AutoLISP program. Specifically, I need a script that can reset the text position of multiple selected dimension lines, processing them one at a time. This would greatly streamline my workflow, and I’d really appreciate any guidance or sample code you could provide. When doing this manually: Dimension that was edited returns to original design: Here is an approach but I still can't get the right command: (defun c:DimReset ( / sel ) (if (ssget "_:L" '((0 . "*DIMENSION"))) (progn (vlax-for obj (setq sel (vla-get-activeselectionset (vla-get-activedocument (vlax-get-acad-object)))) (vla-put-verticaltextposition obj acVertCentered); ¿¿IS THERE ANY VLA FUNCTION THAT RESET TEXT POSITION ?? ) (vla-delete sel) ) ) (princ) ) (vl-load-com) (princ) Thank you in advance for your help! Best regards, Pablo Quote Link to comment Share on other sites More sharing options...
Kvlar Posted June 11 Share Posted June 11 No need to use autolisp code. You can try this : Select dimension - DIMEDIT - Home . Quote Link to comment Share on other sites More sharing options...
EnM4st3r Posted June 11 Share Posted June 11 you could use (setpropertyvalue ent "UsingDefaultTextPosition" 1) so: (defun c:DimReset ( / ss i ent) (setq ss (ssget "_:L" '((0 . "*DIMENSION")))) (setq i 0) (while (and ss (< i (sslength ss))) (setq ent (ssname ss i)) (setpropertyvalue ent "UsingDefaultTextPosition" 1) (setq i (1+ i)) ) ) Quote Link to comment Share on other sites More sharing options...
EnM4st3r Posted June 11 Share Posted June 11 as an alternative you could set dxf value 70 to 32 using entmod. so: (defun c:DimReset ( / ss i elist) (setq ss (ssget "_:L" '((0 . "*DIMENSION")))) (setq i 0) (while (and ss (< i (sslength ss))) (setq elist (entget (ssname ss i))) (entmod (subst '(70 . 32) (assoc 70 elist) elist)) (setq i (1+ i)) ) ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted June 12 Share Posted June 12 Another but note its hard coded for a X & Y shift. (setq obj (vlax-ename->vla-object (car (entselect "\nPick dim ")))) (setq tpos (mapcar '+ (vlax-get obj 'TextPosition) (list 125.0 120.0 0.0))) ; X & Y change (vlax-put obj 'TextPosition tpos) Used in a left & right dims so always inside. Quote Link to comment Share on other sites More sharing options...
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.