pyou Posted December 17, 2024 Posted December 17, 2024 (edited) Hi I would like to control Leaders LandingDistance variable, for example set it to 0.1, because currently it appears as 8.0 . (vla-put-LandingDistance ent_obj 0.1) seems not to work. What amendments would I need, please? Would it be possible for numbers to appear bigger than custom Text added and circle for outline? https://ibb.co/Y8d1fg0 Idea: https://ibb.co/F8rLDDK (defun c:MLI ( / *error* cmde ldr doc ent ent_obj new_num custom_text arial_style ) (defun *error* (msg) (if (and msg (not (wcmatch (strcase msg t) "*break*,*cancel*,*exit*")) ) (princ (strcat "\nError: " msg)) ) (if cmde (setvar 'cmdecho cmde)) (if ldr (setvar 'cmleaderstyle ldr)) (if doc (vla-endundomark doc)) (princ) ) ;_ end of defun (setvar 'cmdecho 0) (setq ldr (getvar 'cmleaderstyle)) ;; Ensure Arial text style exists (setq arial_style (tblsearch "STYLE" "Arial")) (if (not arial_style) ; Create Arial style if it doesn't exist (progn (command "STYLE" "Arial" "Arial" 0 1 0) ; Set font to Arial ) ) ;; Check and set Leader style (if (and (setq dic (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE")) (setq dat (dictsearch (setq dic (cdr (assoc -1 dic))) "NOTES")) ; check your Leader style here ) (setvar 'cmleaderstyle "NOTES") ; set your Leader style here ) ;_ end of if ;; Start undo mark (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) ;; Prompt user for custom text and starting number (setq custom_text (getstring t "\nEnter custom text suffix: ")) (inputnum) ;; Main loop to create numbered MLEADERs (while (initcommandversion) (command "MLEADER") (while (= 1 (logand 1 (getvar 'cmdactive))) (command pause) ) ;_ end of while (setq ent (entlast) ent_obj (vlax-ename->vla-object ent) new_num (strcat (itoa *!num!*) " " custom_text) ; Number followed by custom text as suffix *!num!* (1+ *!num!*)) ;; Set the MLEADER properties (vla-put-TextString ent_obj new_num) ; Set text string (vla-put-TextStyleName ent_obj "Arial") ; Set text style to Arial (vla-put-TextHeight ent_obj 0.3) ; Set text height to 0.3 units (vla-put-ArrowheadSize ent_obj 0.3) ; Set arrowhead size to 0.3 (vla-put-LandingGap ent_obj 0.2) ; Set landing distance (gap) to 0.2 units ) ;_ end of while ;; End undo mark and restore settings (vla-endundomark doc) (setvar 'cmleaderstyle ldr) (setvar 'cmdecho cmde) ) ;_ end of defun ;; Function to prompt for starting number (defun inputnum () (setq *!num!* (fix (cond ((getreal (strcat "\nStarting number? <" (itoa (setq *!num!* (cond (*!num!*) (1)))) ">: " ) ) ) (*!num!*) ) ) ) ) ;_ end of defun Edited December 17, 2024 by pyou Quote
BIGAL Posted December 17, 2024 Posted December 17, 2024 Maybe this as a start I am sure I have a version somewhere that does as per image. Will look for it. Pt num bubble.lsp Quote
pkenewell Posted December 18, 2024 Posted December 18, 2024 16 hours ago, pyou said: Hi I would like to control Leaders LandingDistance variable, for example set it to 0.1, because currently it appears as 8.0 . (vla-put-LandingDistance ent_obj 0.1) seems not to work. What amendments would I need, please? Would it be possible for numbers to appear bigger than custom Text added and circle for outline? @pyou try adding: (vla-put-dogleglength ent_obj 0.1) 1 Quote
pyou Posted December 18, 2024 Author Posted December 18, 2024 (edited) 22 hours ago, BIGAL said: Maybe this as a start I am sure I have a version somewhere that does as per image. Will look for it. Pt num bubble.lsp 3.49 kB · 62 downloads Thanks , but not something i would be able to use as imagined. Edited December 18, 2024 by pyou Quote
pyou Posted December 18, 2024 Author Posted December 18, 2024 When i draw a leader i can only type in suffix text at the beginning. I cant add text after, its just show as a number. For some reason it asks me to type in text again ,but it does not appear when i type it in. (defun c:MLI ( / *error* cmde ldr doc ent ent_obj new_num custom_text arial_style ) (defun *error* (msg) (if (and msg (not (wcmatch (strcase msg t) "*break*,*cancel*,*exit*")) ) (princ (strcat "\nError: " msg)) ) (if cmde (setvar 'cmdecho cmde)) (if ldr (setvar 'cmleaderstyle ldr)) (if doc (vla-endundomark doc)) (princ) ) ;_ end of defun (setvar 'cmdecho 0) (setq ldr (getvar 'cmleaderstyle)) ;; Ensure Arial text style exists (setq arial_style (tblsearch "STYLE" "Arial")) (if (not arial_style) ; Create Arial style if it doesn't exist (progn (command "STYLE" "Arial" "Arial" 0 1 0) ; Set font to Arial ) ) ;; Check and set Leader style (if (and (setq dic (dictsearch (namedobjdict) "ACAD_MLEADERSTYLE")) (setq dat (dictsearch (setq dic (cdr (assoc -1 dic))) "NOTES")) ; check your Leader style here ) (setvar 'cmleaderstyle "NOTES") ; set your Leader style here ) ;_ end of if ;; Start undo mark (setq doc (vla-get-activedocument (vlax-get-acad-object))) (vla-startundomark doc) ;; Prompt user for custom text and starting number (setq custom_text (getstring t "\nEnter custom text suffix: ")) (inputnum) ;; Main loop to create numbered MLEADERs (while (initcommandversion) (command "MLEADER") (while (= 1 (logand 1 (getvar 'cmdactive))) (command pause) ) ;_ end of while (setq ent (entlast) ent_obj (vlax-ename->vla-object ent) new_num (strcat (itoa *!num!*) " " custom_text) ; Number followed by custom text as suffix *!num!* (1+ *!num!*)) ;; Set the MLEADER properties (vla-put-TextString ent_obj new_num) ; Set text string (vla-put-TextStyleName ent_obj "Arial") ; Set text style to Arial (vla-put-TextHeight ent_obj 0.3) ; Set text height to 0.3 units (vla-put-ArrowheadSize ent_obj 0.3) ; Set arrowhead size to 0.3 (vla-put-LandingGap ent_obj 0.1) ; Set landing distance (gap) to 0.1 units (vla-put-dogleglength ent_obj 0.1) ; Set arrow landing distance ) ;_ end of while ;; End undo mark and restore settings (vla-endundomark doc) (setvar 'cmleaderstyle ldr) (setvar 'cmdecho cmde) ) ;_ end of defun ;; Function to prompt for starting number (defun inputnum () (setq *!num!* (fix (cond ((getreal (strcat "\nStarting number? <" (itoa (setq *!num!* (cond (*!num!*) (1)))) ">: " ) ) ) (*!num!*) ) ) ) ) ;_ end of defun 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.