Archie_ Posted December 11 Posted December 11 (edited) I got this code from chatgpt, that chatgpt got from a defunct post from autocad website forums. Whenever I tried going to the website or googling, the link seems broken so I don't know how this code exactly works. I am trying to make a Lisp that creates dimstyles from scratch. everything is working except for changing between annotative and non annotative. The code below does a good job of setting the created dimension style to annotative. But when I ask chat gpt to make it in reverse, i.e. make a code that makes the created dimstyle non annotative, it can't. (defun set-dimstyle-annotative (dimstyle-name / ent entdata xdata) ;; Ensure the dimension style exists (if (and (setq ent (tblobjname "dimstyle" dimstyle-name)) (setq entdata (entget ent))) (progn ;; Check if XData for "AcadAnnotative" exists (if (not (assoc -3 entdata)) (progn ;; Add XData to set the dimension style as annotative (setq xdata '((-3 ("AcadAnnotative" (1000 . "AnnotativeData") (1002 . "{") (1070 . 1) ; Version number (1070 . 1) ; Annotative flag: 1 = Yes, 0 = No (1002 . "}") ) ) ) ) ;; Apply the XData to the dimension style (entmod (append entdata xdata)) (princ (strcat "\nDimension style '" dimstyle-name "' set to annotative.")) ) (princ (strcat "\nDimension style '" dimstyle-name "' is already annotative.")) ) ) (princ (strcat "\nDimension style '" dimstyle-name "' not found.")) ) (princ) ) Basically when a dimstyle is created, I put this at the end of the code to make it annotative. However, after making an annotative dimstyle, I can make a dimstyle, but because the previous was annotative, I cannot set the new dimstyle to non annotative. Chat gpt gave me a code but it seems it just butchered the code and it doesn't work. I attached the lisp file. Thanks!! DimStyles.lsp Edited December 11 by SLW210 Added Code Tags! Quote
rlx Posted December 12 Posted December 12 found this one , probably needs a little TLC from you to fit your needs : https://www.cadtutor.net/forum/topic/22088-help-with-entmake/page/2/ Quote
Steven P Posted December 12 Posted December 12 For reference you've probably seen this one, not helping your associative thing though https://stackoverflow.com/questions/47835301/use-autolisp-to-generate-new-dimension-style 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.