Radio Button Cluster Tile

#1
I am working on a new project where I have a 3 groups of radio buttons.
Flange Face (RTJ/RF)
Schedule (5-120)
Class (#150-#2500)
Image
.

While researching I found reference to a Radio Cluster Tile which would give a single value dependent of which radio button has been selected

Reply 1 here -> https://www.theswamp.org/index.php?topic=50977.0 <-
Unfortunately I can find no further info on the internet on how to implement this function.

Can anyone point me to some info on this function?

Thanks
Steve

Re: Radio Button Cluster Tile

#2
I scanned the internet for help on this and the nearest I came to was here
https://www.afralisp.net/dialog-control ... part-2.php

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

This is what I have,
Image

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
Attachments
samp4.zip
(1.63 KiB) Downloaded 40 times

Re: Radio Button Cluster Tile

#5
I have been away from this project for a few weeks due to work, but back on it now and I have a new problem.

I have attached the lsp & dcl files.

How I was intending this part to work:
The dialogue give the user a choice of fittings or flanges, the user selects which option they want.
From their initial selection the remaining buttons are switched on/off as appropriate to leave the user with only those options that are relevant.
So selecting any flange option will turn off all of the fittings buttons and turn on the radio buttons for 'face' / 'schedule' / 'class'.
Or selecting any fitting turns the 'flange' buttons off and turns on the 'schedule' radio button.
In this way the user can not make an inappropriate selection. This appears to work as intended :)

These selections are concatenated to for a file name for later use.
(setq fname (strcat ftg flg fce sch clss ".dim"))


The problem.
When I select any 'fitting' option/choice followed by the schedule the fitting selected does not appear when the Ok button is pressed, but the schedule does.
Can anyone see the error in my code??
Any help will be appreciated.

S.
Attachments
samp4-2.zip
(2.05 KiB) Downloaded 6 times

Re: Radio Button Cluster Tile

#8
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?
Image
.

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

I can do it when using a 'key' value from the DCL (ldct1 is a key value)

Code: Select all

(defun OPEN_DIM_FILE ()
  (if (= NEWTILE "ldct1")
    (setq DIM_FILE (open (findfile "ldct1.dim") "r"))
Here is an example for one group of selections stored in 'fname'
"sw_rtj_sch_30#300.dim"

S.

Re: Radio Button Cluster Tile

#9
I'm making slow progress, but I have not been able to resolve this one problem.
Passing the value of variable 'fname' to the following code.

Code: Select all

  ;Find and open data file, *.dim
(defun OPEN_DIM_FILE ()
;    (setq DIM_FILE (open (findfile fname) "r"))
	(setq DIM_FILE (open (findfile "WN_RF_SCH_5_#150.DIM") "r"))
;	(setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))  	;need variable 'fname' value here
 ) ;end OPEN_DIM_FILE
;   (princ (strcat "\nFilename after open_dim_file = " fname " "))
.
When I specify a specific file as in the code above (WN_RF_SCH_5_#150.DIM) everything works:
  • Command: samp4
    Filename after unload_dialog = "wn_rf_sch_5#150.DIM"
    Command: _.-insert
    ? to list blocks in drawing/BROWSE/EXPLORE/<Block to insert>: E:\CustomCad\Symbols\Piping\ANSI B16.9\wnrf-s-#150\WNRF_#150_SCH_5_10-3D.dwg
    Scale/X/Y/Z/Rotation/Multiple/<Insertion point for block>:
    Corner/XYZ/X scale factor <1.000000>:
    Y scale factor: < Equal to X scale (1.000000)>:
    Rotation angle for block <0>:
    Command: '_PMTHIST
.
However when I change to the code to

Code: Select all

 (setq DIM_FILE (open (findfile fname) "r"))
.
Nothing. :(

Any suggestions as to where I'm going wrong?
S.
Attachments
samp4-4.zip
(5.53 KiB) Downloaded 4 times

Re: Radio Button Cluster Tile

#14
Did you have OPEN_DIM_FILE set as below?

Code: Select all

(defun OPEN_DIM_FILE ()
    (setq DIM_FILE (open (findfile fname) "r"))
;	(setq DIM_FILE (open (findfile "WN_RF_SCH_5_#150.DIM") "r"))
;	(setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))
 ) ;end OPEN_DIM_FILE
If yes, that is the same problem I have.

If you reset to

Code: Select all

(defun OPEN_DIM_FILE ()
;    (setq DIM_FILE (open (findfile fname) "r"))
	(setq DIM_FILE (open (findfile "WN_RF_SCH_5_#150.DIM") "r"))
;	(setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))
 ) ;end OPEN_DIM_FILE
and place the dim files from the zip file posted into the search path and run lisp again you should see the expected result.
Image
S.

Re: Radio Button Cluster Tile

#15
As I suggested above, please check if the file_name is existing.

Code: Select all

  ;Find and open data file, *.dim
(defun OPEN_DIM_FILE ()
  (if (findfile fname)
    (setq DIM_FILE (open (findfile fname) "r"))
    (alert "File not found")	)					;need variable 'fname' value here)
;	(setq DIM_FILE (open (findfile "WN_RF_SCH_5_#150.DIM") "r"))
;	(setq DIM_FILE (open (findfile "wn_rf_sch_20_#300_.dim") "r"))  	;need variable 'fname' value here
 ) ;end OPEN_DIM_FILE