Jump to content

Recommended Posts

Posted (edited)

Hi everybody.

I found on the web lisp change dimension style. But the lisp part does not have object selection. 

So I hope those who understand lisp can help me fix it! Sincerely thank you (I do not understand lisp programming)

(defun c:CHDM (/ sclst dms dmlst dcl_id wri)
(setq dmlst '()
      obj (vlax-get-acad-object)
      doc (vla-get-activedocument obj)
      dms (vla-get-dimstyles doc))
(vlax-for x dms (setq dmlst (cons (vla-get-name x) dmlst)))
(setq dcl_id (vl-filename-mktemp nil nil ".dcl")
      wri (open dcl_id "w"))
  (foreach x '(
           "dimsty : dialog"
           "{label = \"DimStyle List\";"
           ":list_box {key = \"dmstyle\";" "multiple_select = false; height=10;}"
           "ok_cancel;"
           "}"
           )
  (write-line x wri))
  (setq wri (close wri))
(< 0 (setq dcl-load (load_dialog dcl_id))
(if (not (new_dialog "dimsty" dcl-load))(exit)))
(start_list "dmstyle")(mapcar 'add_list dmlst)(end_list)
(action_tile "dmstyle" "(setq sclst (get_tile \"dmstyle\"))")
(action_tile "accept" "(done_dialog)(setq clk t)")
(action_tile "cancel" "(done_dialog)(setq clk nil)")
(start_dialog)    
(unload_dialog dcl-load)
(if clk
  (if sclst
    (progn
    (setq secstl (nth (atoi sclst) dmlst))
    (vla-put-activedimstyle doc (vla-item (vla-get-Dimstyles doc) secstl)))))
(princ))

 

Edited by SLW210
Added Code Tags!!
Posted

So if you put the code in the code tags (press the '<>' button in the text editor box) it makes it a lot clearer to read - puts the code in the grey box.

 

What are you trying to do? This look just like a pop-up box to change the current dimension style

Posted

Where did you find this LISP?

  • Like 1
Posted

You can use SSGET to make a selection of dims then simply change their style. Either a entmod or VL method. Maybe as simple as this.

 

(defun c:wow ( / ss obj)
(setq ss (ssget (list (cons 0 "DIM*"))))
(repeat (setq x (sslength ss))
  (setq obj (vlax-ename->vla-object (ssname ss (setq x (- x 1)))))
  (vlax-put obj 'StyleName "Standard")
)
(princ)
)
(c:wow)

 

OOPs thought I posted this yesterday.

 

  • Thanks 1

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