RyanAtNelco Posted November 3, 2009 Posted November 3, 2009 Hey all, Does anyone know of a lisp that goes through all the dimstyles and removes the option "place text manually". I want my measurment to automatically be centered on the dimension, and I frequently work with drawings that have many text styles that have the "place text manually" box checked off in the dimstyle properties. Thanks! Quote
Freerefill Posted November 3, 2009 Posted November 3, 2009 I had the same problem not too long ago. Try this: (defun c:fd( / ss eLst) (princ "\nSelect dimensions: ") (setq ss (ssget '((0 . "DIMENSION")))) (if ss (foreach forVar (vl-remove nil (mapcar '(lambda (x) (if (= (type (cadr x)) 'ENAME) (cadr x) '())) (ssnamex ss))) (setq eLst (entget forVar)) (setq eLst (subst '(70 . 32) (assoc 70 eLst) eLst)) (entmod eLst) (entupd forVar) ) ) ); Fix dimensions so text aligns in the center Quote
RyanAtNelco Posted November 3, 2009 Author Posted November 3, 2009 This is good, but it looks like it takes each individual dimension. Do you know of a way to edit the dimension styles, so that future dimensions you create will automatically be centered? Quote
Freerefill Posted November 3, 2009 Posted November 3, 2009 hmm.. if you go to the modify dimensions window (command: "DIMSTYLE"), modify the one you want then click on the "TEXT" tab, under "Text alignment" (bottom right corner) you should see a radio button. Check to make sure that "Aligned with dimension line" is selected. I'm afraid I haven't done much with dimension styles, so I think that's the best I can tell you. Quote
RyanAtNelco Posted November 3, 2009 Author Posted November 3, 2009 I have some similar code provided by alanjt. I have highlighted what i think needs to be changed, but i am admittedly not very good at writing code yet. (vl-load-com) (defun C:dmanual () (vlax-for x (vla-get-TextStyles (vla-get-activedocument (vlax-get-acad-object)) ) (princ) (vla-setfont x "ARIAL" :vlax-False :vlax-False 0 32) ) ) I think textstyles needs to be changed to dimstyles, and font x "ARIAL" :vlax-False :vlax-False 0 32 needs to be changed as well, but im not sure to what. Any insight would be great! Quote
RyanAtNelco Posted November 3, 2009 Author Posted November 3, 2009 Alan, That is what i have been doing, but i have some drawings that have many dimstyles and it is time-consuming to go through the whole list. I am looking to do it with a lisp, but i do not know the correct vla-set command (does anyone have a list of these commands handy?). Am i correct in assuming i should change "textstyles" to "dimstyles" ? Quote
alanjt Posted November 3, 2009 Posted November 3, 2009 RyanAtNelco said: Alan, That is what i have been doing, but i have some drawings that have many dimstyles and it is time-consuming to go through the whole list. I am looking to do it with a lisp, but i do not know the correct vla-set command (does anyone have a list of these commands handy?). Am i correct in assuming i should change "textstyles" to "dimstyles" ? This should get you started, can't edit current style (just how it is). (defun test (#Name / #Style) (and (setq #Style (entget (tblobjname "dimstyle" #Name))) (entmod (append #Style (list (cons 288 0)))))) Quote
alanjt Posted November 3, 2009 Posted November 3, 2009 RyanAtNelco said: Thanks Alan! No problem. 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.