Author Topic: multiple radio buttons working together?  (Read 1318 times)

0 Members and 1 Guest are viewing this topic.

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
multiple radio buttons working together?
« 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.


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
There is no such  thing as a 'silly question' to those who do not know!

Lee Mac

  • Seagull
  • Posts: 12392
  • London, England
Re: multiple radio buttons working together?
« Reply #1 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.

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #2 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

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

This is what I have,




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
« Last Edit: August 07, 2020, 08:12:48 AM by sln8458 »
There is no such  thing as a 'silly question' to those who do not know!

DEVITG

  • Bull Frog
  • Posts: 448
Re: multiple radio buttons working together?
« Reply #3 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

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




Location @ Córdoba Argentina Using ACAD 2019  at Window 10

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #4 on: August 08, 2020, 01:10:58 AM »
Dynamic blocks are the way to go for bolts and screws etc.
A man who never made a mistake never made anything

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #5 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";}
    }
  }
}

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #6 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
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 <-
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.
There is no such  thing as a 'silly question' to those who do not know!

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #7 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.

Dape

  • Mosquito
  • Posts: 3
Re: multiple radio buttons working together?
« Reply #8 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/


sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #9 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
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #10 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:



S.
There is no such  thing as a 'silly question' to those who do not know!

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #11 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.

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #12 on: September 03, 2020, 10:22:32 AM »
Thanks Roy,

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

S.
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #13 on: September 03, 2020, 12:17:43 PM »
Following Roys comments:



S.
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #14 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?



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

S.
There is no such  thing as a 'silly question' to those who do not know!

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #15 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";}
    }
A man who never made a mistake never made anything

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #16 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.
There is no such  thing as a 'silly question' to those who do not know!

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #17 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.

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #18 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:



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.
« Last Edit: September 05, 2020, 04:35:12 AM by sln8458 »
There is no such  thing as a 'silly question' to those who do not know!

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #19 on: September 05, 2020, 08:44:24 PM »
Would a parent child dcl approach maybe be easier than turning off columns ?

A man who never made a mistake never made anything

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #20 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.
There is no such  thing as a 'silly question' to those who do not know!

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #21 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.
A man who never made a mistake never made anything

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #22 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.
There is no such  thing as a 'silly question' to those who do not know!

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #23 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.
A man who never made a mistake never made anything

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #24 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.
« Last Edit: September 08, 2020, 11:50:40 AM by sln8458 »
There is no such  thing as a 'silly question' to those who do not know!

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #25 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.

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #26 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.
There is no such  thing as a 'silly question' to those who do not know!

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #27 on: September 09, 2020, 09:18:17 AM »
Even for a person with limited Lisp knowledge it should be obvious why your code fails.

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #28 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.
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #29 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.
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #30 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.
There is no such  thing as a 'silly question' to those who do not know!

BIGAL

  • Swamp Rat
  • Posts: 516
  • 30 + years of using Autocad
Re: multiple radio buttons working together?
« Reply #31 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.
A man who never made a mistake never made anything

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #32 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/

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #33 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.



There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #34 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.
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #35 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.
« Last Edit: September 11, 2020, 03:56:15 AM by sln8458 »
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #36 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.
There is no such  thing as a 'silly question' to those who do not know!

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #37 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.
There is no such  thing as a 'silly question' to those who do not know!

roy_043

  • Water Moccasin
  • Posts: 1816
  • BricsCAD 18
Re: multiple radio buttons working together?
« Reply #38 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. )

sln8458

  • Newt
  • Posts: 47
  • CMS Intellicad 9.0
Re: multiple radio buttons working together?
« Reply #39 on: September 19, 2020, 02:50:18 AM »
Many thanks Roy.
Works a treat :)

S.
There is no such  thing as a 'silly question' to those who do not know!