Author Topic: Label and diameter lengths  (Read 5947 times)

0 Members and 1 Guest are viewing this topic.

Dlanor

  • Bull Frog
  • Posts: 263
Re: Label and diameter lengths
« Reply #15 on: August 22, 2019, 07:12:42 AM »
BigAl. I know, but i modified the code slightly to return the index as opposed to the item at index. This allowed me to access the correct item in a second list, formatting the fraction part to plug straight into the mtext.

BIGAL

  • Swamp Rat
  • Posts: 1409
  • 40 + years of using Autocad
Re: Label and diameter lengths
« Reply #16 on: August 23, 2019, 02:46:15 AM »
Dlannorh You can still run from 2 lines the (nth but butlst) is to push the value into the setq so if you run the (ah:butts only it will display an answer that goes no where the "but" value has already been set earlier in code so can do 1- could do the (nth but butlst) outside the defun like idx desired. But would need a list like you have done to get the text answer.
As you correctly point out the dcl uses 1 as 1st pick, a list uses 0 as 1st entry.

Code: [Select]
(ah:butts 1 "v"  a_lst)
(setq idx (1- but))

command line
(setq a_lst (list "Wire Size" "1/4" "3/8" "1/2" "3/4" "1" "1 1/4" "1 1/2" "2" "3" "4" "5"))
(LOAD "D:/Alan/Completed/Multi radio buttons.lsp")AH:BUTTS
(ah:butts 1 "v"  a_lst)
"1 1/4"
 !but
6
(setq idx (1- but))
5
A man who never made a mistake never made anything