Jump to content

Recommended Posts

Posted

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:

image.png.a76156c09dc6948a7c08b5ef1aede46b.png

 

Dimension that was edited returns to original design:

image.png.2c6a0e3a344e5702b3eeec3fa5bc3465.png

 

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

Posted

No need to use autolisp code. You can try this Select dimension - DIMEDIT - Home .

Posted

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))
  )
)

 

Posted

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))
  )
)

 

Posted

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.

  • 9 months later...
Posted
On 6/11/2024 at 5:52 PM, Kvlar said:

No need to use autolisp code. You can try this Select dimension - DIMEDIT - Home .

thank you very much :)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...