Jump to content

Using multiple external data tables.


Don Mitchell

Recommended Posts

I'll preface by saying I'm a complete beginner at AutoLISP. I've been trying to teach myself the program using the tutorials on AfraLISP. So I successfully took the wide flange drawing program that Kenny Ramage used as a tutorial for using DCL dialog boxes and external data files and recast it as a program for drawing 150 lb serial A ANSI pipe flange plan views. All great and learned a lot. But I'd like to expand this program to draw other categories of flanges--300 lb, 400 lb, etc. as well as Series B, each with their own data files. So I tried to add a row of radial buttons for selecting those categories with if statements to use the selected data file, but can't get it to work. And the error that keeps popping up identifies the ok_cancel button code in the DCL file as "redefining the object". I'm completely flummoxed. Since I'm a neophyte, it's quite likely I messed up some of the other code -- I'm honestly using code I don't fully understand -- but I'm stumped at getting this particular error message about the ok_cancel command, since that same line of code is used in the simpler program that is working. For anyone interested in helping, I'm including 2 zip files with the .lsp, .dcl & .dat files bundled in each file required to run the program. The flgface.lsp is the working program, the flgfacetest.lsp the expanded one I can't get to work. Note that I have included changing layer commands in the drawing command lines to coincide with my company's layer conventions, so you will probably want to erase those lines of code before testing it out. Also note I've only made one data file for the test program -- the series A 150 lb (it's the same data file as the flgface program, just renamed to agree with the code) -- just for the purposes of testing the program.

flgfacetest.zip

flgface.zip

Link to comment
Share on other sites

So I tried to add a row of radial buttons for selecting those categories with if statements to use the selected data file, but can't get it to work. And the error that keeps popping up identifies the ok_cancel button code in the DCL file as "redefining the object".

 

hi don,

welcome to CAD forum

 

some dcl bracket misplaced (now fixed)

flgface : dialog {				//dialog name			
      label = "Flange Face.";			//dialog label
:boxed_radio_column {				//define radio column
      label = "Type of flange" ;		//give it a label

       : radio_button {			//define radion button
    	  key = "rb1" ;				//give it a name
    	  label = "Series A 150#" ;		//give it a label
    	  value = "1" ;				//switch it on
       }					//end definition

    	: radio_button {			//define radio button
    	  key = "rb2" ;				//give it a name
    	  label = "Series A 300#" ;		//give it a label
    	}					//end definition

    	: radio_button {			//define radio button
    	  key = "rb3" ;				//give it a name
    	  label = "Series A 400#" ;		//give it a label
    	  }					//end definition

    	: radio_button {			//define radio button
    	  key = "rb4" ;				//give it a name
    	  label = "Series A 600#" ;		//give it a label
    	}					//end definition

    	: radio_button {			//define radio button
    	  key = "rb5" ;				//give it a name
    	  label = "Series A 900#" ;		//give it a label
    	  }					//end definition

    	: radio_button {			//define radion button
    	  key = "rb6" ;				//give it a name
    	  label = "Series B 150#" ;		//give it a label
       }					//end definition

    	: radio_button {			//define radion button
    	  key = "rb7" ;				//give it a name
    	  label = "Series B 300#" ;	        //give it a label
       }					//end definition

       }					//end radio column

       : boxed_column {			//define boxed column
       label = "&Size";			//give it a label

    	: popup_list {				//define popup list
       key = "selections";			//give it a name
       value = "5" ;				//initial value
       }					//end list

      			}			//end boxed column


    ok_cancel ;			        //OK and Cancel Buttons
    :text_part {			        //Text Label
     label = "Designed by Kenny Ramage";
     }
    :text_part {			        //Text Label
     label = "created by Don Mitchell";
  }
}

 

1. many setq unbalanced/missing parentheses (.. )

2. list is a protected symbol

etc..

Link to comment
Share on other sites

Thanks. Obviously, I'm going to have to spend a lot more time on the basics of AutoLISP as I'm trying to use code the syntax of which I don't really understand. I have a simpler version of this working which just uses one data file. I have not been able to get the multiple data files selected by the radial buttons to work, probably because I'm trying to use the selection of the correct data file to modify the list of size selections that will load into the pop-up box. At one point I thought the solution would be to this part a separate lisp program that would use this selection to start another program--only to discover that you can't use one lisp program to start another lisp program. I'm just having a hell of a time getting a handle on AutoLISP syntax. I find the online tutorials and the books that I've purchased seriously lacking in this regard. Thanks again for your help.

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...