Author Topic: Make a drop down list selection to do two things at the same time.  (Read 664 times)

0 Members and 1 Guest are viewing this topic.

jlogan02

  • Bull Frog
  • Posts: 228
By selecting a scale from the drop down list the border & text styles are scaled per the associated dimscale.

All works great!!!!


Code - Auto/Visual Lisp: [Select]
  1. (defun c:STA_Scale_TB ( / blk1 siz names dimsc dsty dstydata )
  2.   (setq SIZ "0")                                        
  3.   (setq NAMES '("FULL" "1/4\" = 1'-0\"" "1/2\" = 1'-0\"" "1\" = 1'-0\"" "1-1/2\" = 1'-0\"" "3\" = 1'-0\"" "6\" = 1'-0\""))
  4.  
  5.   (setq dcl_id (load_dialog "STA_Scale_TB.dcl"))        ;load dialog
  6.  
  7.   (if (not (new_dialog "STA_Scale_TB" dcl_id)           ;test for dialog
  8.        )                                                ;not
  9.        (exit)                                           ;exit if no dialog
  10.   )                                                     ;if
  11.  
  12.   (start_list "selections")                             ;start the list box
  13.   (mapcar 'add_list NAMES)                              ;fill the list box
  14.   (end_list)                                            ;end list
  15.  
  16.     "cancel"                                            ;if cancel button pressed
  17.     "(done_dialog) (setq userclick nil)"                ;close dialog, set flag
  18.     )                                                   ;action_tile
  19.  
  20.     "accept"                                            ;if O.K. pressed
  21.     (strcat                                             ;string 'em together
  22.       "(progn
  23.         (setq SIZ (get_tile \"selections\")))"          ;get list selection
  24.       " (done_dialog)(setq userclick T))"               ;close dialog, set flag
  25.     )                                                   ;strcat
  26.   )                                                     ;action tile
  27.  
  28.   (start_dialog)                                        ;start dialog
  29.  
  30.   (unload_dialog dcl_id)                                ;unload
  31.  
  32.    (if userclick                                        ;check O.K. was selected
  33.      (progn
  34.        (cond
  35.         ((= SIZ "0") (setvar "dimscale" 1));;FULL
  36.         ((= SIZ "1") (setvar "dimscale" 48));;1/4"
  37.         ((= SIZ "2") (setvar "dimscale" 24));;1/2"
  38.         ((= SIZ "3") (setvar "dimscale" 12));;1"
  39.         ((= SIZ "4") (setvar "dimscale" 8));;1 1/2"
  40.         ((= SIZ "5") (setvar "dimscale" 4));;3"
  41.         ((= SIZ "6") (setvar "dimscale" 2));;6"
  42.        )                                                ;cond
  43.      )                                                  ;progn
  44.    )                                                    ;;if
  45.  
  46.   (setq dimsc (getvar 'dimscale))
  47.   (command "-layer" "unlock" "TBLK_BORD_LINES" "")
  48.   (if (setq blk1 (ssget "x" '((2 . "TBLK_BORD_CTL,TBLK_ATT_CTL"))))
  49.         (command "scale" blk1 "" "0,0" dimsc)
  50.    )
  51.  
  52.    (setvar 'dynmode 0)
  53.    (while (setq dsty (tblnext "dimstyle" (not dsty)))
  54.    (setq dstydata (entget (tblobjname "dimstyle" (cdr (assoc 2 dsty)))))
  55.    (if (assoc 40 dstydata)                                                      ; [because not included in data if default 1.0]
  56.        (entmod (subst (cons 40 dimsc) (assoc 40 dstydata) dstydata))            ; then -- replace it
  57.        (entmod (append dstydata (list (cons 40 dimsc))))                        ; else -- add it
  58.     )
  59.   )
  60.  
  61. (if (= (getvar 'dimscale) 8)
  62.         (command "dimstyle" "R" "ORDINATE_FRAC")
  63.    )
  64.  
  65.         (command "-layer" "lock" "TBLK_BORD_LINES" "")
  66.         (command "-layer" "Filter" "Set" "Stations Standard Layers" "exit" "")
  67.         (command "layer" "M" "LINE1" "C" "YELLOW" "LINE1" "")
  68.         (command "zoom" "e")
  69.         (command "limits" (getvar "extmin") (getvar "extmax"))
  70.  
  71.         (setvar "CMDECHO" 0)
  72.         (setvar "BLIPMODE" 0)
  73.  
  74.         (command ".style" "Standard" "ipco.shx" (* 1.000 dimsc) "0.85" "0" "n" "n" "n")
  75.         (command ".style" "L080" "ipco.shx" (* 0.0781 dimsc) "0.85" "0" "n" "n" "n")
  76.         (command ".style" "L100" "ipco.shx" (* 0.0938 dimsc) "0.85" "0" "n" "n" "n")
  77.         (command ".style" "L120" "ipco.shx" (* 0.1094 dimsc) "0.85" "0" "n" "n" "n")
  78.         (command ".style" "L140" "ipco.shx" (* 0.1406 dimsc) "0.85" "0" "n" "n" "n")
  79.         (command ".style" "L175" "ipco.shx" (* 0.1563 dimsc) "0.85" "0" "n" "n" "n")
  80.         (command ".style" "L200" "ipco.shx" (* 0.1719 dimsc) "0.85" "0" "n" "n" "n")
  81.         (command ".style" "L240" "ipco.shx" (* 0.2187 dimsc) "0.85" "0" "n" "n" "n")
  82.         (command ".style" "Ls080" "ipco.shx" (* 0.0781 dimsc) "0.85" "20" "n" "n" "n")
  83.         (command ".style" "Ls100" "ipco.shx" (* 0.0938 dimsc) "0.85" "20" "n" "n" "n")
  84.         (command ".style" "Ls120" "ipco.shx" (* 0.1094 dimsc) "0.85" "20" "n" "n" "n")
  85.         (command ".style" "Ls140" "ipco.shx" (* 0.1406 dimsc) "0.85" "20" "n" "n" "n")
  86.         (command ".style" "Ls175" "ipco.shx" (* 0.1563 dimsc) "0.85" "20" "n" "n" "n")
  87.         (command ".style" "Ls200" "ipco.shx" (* 0.1719 dimsc) "0.85" "20" "n" "n" "n")
  88.         (command ".style" "Ls240" "ipco.shx" (* 0.2187 dimsc) "0.85" "20" "n" "n" "n")
  89.         (command ".style" "PEN0" "ipco.shx" (* 0.0625 dimsc) "0.85" "0" "n" "n" "n")
  90.         (command ".style" "PEN1" "ipco.shx" (* 0.0781 dimsc) "0.85" "0" "n" "n" "n")
  91.         (command ".style" "PEN2" "ipco.shx" (* 0.0125 dimsc) "0.85" "0" "n" "n" "n")
  92.         (command ".style" "PEN2s" "ipco.shx" (* 0.1000 dimsc) "0.85" "0" "n" "n" "n")
  93.         (command ".style" "PEN3" "ipco.shx" (* 0.1875 dimsc) "0.85" "0" "n" "n" "n")
  94.         (command ".style" "PEN4" "ipco.shx" (* 0.2500 dimsc) "0.85" "0" "n" "n" "n")
  95.         (command ".style" "PEN5" "ipco.shx" (* 0.3125 dimsc) "0.85" "0" "n" "n" "n")
  96.  
  97.         (setvar "cmdecho" 1)
  98.      
  99.  (princ)
  100.  
  101. );;end defun

I have this piece of code (Lee Mac magic) that looks at the attribute tag, checks what it says and does stuff...

Code - Auto/Visual Lisp: [Select]
  1. (defun lm:getattributevalue (blk tag / val enx)
  2.     (while
  3.       (and (null val) (= "ATTRIB" (cdr (assoc 0 (setq enx (entget (setq blk (entnext blk))))))))
  4.        (if (= (strcase tag) (strcase (cdr (assoc 2 enx))))
  5.          (setq val (cdr (assoc 1 enx)))
  6.        )
  7.     )
  8.   )
  9.  
  10. (setq ss (ssget "x" '((0 . "INSERT") (2 . "TBLK_ATT_CTL") (66 . 1))))
  11.   (setq attvalue (LM:GetAttributeValue (ssname ss 0) "DRAWINGSCALE"))
  12.   (cond ((wcmatch (strcase attvalue) "NONE");;; REPLACE THIS SO THAT IT POPULATES THE attvalue WITH THE SELECTION FROM THE DROP  DOWN MENU.
  13.          "do stuff here"
  14.           );;end if
  15.   );;end cond

I want to populate the "DrawingScale" Tag in the attribute with whatever the selection was in the drop down list.

Is this possible? Seems to me it should be.

I'm not sure the LM:GetAttributeValue even needs to be used. I'm pretty sure it doesn't. It's just my first thought

My guess?!?!?

Use the userclick function and replace
Code - Auto/Visual Lisp: [Select]
  1. (setvar "dimscale"...
with something akin to editing the "DrawingScale" Tag.

If anyone has a nudge that would be great. Mostly I'm hoping for some search suggestions or "look at this". If I get stumped, I'll be back here.

 
 

J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

BIGAL

  • Swamp Rat
  • Posts: 817
  • 30 + years of using Autocad
Re: Make a drop down list selection to do two things at the same time.
« Reply #1 on: June 02, 2021, 09:03:13 PM »
This is an example not coded to match your request.

Code: [Select]
(setq tagname "yourtagname")

(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1) ))))
(if  (= (vla-get-hasattributes obj) :vlax-true)
(foreach att (vlax-invoke obj 'getattributes)
(if (= tagname (strcase (vla-get-tagstring att)))
(vla-put-textstring att yourvalue)
)
)
)
)
A man who never made a mistake never made anything

jlogan02

  • Bull Frog
  • Posts: 228
Re: Make a drop down list selection to do two things at the same time.
« Reply #2 on: June 04, 2021, 12:52:16 PM »
Thanks. I'll take a look.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Bull Frog
  • Posts: 228
Re: Make a drop down list selection to do two things at the same time.
« Reply #3 on: June 04, 2021, 06:16:27 PM »
Quick little test on BIGAL's suggestion.

This is an example not coded to match your request.

Code: [Select]
(setq tagname "yourtagname")

(repeat (setq x (sslength ss))
(setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1) ))))
(if  (= (vla-get-hasattributes obj) :vlax-true)
(foreach att (vlax-invoke obj 'getattributes)
(if (= tagname (strcase (vla-get-tagstring att)))
(vla-put-textstring att yourvalue)
)
)
)
)

Added "mytagname"
Added in the ssget for the attributed block
added "myvalue"

Code - Auto/Visual Lisp: [Select]
  1. ...
  2. (if userclick                                        ;check O.K. was selected
  3.      (progn
  4.        (cond
  5.         ((= SIZ "0") (setvar "dimscale" 1));;FULL
  6.         ((= SIZ "1") (setvar "dimscale" 48));;1/4"
  7.         ((= SIZ "2") (setvar "dimscale" 24));;1/2"
  8.         ((= SIZ "3") (setvar "dimscale" 12));;1"
  9.         ((= SIZ "4") (setvar "dimscale" 8));;1 1/2"
  10.         ((= SIZ "5") (setvar "dimscale" 4));;3"
  11.         ((= SIZ "6") (setvar "dimscale" 2));;6"
  12.        )                                                ;cond
  13.      )                                                  ;progn
  14.    )                                                    ;;if
  15.  
  16. (setq tagname "DRAWINGSCALE")
  17. (setq ss (ssget "x" '((2 . "TBLK_ATT_CTL"))))
  18. (repeat (setq x (sslength ss))
  19. (setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1) ))))
  20. (if  (= (vla-get-hasattributes obj) :vlax-true)
  21. (foreach att (vlax-invoke obj 'getattributes)
  22. (if (= tagname (strcase (vla-get-tagstring att)))
  23. )
  24. )
  25. )
  26. )
  27. ...

The result = "DrawingScale" attribute gets filled out with the number found in quotes in the SIZ variable in the USERCLICK cond.

I'm assuming I need to create another user click with a cond for a new variable tag1 and maybe ?? add the scales...

Code - Auto/Visual Lisp: [Select]
  1. ((= tag1 "4") ("1 1/2\" = 1'-0\"" ));;1 1/2"

I doubt that's it. Seems like that would return "4" like it did with my initial attempt.

End of the day, so I'll start in Monday.

J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Bull Frog
  • Posts: 228
Re: Make a drop down list selection to do two things at the same time.
« Reply #4 on: June 07, 2021, 02:03:54 PM »
Yup, no go with...

Code - Auto/Visual Lisp: [Select]
  1. ((= tag1 "4") ("1 1/2\" = 1'-0\"" ));;1 1/2"

I do get a result with...

Code - Auto/Visual Lisp: [Select]
  1. (setq tag1 "1/4\" = 1'-0\"")
  2. (setq tagname "DRAWINGSCALE")
  3. (setq SS (ssget "x" '((2 . "TBLK_ATT_CTL"))))
  4. (repeat (setq x (sslength ss))
  5. (setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1) ))))
  6. (if  (= (vla-get-hasattributes obj) :vlax-true)
  7. (foreach att (vlax-invoke obj 'getattributes)
  8. (if (= tagname (strcase (vla-get-tagstring att)))
  9. )
  10. )
  11. )

I thought, let's try this...

Code - Auto/Visual Lisp: [Select]
  1. (setq tag0 "FULL")
  2. (setq tag1 "1/4\" = 1'-0\"")
  3. (setq tag2 "1/2\" = 1'-0\"")  
  4.  (setq scl (list tag0 tag1 tag2))
  5.  
  6. (setq tagname "DRAWINGSCALE")
  7. (setq SS (ssget "x" '((2 . "TBLK_ATT_CTL"))))
  8. (repeat (setq x (sslength ss))
  9. (setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1) ))))
  10. (if  (= (vla-get-hasattributes obj) :vlax-true)
  11. (foreach att (vlax-invoke obj 'getattributes)
  12. (if (= tagname (strcase (vla-get-tagstring att)))
  13. )
  14. )
  15. )
  16. )

No result. Not sure where to go from here.

J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

ronjonp

  • Needs a day job
  • Posts: 7327
Re: Make a drop down list selection to do two things at the same time.
« Reply #5 on: June 07, 2021, 03:31:55 PM »
TBH I'm a bit confused as to what you're trying to accomplish but here's some food for thought:
Code - Auto/Visual Lisp: [Select]
  1. (setq tag1 "1/4\" = 1'-0\"")
  2. (setq tagname "DRAWINGSCALE")
  3. ;; Use '(66 . 1) to filter blocks with attributes
  4. (if (setq ss (ssget "_X" '((2 . "TBLK_ATT_CTL") (66 . 1))))
  5.   (repeat (setq x (sslength ss))
  6.     (setq obj (vlax-ename->vla-object (ssname ss (setq x (1- x)))))
  7.     (foreach att (vlax-invoke obj 'getattributes)
  8.       (if (= tagname (strcase (vla-get-tagstring att)))
  9.         (vla-put-textstring att tag1)
  10.       )
  11.     )
  12.   )
  13. )
  14.  
  15. ;;;(setq tag0 "FULL")
  16. ;;;(setq tag1 "1/4\" = 1'-0\"")
  17. ;;;(setq tag2 "1/2\" = 1'-0\"")
  18. (setq vals '(("FULL" "1/2\" = 1'-0\"") ("DRAWINGSCALE" "1/4\" = 1'-0\"")))
  19. ;; This is a LIST that you're trying to fill a STRING in with?
  20. (setq scl (list tag0 tag1 tag2))
  21. ;; (setq tagname "DRAWINGSCALE")
  22. (if (setq ss (ssget "_X" '((2 . "TBLK_ATT_CTL") (66 . 1))))
  23.   (repeat (setq x (sslength ss))
  24.     (setq obj (vlax-ename->vla-object (ssname ss (setq x (1- x)))))
  25.     (foreach att (vlax-invoke obj 'getattributes)
  26.       (if (setq v (assoc (strcase (vla-get-tagstring att)) vals))
  27.         ;; 'scl' is a list not a string
  28.         (vla-put-textstring att (cadr v))
  29.       )
  30.     )
  31.   )
  32. )

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

jlogan02

  • Bull Frog
  • Posts: 228
Re: Make a drop down list selection to do two things at the same time.
« Reply #6 on: June 07, 2021, 05:44:34 PM »
I want to use the scale chosen by the user from a dialog box, to...

1. Scale the drawing - This it already does.

2. Fill out the attribute tag "DRAWINGSCALE" with the choice made by the user from the dialog box.


 
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

jlogan02

  • Bull Frog
  • Posts: 228
Re: Make a drop down list selection to do two things at the same time.
« Reply #7 on: June 07, 2021, 05:46:02 PM »
dialog box image
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

BIGAL

  • Swamp Rat
  • Posts: 817
  • 30 + years of using Autocad
Re: Make a drop down list selection to do two things at the same time.
« Reply #8 on: June 07, 2021, 08:02:31 PM »
When you pick the item from the dcl list it returns the item number, so it may be better to use that (nth but lst) = "1/4 scale" for the variable, I work in metric so much easier.
A man who never made a mistake never made anything

jlogan02

  • Bull Frog
  • Posts: 228
Re: Make a drop down list selection to do two things at the same time.
« Reply #9 on: June 28, 2021, 07:07:59 PM »
Finally getting back to this.

As mentioned my intent is to have the drop down list complete two functions from the same selection within the list.
The first objective is to scale the drawing from the selected item.
The second objective is to populate the tagname "DRAWINGSCALE" in the attributed title block based on what the user picks from the drop down list NAMES.

Code - Auto/Visual Lisp: [Select]
  1. (setq NAMES '("FULL" "1/4\" = 1'-0\"" "1/2\" = 1'-0\"" "1\" = 1'-0\"" "1-1/2\" = 1'-0\"" "3\" = 1'-0\"" "6\" = 1'-0\"" "SWITCHX"))

I'm clearly not understanding the examples provided by BigAL and RonJonp. I am using
Code - Auto/Visual Lisp: [Select]
  1. (nth 1 names)

which gets me 1/4" = 1'-0" or the second item in the NAMES list, which I understand. What I don't understand is the syntax used to fill out the tagname based on any selection a user makes from the drop down list NAMES.

Full code below...

Code - Auto/Visual Lisp: [Select]
  1. (defun c:STA_Scale_TB ( / blk1 siz names dimsc dsty dstydata obj tagname userclick x )
  2.  (defun *error* (msg)
  3.     (if s
  4.       (vla-delete s)
  5.     )
  6.     (if acDoc
  7.       (vla-endundomark acDoc)
  8.     )
  9.     (cond ((not msg))                                                   ; Normal exit
  10.           ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
  11.           ((princ (strcat "\n** Error: " msg " ** ")))                  ; Fatal error, display it
  12.     )
  13.     (princ)
  14.   )
  15.  
  16.   (setq SIZ "0")                                        
  17.   (setq NAMES '("FULL" "1/4\" = 1'-0\"" "1/2\" = 1'-0\"" "1\" = 1'-0\"" "1-1/2\" = 1'-0\"" "3\" = 1'-0\"" "6\" = 1'-0\""
  18.   "SWITCHX"))
  19.  
  20.   (setq dcl_id (load_dialog "STA_Scale_TB.dcl"))        ;load dialog
  21.  
  22.   (if (not (new_dialog "STA_Scale_TB" dcl_id)           ;test for dialog
  23.        )                                                ;not
  24.        (exit)                                           ;exit if no dialog
  25.   )                                                     ;if
  26.  
  27.   (start_list "selections")                             ;start the list box
  28.   (mapcar 'add_list NAMES)                              ;fill the list box
  29.   (end_list)                                            ;end list
  30.  
  31.     "cancel"                                            ;if cancel button pressed
  32.     "(done_dialog) (setq userclick nil)"                ;close dialog, set flag
  33.     )                                                   ;action_tile
  34.  
  35.     "accept"                                            ;if O.K. pressed
  36.     (strcat                                             ;string 'em together
  37.       "(progn
  38.         (setq SIZ (get_tile \"selections\")))"          ;get list selection
  39.       " (done_dialog)(setq userclick T))"               ;close dialog, set flag
  40.     )                                                   ;strcat
  41.   )                                                     ;action tile
  42.  
  43.   (start_dialog)                                        ;start dialog
  44.  
  45.   (unload_dialog dcl_id)                                ;unload
  46.  
  47.    (if userclick                                        ;check O.K. was selected
  48.      (progn
  49.        (cond
  50.         ((= SIZ "0") (setvar "dimscale" 1));;FULL
  51.         ((= SIZ "1") (setvar "dimscale" 48));;1/4"
  52.         ((= SIZ "2") (setvar "dimscale" 24));;1/2"
  53.         ((= SIZ "3") (setvar "dimscale" 12));;1"
  54.         ((= SIZ "4") (setvar "dimscale" 8));;1 1/2"
  55.         ((= SIZ "5") (setvar "dimscale" 4));;3"
  56.         ((= SIZ "6") (setvar "dimscale" 2));;6"
  57.        )                                                ;cond
  58.      )                                                  ;progn
  59.    )                                                    ;;if
  60.  
  61.    
  62. (setq tagname "DRAWINGSCALE")
  63. (setq SS (ssget "x" '((2 . "TBLK_ATT_CTL")(66 . 1))))
  64. (repeat (setq x (sslength ss))
  65. (setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1) ))))
  66. (if  (= (vla-get-hasattributes obj) :vlax-true)
  67. (foreach att (vlax-invoke obj 'getattributes)
  68. (if (= tagname (strcase (vla-get-tagstring att)))
  69. (vla-put-textstring att (nth 1 names));;how to get any item from the NAMES list ???
  70. )
  71. )
  72. )
  73.  
  74.   (setq dimsc (getvar 'dimscale))
  75.   (command "-layer" "unlock" "TBLK_BORD_LINES" "")
  76.   (if (setq blk1 (ssget "x" '((2 . "TBLK_BORD_CTL,TBLK_ATT_CTL"))))
  77.         (command "scale" blk1 "" "0,0" dimsc)
  78.   )
  79.  
  80.    (setvar 'dynmode 0)
  81.    (while (setq dsty (tblnext "dimstyle" (not dsty)))
  82.    (setq dstydata (entget (tblobjname "dimstyle" (cdr (assoc 2 dsty)))))
  83.    (if (assoc 40 dstydata)                                                      ; [because not included in data if default 1.0]
  84.        (entmod (subst (cons 40 dimsc) (assoc 40 dstydata) dstydata))            ; then -- replace it
  85.        (entmod (append dstydata (list (cons 40 dimsc))))                        ; else -- add it
  86.     )
  87.   )
  88.  
  89.  
  90.  
  91.         (command "-layer" "lock" "TBLK_BORD_LINES" "")
  92.         (command "-layer" "Filter" "Set" "Stations Standard Layers" "exit" "")
  93.         (command "layer" "M" "LINE1" "C" "YELLOW" "LINE1" "")
  94.         (command "zoom" "e")
  95.         (command "limits" (getvar "extmin") (getvar "extmax"))
  96.  
  97.         (setvar "CMDECHO" 0)
  98.         (setvar "BLIPMODE" 0)
  99.  
  100.         (command ".style" "Standard" "ipco.shx" (* 1.000 dimsc) "0.85" "0" "n" "n" "n")
  101.         (command ".style" "L080" "ipco.shx" (* 0.0781 dimsc) "0.85" "0" "n" "n" "n")
  102.         (command ".style" "L100" "ipco.shx" (* 0.0938 dimsc) "0.85" "0" "n" "n" "n")
  103.         (command ".style" "L120" "ipco.shx" (* 0.1094 dimsc) "0.85" "0" "n" "n" "n")
  104.         (command ".style" "L140" "ipco.shx" (* 0.1406 dimsc) "0.85" "0" "n" "n" "n")
  105.         (command ".style" "L175" "ipco.shx" (* 0.1563 dimsc) "0.85" "0" "n" "n" "n")
  106.         (command ".style" "L200" "ipco.shx" (* 0.1719 dimsc) "0.85" "0" "n" "n" "n")
  107.         (command ".style" "L240" "ipco.shx" (* 0.2187 dimsc) "0.85" "0" "n" "n" "n")
  108.         (command ".style" "Ls080" "ipco.shx" (* 0.0781 dimsc) "0.85" "20" "n" "n" "n")
  109.         (command ".style" "Ls100" "ipco.shx" (* 0.0938 dimsc) "0.85" "20" "n" "n" "n")
  110.         (command ".style" "Ls120" "ipco.shx" (* 0.1094 dimsc) "0.85" "20" "n" "n" "n")
  111.         (command ".style" "Ls140" "ipco.shx" (* 0.1406 dimsc) "0.85" "20" "n" "n" "n")
  112.         (command ".style" "Ls175" "ipco.shx" (* 0.1563 dimsc) "0.85" "20" "n" "n" "n")
  113.         (command ".style" "Ls200" "ipco.shx" (* 0.1719 dimsc) "0.85" "20" "n" "n" "n")
  114.         (command ".style" "Ls240" "ipco.shx" (* 0.2187 dimsc) "0.85" "20" "n" "n" "n")
  115.         (command ".style" "PEN0" "ipco.shx" (* 0.0625 dimsc) "0.85" "0" "n" "n" "n")
  116.         (command ".style" "PEN1" "ipco.shx" (* 0.0781 dimsc) "0.85" "0" "n" "n" "n")
  117.         (command ".style" "PEN2" "ipco.shx" (* 0.0125 dimsc) "0.85" "0" "n" "n" "n")
  118.         (command ".style" "PEN2s" "ipco.shx" (* 0.1000 dimsc) "0.85" "0" "n" "n" "n")
  119.         (command ".style" "PEN3" "ipco.shx" (* 0.1875 dimsc) "0.85" "0" "n" "n" "n")
  120.         (command ".style" "PEN4" "ipco.shx" (* 0.2500 dimsc) "0.85" "0" "n" "n" "n")
  121.         (command ".style" "PEN5" "ipco.shx" (* 0.3125 dimsc) "0.85" "0" "n" "n" "n")
  122.  
  123.         (setvar "cmdecho" 1)
  124.      
  125.  (princ)
  126.  
  127. );;end defun


Code - Auto/Visual Lisp: [Select]
  1. (setq tagname "DRAWINGSCALE")
  2. (setq SS (ssget "x" '((2 . "TBLK_ATT_CTL")(66 . 1))))
  3. (repeat (setq x (sslength ss))
  4. (setq obj (vlax-ename->vla-object (ssname SS (setq x (- x 1) ))))
  5. (if  (= (vla-get-hasattributes obj) :vlax-true)
  6. (foreach att (vlax-invoke obj 'getattributes)
  7. (if (= tagname (strcase (vla-get-tagstring att)))
  8. (vla-put-textstring att (nth 1 names))
  9. )
  10. )
  11. )

I'm pretty frustrated with myself for not getting it, so I'm stepping away for bit.

J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10

BIGAL

  • Swamp Rat
  • Posts: 817
  • 30 + years of using Autocad
Re: Make a drop down list selection to do two things at the same time.
« Reply #10 on: June 28, 2021, 11:22:50 PM »
Just a guess you want (nth (ATOI siz) names) as the attribute value, using 1 means it will always set to the "1/4"
A man who never made a mistake never made anything

jlogan02

  • Bull Frog
  • Posts: 228
Re: Make a drop down list selection to do two things at the same time.
« Reply #11 on: June 29, 2021, 11:08:28 AM »
Now see, there's something I didn't think about. I kept looking at the
Code - Auto/Visual Lisp: [Select]
  1. (= Siz "num")
in the user click list and saying I need to use that and but definitely not with ATOI. It was never on my radar.

Thanks Big Al.
J. Logan
ACAD 2018

I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10