TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: sln8458 on August 04, 2020, 08:52:49 AM

Title: multiple radio buttons working together?
Post by: sln8458 on August 04, 2020, 08:52:49 AM
I have started a new project.

A DCL/LSP to insert 3D piping components. sorry for the poor image quality.
(https://serving.photos.photobox.com/340556804d6ed3b52ed370a62b4abdf77a616140c1b7f18460ba8b7f8a8ef612e3d58e87.jpg)

Following the same general direction as my previous post, in that I have a 'dim' text file that contains the list box info, the file name of the drawing to be inserted, followed by the values for the dimensions.

Concentrating on the flanges,
there is the box for selecting the flange 'type'
then radio buttons for RF or RJF
then 'schedule' and finally 'class'

example: WN + RF + sch60 + #300 = dim file.

All of these are required before selecting the specific flange size followed by OK
That will mean
5 options for type
2 options for face
10 options for schedule
7 options for class
total 700 permutations, if my maths is correct?  which also means 700 'dim' files! (the easy bit for me)

Before I attempt any further code, what is the simplest way to achieve the end result?

Steve
Title: Re: multiple radio buttons working together?
Post by: Lee Mac on August 05, 2020, 02:09:53 PM
sorry for the poor image quality.

I would suggest using a lossless compression format such as PNG when taking screenshots, rather than lossy compression formats such as JPG which are more suited to photographs.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on August 07, 2020, 04:40:55 AM
I scanned the internet for help on this and the nearest I came to was here
https://www.afralisp.net/dialog-control-language/tutorials/dialog-boxes-and-autolisp-part-2.php (https://www.afralisp.net/dialog-control-language/tutorials/dialog-boxes-and-autolisp-part-2.php)

I downloaded the code and set about modifying to trial some code.

This is what I have,

(https://serving.photos.photobox.com/50853492712a73be319ef91e0132eb5f61eb60b631d80a05a8e76082abe10f48d192de4e.jpg)


For each column I have set a variable.
I have then concatenated the results for each variable.

The goal for this section of the dialogue is to set the file name that will be loaded to fill the list box in the full dialogue.

I have set a (princ fname) to display the concatenation results.
The code appears to work,BUT
on the command line the concatenation appears to be one selection behind??

See attached files

Is it me?
Steve
Title: Re: multiple radio buttons working together?
Post by: DEVITG on August 07, 2020, 07:02:00 PM
Once upon a time , about 2005 , I had asked to do all "allen" screw , cylindrical head the user can find at his vendor. 
There was no nothing at the web .
So I ask him to ask his vendor for all his each unit at stock .

Get the ISO standard , we use millimeters, and suit a csv file , from xls with all the relative measures .

With such csv I did a lisp to draw , each screw, in 3d , and to be a block inside the dwg . Them by design center CTRL+2 , then user chose what he wants and insert it at is dwg .

So as flanges are one and unique for each use , there is no need to draw it each time.

Of course by this day you can have anything from vendors websites. Or from CADENAS cad dwgs or

https://b2b.partcommunity.com/community/members/home (https://b2b.partcommunity.com/community/members/home)

No dialog box no typing error.   


The concept is the same the piping constructor will do for a work to do , get what he need with no error, the self.
 

And last but not least

DO NOT REINVENT THE WHEEL




Title: Re: multiple radio buttons working together?
Post by: BIGAL on August 08, 2020, 01:10:58 AM
Dynamic blocks are the way to go for bolts and screws etc.
Title: Re: multiple radio buttons working together?
Post by: roy_043 on August 08, 2020, 06:48:05 AM
Here is how I would approach this:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:Samp4 (  / N_ActionAccept N_ActionCancel N_SetImage N_SetValues dcl_id fnm ret)
  2.  
  3.   (defun N_ActionAccept ()
  4.     (setq fnm
  5.       (strcat
  6.         (substr (get_tile "flange") 5) ; "flange" is key of radio column, get_tile returns key of selected radio button.
  7.         "_"
  8.         (substr (get_tile "face") 5)
  9.         "_"
  10.         (get_tile "schedule")
  11.         "_"
  12.         "#"
  13.         (substr (get_tile "class") 5)
  14.         "_"
  15.         ".dim"
  16.       )
  17.     )
  18.     (done_dialog 1)
  19.   )
  20.  
  21.   (defun N_ActionCancel ()
  22.     (done_dialog 0)
  23.   )
  24.  
  25.   (defun N_SetImage ()
  26.     (start_image "img")
  27.     (fill_image 0 0 (dimx_tile "img") (dimy_tile "img") 5) ; fill image with blue.
  28.     (end_image)
  29.   )
  30.  
  31.   (defun N_SetValues ()            ; sets default values.
  32.     (set_tile "flange"   "fla_sw") ; "flange" is key of radio column, "fla_sw" is key of radio button.
  33.     (set_tile "face"     "fac_ff")
  34.     (set_tile "schedule" "sch_20")
  35.     (set_tile "class"    "cla_150")
  36.   )
  37.  
  38.   (if
  39.     (and
  40.       (< 0 (setq dcl_id (load_dialog "samp4.dcl")))
  41.       (new_dialog "samp4" dcl_id)
  42.     )
  43.     (progn
  44.       (N_SetImage)
  45.       (N_SetValues)
  46.       (action_tile "accept" "(N_ActionAccept)")
  47.       (action_tile "cancel" "(N_ActionCancel)")
  48.       (setq ret (start_dialog)) ; ret will receive done_dialog value.
  49.       (unload_dialog dcl_id)
  50.     )
  51.   )
  52.   (if (= 1 ret)
  53.     (progn
  54.       (princ "\nUser has pressed OK. ")
  55.       (princ (strcat "\nFilename = " fnm " "))
  56.       ; etc.
  57.     )
  58.     (progn
  59.       (princ "\nUser cancelled. ")
  60.     )
  61.   )
  62.   (princ)
  63. )
  64.  

Code: [Select]
samp4 : dialog {
  label = "Structural Holes";
  : row {
    : radio_column {
      key = "flange";
      label = "Flange";
      : radio_button {key = "fla_wn";  label = "Welding Neck";}
      : radio_button {key = "fla_sw";  label = "Socket Weld";}
      : radio_button {key = "fla_so";  label = "Slip-on";}
      : radio_button {key = "fla_scr"; label = "Screwed";}
      : radio_button {key = "fla_bl";  label = "Blind";}
    }
    : boxed_radio_column {
      key = "face";
      label = "Face";
      : radio_button {key = "fac_rjt"; label = "RTJ";}
      : radio_button {key = "fac_rf";  label = "RF";}
      : radio_button {key = "fac_ff";  label = "Flat Face";}
    }
    : boxed_radio_column {
      key = "schedule";
      label = "Schedule";
      : radio_button {key = "sch_5";  label = "5";}
      : radio_button {key = "sch_10"; label = "10";}
      : radio_button {key = "sch_20"; label = "20";}
      : radio_button {key = "sch_30"; label = "30";}
      : radio_button {key = "sch_40"; label = "40";}
    }
    : boxed_radio_column {
      key = "class";
      label = "Class";
      : radio_button {key = "cla_150"; label = "150";}
      : radio_button {key = "cla_300"; label = "300";}
      : radio_button {key = "cla_400"; label = "400";}
      : radio_button {key = "cla_600"; label = "600";}
      : radio_button {key = "cla_900"; label = "900";}
    }
  }
  ok_cancel;
  : row {
    : image {key = "img"; aspect_ratio = 1.0; fixed_height = true; fixed_width = true; height = 2.0;}
    : paragraph {
      : text_part {value = "Designed and Created by Kenny Ramage";}
      : text_part {value = "Revised and updated by Roy_043";}
    }
  }
}
Title: Re: multiple radio buttons working together?
Post by: sln8458 on August 11, 2020, 04:10:39 AM
Hi All and thanks for the replies.

@DEVITG.
I do this for the challenge, not to make my working life simpler. However that may be a consequence of my actions.  :2funny:
As for re-inventing the wheel, been there & done that. I use these people now www.traceparts.com (http://www.traceparts.com)
For info, my first contact with a supplier for CAD files was in 1986,  :rip:

@ROY_043
Thanks for your help
I found reference to a 'radio_cluster' here -> https://www.theswamp.org/index.php?topic=50977.0 (https://www.theswamp.org/index.php?topic=50977.0) <-
but could not find any further info, I forget who posted it.

I see in your lisp that you have used (done_dialog 0) for the Cancel button and (done_dialog 1) for the OK button.
Can you explain the reasoning  behind this please, to help the novice - me  :uglystupid2:

Oh, I found where I went wrong with my attempt,  I had misplaced this statement  (setq fname (strcat flg face sch class ".dim"))

My next 'test' is to pass the concatenated file name into this:
Code: [Select]
  ;Find and open data file, *.dim
(defun OPEN_DIM_FILE ()
  (if (= NEWTILE "wnrf")
    (setq DIM_FILE (open (findfile "wnrf.dim") "r"))
  ) ;_ end of if
 ) ;end OPEN_DIM_FILE

atm, (wnrf) is a key in my dcl

I received a tender request yesterday, and as I've had no work since April I need to spend time with that so I will be 'awol' for a while.
Title: Re: multiple radio buttons working together?
Post by: roy_043 on August 11, 2020, 04:18:15 AM
I see in your lisp that you have used (done_dialog 0) for the Cancel button and (done_dialog 1) for the OK button.
Can you explain the reasoning  behind this please
See this line in the code:
Code - Auto/Visual Lisp: [Select]
  1. (setq ret (start_dialog)) ; ret will receive done_dialog value.
Title: Re: multiple radio buttons working together?
Post by: Dape on August 31, 2020, 03:43:16 AM
I see you mentioned PARTcommunity (PARTcloud) where you downloaded 3D models/parts.
They have new 3D portal called 3DfindIT.com, also free download (no your own upload, only download), excellent search engine, because you can find wanted models by shape, drawing, color, term, etc.
Here it is, maybe you can find more models you need there:

https://www.3dfindit.com/

Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 01, 2020, 11:15:17 AM
I have tried to incorporate  roy_43 suggestion, which I prefer to my original code. However I am struggling a bit.

I've attached the dcl & lsp files.

After selecting each of the 4 options, when I press the OK button I get this:-
Filename = __0_#_.dim "

When I'm expecting this:-
Filename = wn_rtj_sch_20_#300.dim

some of this code appears to work as I'm getting these "_"   "#"  ".dim" but none of the (get_tile) values. Oh and a rouge '0'
Code: [Select]
(setq fnm
      (strcat
        (substr (get_tile "flange") 5) ; "flange" is key of radio column, get_tile returns key of selected radio button.
        "_"
        (substr (get_tile "face") 5)
        "_"
         (get_tile "schedule")
        "_"
        "#"
        (substr (get_tile "class") 5)
        "_"
        ".dim"
      )
    ); end setq

Can anyone see where I'm going wrong please?

Steve
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 03, 2020, 10:10:13 AM
Well, I have moved on with other areas of the project.

But now I would like forum members thoughts please.

Which option do you think is better?
With the image on the left, both LH columns are selectable, and once an initial selection has been made only the relevant remaining options are available.
Whereas with the RH image you are forced to make an initial selection to gain access to the relevant options for your selection.
Does that even make sense?? :thinking:

(https://serving.photos.photobox.com/44406141754386bd8801173dce2c2f3e2ab5a600619b34a7b2fd0dfee4b477a38a9c2b41.jpg)

S.
Title: Re: multiple radio buttons working together?
Post by: roy_043 on September 03, 2020, 10:16:55 AM
Let's also look at a different issue:
In the Fittings and Flanges column, and also in the Select column, you are using buttons, when it would be more logical to use radios.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 03, 2020, 10:22:32 AM
Thanks Roy,

That is purely cosmetic really, also easily changed, but YES any comments appreciated.

S.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 03, 2020, 12:17:43 PM
Following Roys comments:

(https://serving.photos.photobox.com/43649829d201b733fdcf755bee353f9d5313b13c7aa1a08870b3c65fa27c0e4cdd63a4c6.jpg)

S.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 04, 2020, 11:49:48 AM
This is how the dialogue currently stands,

Any comments appreciated.

One question regarding the DCL, how can I evenly space the buttons in the FACE column?

(https://serving.photos.photobox.com/464189153776982f9455f085bdb52557ffb93a410d7e67c7a87a2801842e6ab7b3e90cdd.jpg)

But now onto the part I've been putting off, using the contents of my variable 'fname' to populate the list box

S.
Title: Re: multiple radio buttons working together?
Post by: BIGAL on September 04, 2020, 09:15:31 PM
Not sure if I stuffed up but added spacer_1 to dcl code. Its not staying open.

Code: [Select]
   : boxed_radio_column {
      key = "face";
      label = "Face";
      : radio_button {key = "fac_rjt"; label = "RTJ";}
spacer_1 ;
      : radio_button {key = "fac_rf";  label = "RF";}
spacer_1 ;
      : radio_button {key = "fac_ff";  label = "Flat Face";}
    }
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 05, 2020, 03:40:25 AM
Cheers Bigal,
This works for me, aligned with the Flange buttons in the LHcolumn.

Code: [Select]
: boxed_radio_column {
label = "Face" ;
 
: radio_button { key = "rb21" ; label = "RTJ"; is_enabled = false;}
        spacer;
: radio_button { key = "rb22" ; label = "RF" ; is_enabled = false;}
        spacer;
: radio_button { key = "rb23" ; label = "Flat Face" ; is_enabled = false;}
        spacer;
        spacer;
        spacer;
        spacer;
        spacer;
}

S.
Title: Re: multiple radio buttons working together?
Post by: roy_043 on September 05, 2020, 04:19:32 AM
That is purely cosmetic really
I disagree. There are no DCL buttons that stay pushed in (unless you create your own), so basically with the buttons solution there is no visual feedback for the user.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 05, 2020, 04:31:46 AM
Hmm,

Now you point that out Roy, you are of course correct, I had not noticed that :whistling:

(https://serving.photos.photobox.com/464189153776982f9455f085bdb52557ffb93a410d7e67c7a87a2801842e6ab7b3e90cdd.jpg)

Though it is not obvious in the image above, as you make a selection the next relevant column is turned ON. The same again each time you make a selection in a column. If you change your mind and go back to the start and select a different option, ALL previous selections are cleared & the columns turned off, including the variables in the lsp.

S.
Title: Re: multiple radio buttons working together?
Post by: BIGAL on September 05, 2020, 08:44:24 PM
Would a parent child dcl approach maybe be easier than turning off columns ?

Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 06, 2020, 07:37:20 AM
To be honest Bigal, I'm not sure?

I just creates sub's eg:-

Code: [Select]
(defun L3_ON ()
(mode_tile "rb21" 0)
(mode_tile "rb22" 0)
(mode_tile "rb23" 0)
)
(defun L3_CLEAR ()
(set_tile "rb21" "0")
(set_tile "rb22" "0")
(set_tile "rb23" "0")
)

Then call as required:)
[code]   (action_tile "s1" ;toggle Fitting options
(strcat
"(RESET_VARS)" "(L1_ON)" "(L2_OFF)" "(L3_OFF)" "(L4_OFF)" "(L5_OFF)"
"(L1_CLEAR)" "(L2_CLEAR)" "(L3_CLEAR)" "(L4_CLEAR)" "(L5_CLEAR)"
); end strcat
); END ACTION TILE
[/code]

A question for you, or anyone.

What is the equivalent function to GETVAR, for a local variable in my route?

eg     GETVAR 'fname

S.
Title: Re: multiple radio buttons working together?
Post by: BIGAL on September 06, 2020, 07:28:08 PM
Not sure about your question re local variable. You know what it is ?

If you use toggles rather than radio buttons they stay on but have disadvantage can pick more than one so would have to check others and turn them off.

Using the dcl child approach means can not see the next dcl's or open correct one.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 07, 2020, 03:58:02 AM
The code below highlights my 'current' problem/issue.

Code: [Select]
(defun OPEN_DIM_FILE ()
;    (setq DIM_FILE (open (findfile 'fname) "r"))  ;need variable 'fname' value here
;    (setq DIM_FILE (open (findfile (getvar fname)) "r")) ;need variable 'fname' value here
     (setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))              ;need variable 'fname' value here
 ) ;end OPEN_DIM_FILE

When I add the complete filename into the 'findfile' statement the code works.

However I want the read the value of my local variable 'fname' and place that into the 'findfile' statement.
Where fname is defined
Code: [Select]
   setq fname (strcat ftg flg fce sch clss ".dim"
S.
Title: Re: multiple radio buttons working together?
Post by: BIGAL on September 07, 2020, 08:46:12 PM
There are options to getfiled may need some of the extra switches. I dont use findfile very often tend to hard code a location like where dwg is. What happens when does not exist and where would it normally exist so no need for findfile as you know location.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 08, 2020, 10:43:30 AM
Well, I think I have found the issue with:-

Code: [Select]
(setq fname (strcat ftg flg fce sch clss ".dim"))
Using
Code: [Select]
(princ (strcat "\nFilename = " fname " "))Placed in a couple of locations in the code it appears that NONE of the variables are inheriting (?) their selected values until after the 'OK' button has been pressed.

For a novice, is this normal? can I change the code so that they inherit the value as it is chosen with the radio buttons?

I've attached a copy of my files for info
S.
Title: Re: multiple radio buttons working together?
Post by: roy_043 on September 09, 2020, 06:43:25 AM
You are running (setq fname ...) after (unload_dialog ...), so what you are seeing is to be expected. If you want to update the fname whenever a radio is modified you should add (setq fname ...) to each radio action. You would also have to look at the RESET_VARS function as strcat will fail if one of the parameters is nil.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 09, 2020, 07:36:05 AM
Hi Roy,

Thanks for the input.

I've commented out ( ; ) the RESET_VARS.
added a new defun
Code: [Select]
(defun F_NAME ()
(setq fname (strcat ftg flg fce sch clss ".dim"))
) end F_NAME

Code: [Select]
(defun OPEN_DIM_FILE ()
  (if (= NEWTILE "rb41") ;
;    (setq DIM_FILE (open (findfile "wnrf.dim") "r"))  ;need variable 'fname' value here
    (setq DIM_FILE (open (findfile fname) "r"))  ;need variable 'fname' value here
; (setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))  ;need variable 'fname' value here
  ) ;_ end of if
 ) ;end OPEN_DIM_FILE

Then modified a radio button (the schedule)
Code: [Select]
(action_tile "rb41"
(strcat
"(RB41_FLAG)" "(READ_DIM_FILE)" "(F_NAME)"
); end strcat
); END ACTION TILE

but this does not work :(

S.
Title: Re: multiple radio buttons working together?
Post by: roy_043 on September 09, 2020, 09:18:17 AM
Even for a person with limited Lisp knowledge it should be obvious why your code fails.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 09, 2020, 09:20:39 AM
Just to add a little more info.
I've added a princ statement in a couple of places:

Code: [Select]
(defun F_NAME ()
(setq fname (strcat ftg flg fce sch clss ".dim"))
) end F_NAME
    (princ (strcat "\nFilename after F_NAME = " fname " "))

Quote
(defun OPEN_DIM_FILE ()
;  (if (= NEWTILE "rb41")                                    ;
;    (setq DIM_FILE (open (findfile fname) "r"))                    ;need variable 'fname' value here
   (setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))     ;need variable 'fname' value here
;  ) ;_ end of if
 ) ;end OPEN_DIM_FILE
    (princ (strcat "\nFilename after open_dim_file = " fname " "))

plus the one after (unload_dialogue).

And this is what is reported at the command line:

Quote
Filename after F_NAME = 
Filename after open_dim_file = 
Command: samp4
Filename after unload_dialog = wn_rf_sch_20#300.dim
[/size]

action_tile rb41 is unchanged from above

S.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 09, 2020, 09:31:38 AM
Even for a person with limited Lisp knowledge it should be obvious why your code fails.

Oh  :wideeyed:

You have obviously found something! which narrows down my problem :) (I just wish I could see it)
the (setq fname (strcat ftg flg fce sch clss ".dim")) statement works as I get a filename after unload.
But I don't get any results from the other two?


S.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 09, 2020, 10:02:57 AM
Roy, can you show me where the problem is please? or point me in the right direction.
I've been fighting this for over a week now.

I feel like I'm in a forest but I cannot see any trees, (or icebergs as someone once said !)

S.
Title: Re: multiple radio buttons working together?
Post by: BIGAL on September 09, 2020, 07:47:26 PM
; semi colons in dcl have meanings also had problems just testing strcat something to with like unicode-8 etc. Should be able to just do the "(RB41_FLAG) (READ_DIM_FILE) (F_NAME)" no need for strcat.
Title: Re: multiple radio buttons working together?
Post by: roy_043 on September 10, 2020, 02:46:02 AM
Then modified a radio button (the schedule)
Code: [Select]
(action_tile "rb41"
(strcat
"(RB41_FLAG)" "(READ_DIM_FILE)" "(F_NAME)"
); end strcat
); END ACTION TILE

but this does not work :(
You have started out with code from www.afralisp.net, I advise you to follow more of their tutorials, you need more Lisp skills to finish this project.

As @BIGAL has pointed out you do not need strcat in the quoted code. But you do have to call the F_NAME function before using the filename in READ_DIM_FILE. And when using strcat to compose the filename the variables used have to contain strings, so you have to either initialize default string values or determine all of them by checking the current state of the dialog.

I personally would not attach actions to individual radios, I prefer to attach them to the radio columns or rows instead. But it seems that the writer of the AfraLISP DCL tutorials was unaware that this is possible.

For more tutorials check out: https://www.autolisp-exchange.com/
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 10, 2020, 04:01:42 AM
Thank you guys, your patience IS appreciated.


@BIGAL
I added
Code: [Select]
dcl_settings : default_dcl_settings { audit_level = 3; } (found on https://www.autolisp-exchange.com/)
The error log was mostly refering to text alignments, so I resolved those. There are a few remaining issues:

Quote
*** DCL semantic audit of samp4.dcl***

Warning in "samp4". (widget type = text, key = "n1")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n6")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n7")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n2")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n3")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n5")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n4")
    Text widgets need  a 'label' or a 'width'.

Warning in "samp4". (widget type = text, key = "n8")
    Text widgets need  a 'label' or a 'width'.

@ROY_43,
Quote
you need more Lisp skills to finish this project.
Oh so painfully true!
Thanks for the pointers.
Back to the library!!

S.



Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 10, 2020, 08:31:19 AM
Code: [Select]
(action_tile "rb41"
"(RB41_FLAG)(F_NAME)(READ_DIM_FILE)"
); END ACTION TILE

But you do have to call the F_NAME function before using the filename in READ_DIM_FILE.



Would simply changing the order as above be enough?

S.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 11, 2020, 03:52:48 AM
Ron,

Quote
And when using strcat to compose the filename the variables used have to contain strings, so you have to either initialize default string values or determine all of them by checking the current state of the dialog.

I am confused by this statement (I suspect you are not surprised ).

For each radio button I thought I had defined the variable as a string
eg
Quote
   (defun RB41_FLAG ()
   (setq sch "sch_5")                              ;store schedule rating
   );end rb41_flag
In this case when radio button 41 is selected the string "sch_5" is stored as the current value for the variable sch

where a string is defined as any group of characters  having quotation marks surrounding them to indicate that they are strings


As only 1 radio button in each column can be active, hence am I not "determine all of them by checking the current state of the dialog"

Could you explain a little more please?

S.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 15, 2020, 03:52:10 AM
Well I finally found the problem.
It was me all along, such a small thing caused me so much grief.

What was it? I had missed a '_' from the schedule string. (just as Roy had hinted at)

In the above example:
Code: [Select]
   (defun RB41_FLAG ()
   (setq sch "sch_5")                              ;store schedule rating
   );end rb41_flag

This now reads:
Code: [Select]
   (defun RB41_FLAG ()
   (setq sch "sch_5_")                              ;store schedule rating
   );end rb41_flag

Thanks
S.
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 18, 2020, 07:27:31 AM
I'm back for a bit more guidance please.

So far I have had simple Action Tiles, I now need to make some a little more complicated (for me!)

Example
Code: [Select]
(action_tile "rb31" ;toggle #300 option
"(L5_ON)(RB31_FLAG)"
); END ACTION TILE

Code: [Select]
(action_tile "rb31" ;toggle #300 option
      "(setq newtile $key)(RB31_FLAG)(F_NAME)(READ_DIM_FILE)"
); END ACTION TILE

Both of the above have been used as this project has progressed and both work as I expected.
Now I want to use both depending on a previous radio button selection (rb11)
Here is rb11 code
Code: [Select]
(defun RB11_FLAG ()
(setq flg "wn_") ;store flange type
);end rb11_flag


In words:
if the user selects rb11 I want to execute the first code above, and if rb11 is not selected (any of the other options selected) then I want to execute the second code above.

So here is what I have:
Code: [Select]
(action_tile "rb31" ;toggle #150 option
(if
(= flg wn_) ;if variable weldneck flange selected do this
(progn
(L5_ON)
(RB31_FLAG)
);end progn
;---------------------------;
; ;otherwise  if ANY of bl/so/scr/sl are set do this
(progn
(setq newtile $key)
(RB31_FLAG)
(F_NAME)
(READ_DIM_FILE)
);end progn
) ;_ end of if
); END ACTION TILE

When I select rb31 nothing happens!
Where have I gone wrong?
Can I actually do this?
Any help would be appreciated.

S.
Title: Re: multiple radio buttons working together?
Post by: roy_043 on September 18, 2020, 04:39:27 PM
Code - Auto/Visual Lisp: [Select]
  1.   "rb31"
  2.   "(if (= flg \"wn_\")
  3.    (progn
  4.      (L5_ON)
  5.      (RB31_FLAG)
  6.    )
  7.    (progn
  8.      (setq newtile $key)
  9.      (RB31_FLAG)
  10.      (F_NAME)
  11.      (READ_DIM_FILE)
  12.    )
  13.  )"
  14. )
Title: Re: multiple radio buttons working together?
Post by: sln8458 on September 19, 2020, 02:50:18 AM
Many thanks Roy.
Works a treat :)

S.