Jump to content

Quick DCL Radio Button Question


RaverRabbit

Recommended Posts

Hello,

 

Just a quick question regarding set_tile and action_tile in DCL coding.

 

If I have used action_tile to define some commands to be run as soon as radio button is clicked, and then I use set_tile to activate that radio button, instead of actually clicking it, will those commands defined with action_tile still run?

 

I'm reluctant to post my code as it's extremely long and I only really need a yes or no answer. If the answers no I'll just code around it.

 

Many thanks in advance.

 

Rabbit.

Link to comment
Share on other sites

Hello,

 

Just a quick question regarding set_tile and action_tile in DCL coding.

 

If I have used action_tile to define some commands to be run as soon as radio button is clicked, and then I use set_tile to activate that radio button, instead of actually clicking it, will those commands defined with action_tile still run?

 

I'm reluctant to post my code as it's extremely long and I only really need a yes or no answer. If the answers no I'll just code around it.

 

Many thanks in advance.

 

Rabbit.

 

Set_tile will only set the button as the default tile. It will not act as the action_tiles enabler. Unless an action_tile is set to run a function that may be controlled by buttons nothing will happen unless OK or the default "accept" button is clicked.

 

(set_tile key value) Sets the value of a dialog box tile The key argument is a string that specifies the tile, and value is a string that names the new value to assign (initially set by the value attribute)

Link to comment
Share on other sites

Thanks very much, guess I'll just have to code around this issue.

I hope you did not misinterpret what I am implying. Set_tile will set a radio_button as a default. If an action_tile is set to this radio_button that is set to default the action to take place will not happen till OK is selected.

 

When I say that a radio_button is set to default, I mean only one button out of the group will be set to be the active button when the program starts up. When you click a new radio_button after that then that button becomes the active button and again the action will not take place till OK is selected.

Link to comment
Share on other sites

I hope you did not misinterpret what I am implying. Set_tile will set a radio_button as a default. If an action_tile is set to this radio_button that is set to default the action to take place will not happen till OK is selected.

 

When I say that a radio_button is set to default, I mean only one button out of the group will be set to be the active button when the program starts up. When you click a new radio_button after that then that button becomes the active button and again the action will not take place till OK is selected.

 

 

I'm using set_tile in a bit of a different way for this program.

 

I'm using set_tile as part of the action_tile arguments for a popup list to select a specific radio button from a radio column when an item is picked from that popup list.

What I have is a dialog window where the user inputs a series of parameters and then selects a start and end point to draw structural strut members. The program 3D models the strut and creates 2D views of it and the end result is a block containing both the 3D and 2D objects.

 

What I have also added to program is an option to create new struts based on existing ones (using Xdata attached to the blocks), instead of filling out all the parameters from scratch.

 

Basically I have a list of all the struts in the drawing, and selecting one from the list runs a sub-routine that will fill out the dialog box for the user, including selecting a connection type from a set of radio buttons. My problem is, using this method to activate a radio button seems to ignore the action_tile arguments attached to that radio button.

 

Also, I'm not sure if I'm missinterperating what your saying about no actions taking place until accept is clicked, but I am able to have actions take place imediately when a radio button is selected. At present I am setting variables, using Mode_tile to turn other tiles on and off and even running sub-routines as soon as the radio button is selected.

 

Perhaps it will be easier if I do post my code for your review, I have already worked around my initial problem

Link to comment
Share on other sites

I'm using set_tile in a bit of a different way for this program.

 

I'm using set_tile as part of the action_tile arguments for a popup list to select a specific radio button from a radio column when an item is picked from that popup list.

What I have is a dialog window where the user inputs a series of parameters and then selects a start and end point to draw structural strut members. The program 3D models the strut and creates 2D views of it and the end result is a block containing both the 3D and 2D objects.

 

What I have also added to program is an option to create new struts based on existing ones (using Xdata attached to the blocks), instead of filling out all the parameters from scratch.

 

Basically I have a list of all the struts in the drawing, and selecting one from the list runs a sub-routine that will fill out the dialog box for the user, including selecting a connection type from a set of radio buttons. My problem is, using this method to activate a radio button seems to ignore the action_tile arguments attached to that radio button.

 

Also, I'm not sure if I'm missinterperating what your saying about no actions taking place until accept is clicked, but I am able to have actions take place imediately when a radio button is selected. At present I am setting variables, using Mode_tile to turn other tiles on and off and even running sub-routines as soon as the radio button is selected.

 

