ILoveMadoka Posted April 11, 2023 Posted April 11, 2023 (edited) ronjon did this in vlisp HERE I was wanting to do something similar using regular lisp (to incorporate into a larger existing routine...) - I can maneuver a bit better in regular lisp being a novice too I was hoping that this would work (defun c:test () (if (setq T3 (ssget "_X" '((0 . "DIMENSION")))) (repeat (setq n (sslength T3)) (setq tdata (entget (ssname T3 (setq n (1- n))))) (entmod (subst '(3 . "NewDimStyle") (assoc 7 tdata) tdata)) ;;;NewDimStyle exists ) ) (princ)) I changed an existing dimension style using the property manager and the only thing that seemed to change was Assoc 3 - ie: (3 . OldDimStyle) My code does not work for me... Is this a simple fix? I found this in another post somewhere but did not know if you could mix vlisp/"regular" lisp (and don't know how) (vla-put-Activedimstyle (vla-get-activedocument (vlax-get-acad-object)) (vla-item (vla-get-dimstyles (vla-get-activedocument (vlax-get-acad-object))) "Name_dimstyle")) Because it is going into another routine, I wanted to keep it as compact as possible.. Edited April 11, 2023 by ILoveMadoka Quote
Steven P Posted April 11, 2023 Posted April 11, 2023 Should this be a 3 for the assoc and not a 7? (entmod (subst '(3 . "NewDimStyle") (assoc 7 tdata) tdata)) to be (entmod (subst '(3 . "NewDimStyle") (assoc 3 tdata) tdata)) Quote
ILoveMadoka Posted April 11, 2023 Author Posted April 11, 2023 Dang! I was so close!! You are my hero!! 1 Quote
ILoveMadoka Posted April 12, 2023 Author Posted April 12, 2023 I personally hate it when someone has the same issue as me then posts "I fixed it!" and doesn't post their code... Here is the final code: (defun c:test () (if (setq T3 (ssget "_X" '((0 . "DIMENSION")))) ; finds ALL dimensions (repeat (setq n (sslength T3)) (setq tdata (entget (ssname T3 (setq n (1- n))))) (entmod (subst '(3 . "NewDimStyle") (assoc 3 tdata) tdata)) ;;;Assumes NewDimStyle exists / replaces the old Dimstyle with the new ) ) (princ)) Thank you again Steven. 1 Quote
Steven P Posted April 12, 2023 Posted April 12, 2023 Thanks ILoveMadoka, hoping in this case that the discussion was clear - but a finished code makes the thread even better!! It get's worse of course, people who post and asked a question in a single thread only and then delete their account so you can't ask them for a finished code later, Quote
ILoveMadoka Posted April 13, 2023 Author Posted April 13, 2023 I walked away with not only my end goal met but I learned something as well... 1 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.