Perhaps it will be easier if I do post my code for your review, I have already worked around my initial problem

 

That sounds interesting although I never gave any thought to a task like that. Do not accept my explanation as the only way to do this. I am trying to keep an open mind to your suggestion. I did not at first have enough information by you to go on. There are others here who work with DCL and may have a better answer for you. I guess you hear from someone in due time so wait it out.

 

Good luck and hope you find your answer,

The Buzzard

Link to comment
Share on other sites

This is the Action_tile for the popup

 

(action_tile "existingstruts" "(setq clone (nth (atoi $value) xdata-blocks))

(mode_tile \"accept\" 0)

(input-clone-data)")

 

This is the sub-routine:- input-clone-data

 

(defun input-clone-data()

(setq clonedata (cadr (assoc -3 (entget clone '("WADE"))))) ;find the x-data for the selected clone

(cond ((= (cdr (nth 2 clonedata)) "CHS")

(set_tile "CHS" "1")

(setq struttype "CHS")

(setq strutsize (cdr (nth 3 clonedata)) ;set variables from the x-data of the selected clone

endplth (cdr (nth 6 clonedata))

finplth (cdr (nth 7 clonedata))

boltsize (cdr (nth 8 clonedata))

contype (cdr (nth 9 clonedata))

gap (cdr (nth 10 clonedata))

boltdist (cdr (nth 11 clonedata))

sqrend (cdr (nth 12 clonedata))

boltno (cdr (nth 13 clonedata))

boltlayout (cdr (nth 14 clonedata)))

(setq size-list-location ( - (length chslist) (length (member strutsize chslist)))) ;find the location fo xdata variables within lists

(setq endp-list-location ( - (length endplthl) (length (member endplth endplthl))))

(setq finp-list-location ( - (length finplthl) (length (member finplth finplthl))))

(setq bolt-list-location (- (length boltl) (length (member boltsize boltl))))

(listile "strutsize" chslist) ;add the list of chs sizes to the strutsize popup tile

(set_tile "strutsize" (rtos size-list-location)) ;set the popups to the correct information based on the location of the varibales within their lists

(set_tile "endplth" (rtos endp-list-location))

(set_tile "finplth" (rtos finp-list-location))

(set_tile "boltdia" (rtos bolt-list-location))

(if gap

(set_tile "gap" gap)

(set_tile "gap" "")

);if

(if boltdist

(set_tile "boltdist" boltdist)

(set_tile "boltdist" "")

);boltdist

(set_tile contype "1")

(if sqrend

(set_tile "sqrend" sqrend)

(set_tile "sqrend" "")

);if

)

((= (cdr (nth 2 clonedata)) "SHS") ;if the clone is an SHS strut

(set_tile "SHS" "1")

(setq struttype "SHS")

(setq strutsize (cdr (nth 3 clonedata)) ;set variables from X-data of the selected clone

endplth (cdr (nth 6 clonedata))

finplth (cdr (nth 7 clonedata))

boltsize (cdr (nth 8 clonedata))

contype (cdr (nth 9 clonedata))

gap (cdr (nth 10 clonedata))

boltdist (cdr (nth 11 clonedata))

sqrend (cdr (nth 12 clonedata))

boltno (cdr (nth 13 clonedata))

boltlayout (cdr (nth 14 clonedata)))

(setq size-lits-location ( - (length shslist) (length (member strutsize shslist)))) ;find location of xdata parameters within lists

(setq endp-list-location ( - (length endplthl) (length (member endplth endplthl))))

(setq finp-list-location ( - (length finplthl) (length (member finplth finplthl))))

(setq bolt-list-location ( - (length boltl) (length (member boltsize boltl))))

(listile "strutsize" shslist) ;add the list of shs sizes to the strutsize popup tile

(set_tile "strutsize" (rtos size-list-location)) ;set the popups to the correct information based on the location of the variables within their lists

(set_tile "endplth" (rtos endp-list-location))

(set_tile "finplth" (rtos finp-list-location))

(set_tile "boltdia" (rtos bolt-list-location))

(if gap

(set_tile "gap" gap)

(set_tile "gap" "")

);if

(if boltdist

(set_tile "boltdist" boltdist)

(set_tile "boltdist" "")

);boltdist

(set_tile contype "1")

(if sqrend

(set_tile "sqrend" sqrend)

(set_tile "sqrend" "")

);if

)

);cond

 

The line (set_tile contype "1") is the line that turns on the radio button, where contype is a variable containing the tile key for whatever radio button is required.

 

These are some of the action_tile that need to run when the radio button is selected

 

(action_tile "1blt2clt" "(setq contype \"1blt2clt\")

(setq boltlayout \"cl\")

(setq boltno \"1\")

(mode_tile \"gap\" 0)

(mode_tile \"fit\" 1)

(mode_tile \"boltdist\" 1)")

 

(action_tile "2blt1cltcl" "(setq contype \"2blt1cltcl\")

(setq boltlayout \"cl\")

(setq boltno \"2\")

(mode_tile \"gap\" 1)

(mode_tile \"fit\" 1)

(mode_tile \"boltdist\" 0)")

 

(action_tile "2blt2cltcl" "(setq contype \"2blt2cltcl\")

(setq boltno \"2\")

(setq boltlayout \"cl\")

(mode_tile \"gap\" 0)

(mode_tile \"fit\" 1)

(mode_tile \"boltdist\" 0)")

 

(action_tile "2blt1cltoff" "(setq contype \"2blt1cltoff\")

(setq boltno \"2\")

(setq boltlayout \"offset\")

(mode_tile \"gap\" 1)

(mode_tile \"fit\" 0)

(mode_tile \"boltdist\" 0)")

 

 

These actions run imediately if a radio button is clicked, but when the radio button is selected during input-clone-data, they don't seem to run.

That contype variable does definatley work though and It is definately selecting the radio buttons though, as they visibley change on the dialog box.

 

Yes, I do re-use variable names for tile keys alot, this is a code a program I wrote before i learnt decent coding practice.

 

I'm not sure how to post my entire code as a ZIP

Link to comment
Share on other sites

I'm not sure how to post my entire code as a ZIP

 

On Advanced posting select the paperclip icon on midtop of your editor to attached the zip file. Personally I would think this is more of a coding issue than a radio_button/dcl type issue. There are some really smart people here that most likly can help you, But I think you should change the title of your thread to pertain to more of the coding side. You may get alot more responce that way.

 

(In short I would think that you would need the actions_tiles to run another function and pass arguments for the function to respond. I am not sure how to explain it, But that is how I might do it. As said I before, there are some smart people here.)

Link to comment
Share on other sites

Thanks for your help Buzzard, I have worked around it by adding an extra two variables to handle what I was strying to do and stored them in the X-data as well. Now instead of setting those variables with action_tile when I select the radio button, the are simply read straight from X-data, and the radio button is still selected purely for the visual notification of what connection type will be used.

If the cloning option is not used, the action_tile for the radio buttons simply created the two variables as before.

 

I have attached the lisp DCL and a text file database that is acessed by the program. so you can see what I was trying to acheive with the set_tile function.

 

Thanks again for your help.

Strut.zip

Link to comment
Share on other sites

Thanks for your help Buzzard, I have worked around it by adding an extra two variables to handle what I was strying to do and stored them in the X-data as well. Now instead of setting those variables with action_tile when I select the radio button, the are simply read straight from X-data, and the radio button is still selected purely for the visual notification of what connection type will be used.

If the cloning option is not used, the action_tile for the radio buttons simply created the two variables as before.

 

I have attached the lisp DCL and a text file database that is acessed by the program. so you can see what I was trying to acheive with the set_tile function.

 

Thanks again for your help.

 

I shall give it a look, This sounds real interesting.

Link to comment
Share on other sites

I shall give it a look, This sounds real interesting.

When I run it, This error appears at the prompt: ; error: bad argument type: stringp nil

 

I am not sure where the error is at this point. I would need to spend some time to get familar with the code.

 

Very Nice Format.

Your style is similar to mine.

Link to comment
Share on other sites

Thanks for your help Buzzard, I have worked around it by adding an extra two variables to handle what I was strying to do and stored them in the X-data as well. Now instead of setting those variables with action_tile when I select the radio button, the are simply read straight from X-data, and the radio button is still selected purely for the visual notification of what connection type will be used.

If the cloning option is not used, the action_tile for the radio buttons simply created the two variables as before.

 

I have attached the lisp DCL and a text file database that is acessed by the program. so you can see what I was trying to acheive with the set_tile function.

 

Thanks again for your help.

 

OK RaverRabbit,

 

I found the point at where the problem may begin in you program. In the STRUTBOX function I have two lines commented out. The dialog will now appear. I do not fully understand your code, So I cannot go much further than this. You now have a starting point to look for the problem. See the code below.

 

Here is the function:

(defun STRUTBOX ()            ;Runs and controls the main dialog window
(setq dcl_id (load_dialog "STRUT.dcl"))
 (if (not (new_dialog "STRUT" dcl_id) 
      );not
  (exit)
);if

;;--------- set tiles -----------            ;Turn off some key tiles at start of routine to stop userr from filling out unreq'd feilds
(mode_tile "strutsize" 1)                        ;turn off popup list for strut size
(mode_tile "gap" 1)              ;turn off edit box for gap between fin plates
(mode_tile "boltdist" 1)             ;turn off edit box for distance between bolt centers if two bolts req'd
(mode_tile "accept" 1)              ;Turn off the OK button to stop users from cliking it before filling out Key information
(mode_tile "fit" 1)              ;Turn off the toggle for maximising the distance between bolt centers if two bolts req'd
(mode_tile "existingstruts" 1)             ;turn off the popup list for existing struts
(mode_tile "selectclone" 1)             ;turn off the button to select a clone from the DWG (currently infomation button)
(setq byline "Written By Peter Hill for Wade Consulting Group")                     ;Set By Line
(setq finplthl (list "6" "8" "10" "12" "16" "20" "24" "30" "36" "40" "50" "65")      ;Set up lists for popup menu's
      endplthl (list "6" "8" "10" "12" "16" "20" "24" "30" "36" "40" "50" "65")
      boltl (list "M10" "M12" "M16" "M20" "M24" "M30" "M36" "M42" "M56"))
(setq contype "1blt1clt"             ;Set up defaults for variables
      boltno "1"
      boltlayout "cl"
      sqrend nil)
(setq sname nil)              ;Set Strut name to nil
(listile "finplth" finplthl)              ;enter Fin plate thickness list to popup
(listile "endplth" endplthl)             ;enter endplate thickness list to popup
(listile "boltdia" boltl)             ;enter bolt diameter list to popup
(if existingstruts              ;if a slist of existing struts with X-data has been found
(progn
(listile "existingstruts" existingstruts)           ;apply this list to the popup for existing struts
);progn
);if
(set_tile "byline" byline)             ;set the byline on the DCL window
(set_tile "version" version)             ; set the version ont he DCL window
(setq strutfile (findfile              
                 "K:/SUPPORT/LISP/applications/tubedata.txt"))         ;find the tube size text file database
; (setq fp (open strutfile "r"))
; (setq line (read-line fp))
(setq shslist nil              ;ensure all variables for data from text file are empty
      chslist nil
      shsdata nil
      chsdata nil)
 (while line (if (= line "*CHS")                        ;loops through lines in text file until conditions are met : -if the variable line reads *CHS 
                (setq chsdata (read-line fp)           ;Set the next line as chsdata
                      line (read-line fp))           ;Set the following line as the variable line
                (setq line (read-line fp))           ;if the variable did not read CHS, set the variable to the following line
             );if      
             (if (= line "*SHS")            ;if the variable line reads *SHS        
                (setq shsdata (read-line fp)           ;Set the next line as shsdata
                      line (read-line fp))           ;set the following line as the variable line
                (setq line (read-line fp))           ;if the varible did not read shs, set the variable to the following line
             );if         
 );while
(if chsdata               ;if chdata exists
   (create-chslist)              ;run the sub-routine create-chslist to create a usable list from chsdata
);if
(if shsdata               ;if shsdata exists
   (create-shslist)              ;run the sub-routine create-shslist to create a usable list from shsdata
);if



;;------- define actions ----------
(action_tile "CHS" "(setq struttype \"CHS\")           
                    (listile \"strutsize\" chslist)
                    (mode_tile \"accept\" 0)
                    (mode_tile \"strutsize\" 0)")
(action_tile "SHS" "(setq struttype \"SHS\")
                    (listile \"strutsize\" shslist)
                    (mode_tile \"accept\" 0)
                    (mode_tile \"strutsize\" 0)")

(action_tile "1blt1clt" "(setq contype \"1blt1clt\")
   (setq boltlayout \"cl\")
   (setq boltno \"1\")
    (mode_tile \"gap\" 1)
    (mode_tile \"fit\" 1)
    (mode_tile \"boltdist\" 1)")

(action_tile "1blt2clt" "(setq contype \"1blt2clt\")
   (setq boltlayout \"cl\")
                        (setq boltno \"1\")
    (mode_tile \"gap\" 0)
    (mode_tile \"fit\" 1)
    (mode_tile \"boltdist\" 1)")

(action_tile "2blt1cltcl" "(setq contype \"2blt1cltcl\")
      (setq boltlayout \"cl\")
                        (setq boltno \"2\")
    (mode_tile \"gap\" 1)
    (mode_tile \"fit\" 1)
    (mode_tile \"boltdist\" 0)")

(action_tile "2blt2cltcl" "(setq contype \"2blt2cltcl\")
                        (setq boltno \"2\")
                        (setq boltlayout \"cl\")
    (mode_tile \"gap\" 0)
    (mode_tile \"fit\" 1)
    (mode_tile \"boltdist\" 0)")

(action_tile "2blt1cltoff" "(setq contype \"2blt1cltoff\")
                          (setq boltno \"2\")
                          (setq boltlayout \"offset\")
      (mode_tile \"gap\" 1)
      (mode_tile \"fit\" 0)
      (mode_tile \"boltdist\" 0)")

(action_tile "2blt2cltoff" "(setq contype \"2blt2cltoff\")
                          (setq boltno \"2\")
                          (setq boltlayout \"offset\")
      (mode_tile \"gap\" 0)
      (mode_tile \"fit\" 0)
      (mode_tile \"boltdist\" 0)")

(action_tile "activateclone" "(find-xdata-struts)
           (if existingstruts
           (listile \"existingstruts\" existingstruts)
           );if
           (if xdata-blocks
           (mode_tile \"selectclone\" 0)
           );if
          (if (= $value \"0\")
        (progn
        (mode_tile \"membertype\" 0)
          (mode_tile \"strutsize\" 0)
          (mode_tile \"connectiontype\" 0)
          (mode_tile \"inputparameters\" 0)
        (mode_tile \"existingstruts\" 1)
        (mode_tile \"selectclone\" 1)
          );progn
          (progn
          (mode_tile \"membertype\" 1)
          (mode_tile \"strutsize\" 1)
          (mode_tile \"connectiontype\" 1)
          (mode_tile \"inputparameters\" 1)
          (mode_tile \"existingstruts\" 0)
          );progn
          );if
          ")
(action_tile "makexref" "(setq makexref \"yes\")")
(action_tile "existingstruts" "(setq clone (nth (atoi $value) xdata-blocks))
         (mode_tile \"accept\" 0)
           (input-clone-data)")

(action_tile "makeblock" "(setq makexref nil)")

(action_tile "fit" "(mode_tile \"boltdist\" 1)")
(action_tile "selectclone" "(alert \"
\n
'Clone' Will Allow you to select an existing strut and create another one using the same input parameters, instead of filling them all out again. 'Cloning' will create SIMILAR struts using the same Parameters as existing struts, not copies of existing struts.  You should name Similar struts with similar names.
\n
      E.g. Selecting 'S1-A' would mean you should name the clone
           'S1-B' or the next avaliable letter for 'S1 .
\n
You should also check to see if you have created a clone of identical length as the existing strut it was cloned from, if so, then these struts should have EXACTLY the same name and you will need to COPY the existing strut, not clone it.  The program will soon have the ability to find such an instance for you, warn you, and automatically create a copy as opposed to a clone.
\n
STRUT will also soon have the ability to search the drawing for existing struts when you click OK & If it finds a strut with the same parameters as what you have entered, and notify you that it has found a possible clone, and prompt you to use a name relevant to that existing strut.  As with specifying a clone, this search function will also check lengths to see if identical struts are being created and create a copy as opposed to a clone.
This Feature is NOT currently avaliable, but will be added soon.                 
\n                
\"
                        )")



(action_tile "accept" "(storeval)(done_dialog)")

(action_tile "cancel" "(exit)")

;;;----------- run dialog ----------
(start_dialog)
(unload_dialog dcl_id)
(princ)
);defun STRUTBOX

 

Here are the two lines commented out:

; (setq fp (open strutfile "r"))
; (setq line (read-line fp))

 

Here was the error before I commented those two lines: ; error: bad argument type: stringp nil

 

 

Hope this is some help.

 

Good Luck,

The Buzzard

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...