Error in Startup Routine

Error in Startup Routine

Anonymous
Not applicable
985 Views
2 Replies
Message 1 of 3

Error in Startup Routine

Anonymous
Not applicable

Hello all,

I am trying to write a code for a startup routine that collects all relevant data and creates custom drawing properties so that I can use them as fields where they are needed. This is all so that when new interns arrive, their transition to CAD can be easier. 

The code is really simple, but I am new to LISP and DCL so I am sure that the solution is flying over my head. 

;;; start of lisp code
(defun C:TEST_DCL1 () ;begin dialog function (setq dcl_id (load_dialog "test_dcl1.dcl")) ;loads dialog (if (not (new_dialog "test_dcl1" dcl_id)) ;checks the functionality of dialog (exit ) );if (action_tile "P_Add" "(setq address $value)") ;assigns users address to variable "address" (action_tile "P_City" "(setq city $value)") ;" " (action_tile "P_State" "(setq state $value)") ;" " (action_tile "P_ZIP" "(setq zip $value)") ;" " (action_tile "Clark" "(setq county \"Clark County\")") ;next few lines determine the county selected (action_tile "CLV" "(setq county \"City of Las Vegas\")") ; (action_tile "CNLV" "(setq county \"City of North Las Vegas\")") ; (action_tile "Hendotucky" "(setq county \"City of Henderson\")") ; (action_tile "ModMan" "(setq moduleman $value)") ;assigns users inputs to module variables (action_tile "ModMo" "(setq modulemod $value)") ; (action_tile "ModWatt" "(setq modulepow $value)") ; (action_tile "InvMan" "(setq inverterman $value)") ;assings users input to inverterman (action_tile "240Volt" "(setq sysvolt \"240V\")") ;determine the system voltage (action_tile "208Volt" "(setq sysvolt \"208V\")") ; (action_tile "480Volt" "(setq sysvolt \"480V\")") ; ;;; setting drawing properties to the values collected by the dialog box. (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object))) ;accessing drawing properties (setq db (vla-get-Database doc)) ; (setq si (vla-get-SummaryInfo db)) ; ;;; (vla-getCustomByKey si "Project_Address") (vla-SetCustomByKey si "Project_Address" address) ;error is somewhere here (vla-SetCustomByKey si "Project_City" city) ; (vla-SetCustomByKey si "Project_State" state) ; (vla-SetCustomByKey si "Project_ZIP_Code" zip) ; (vla-SetCustomByKey si "Project_County" county) ; (vla-SetCustomByKey si "Module_Manufacturer" moduleman) ; (vla-SetCustomByKey si "Module_Model_#" modulemod) ; (vla-SetCustomByKey si "Module_Peak_Power" modulepow) ; (vla-SetCustomByKey si "Inverter_Manufacturer" inverterman) ; (vla-SetCustomByKey si "System_Voltage" sysvolt) ; (action_tile "accept" "(done_dialog)" );action_tile (start_dialog) (unload_dialog dcl_id) (princ) );defun ;;; end of lisp code
//start of dcl code
test_dcl1 : dialog
{						//Start dialog box
	: row						//Address/County row caller
	{						//Row OPEN
	 label = "Project Information";			//Label of main Prject Information column
	      : boxed_column				//Address main column caller
	        {					//Address Main column OPEN
	        label = "Project Address";		//Address Main label
		        : edit_box			//Address edit box caller
		        {				//Address edit box OPEN
		        label = "Project Address";	
		        mnemonic = "A";
		        key = "P_Add";
		        edit_limit = 60;
		        edit_width = 30;
		        }         			//Address edit box CLOSE
		        : edit_box			//City edit box caller
		        {				//City edit box OPEN
		        label = "Project City";
		        mnemonic = "C";
		        key = "P_City";
		        edit_limit = 60;
		        edit_width = 30;
		        }				//City edit box CLOSE
		        : edit_box			//Sate edit box caller
		        {				//State edit box OPEN
		        label = "Project State";
		        mnemonic = "S";
		        key = "P_State";
		        edit_limit = 30;
		        edit_width = 15;
		        alignment = left;
		        }				//State edit box CLOSE
		        : edit_box			//ZIP Edit box caller
		        {				//ZIP Edit box OPEN
		        label = "Project Zip Code";
		        mnemonic = "Z";
		        key = "P_ZIP";
		        edit_limit = 5;
		        edit_width = 5;
		        alignment = left;
	        	}				//ZIP Edit box CLOSE
	      	}					//Address Main Column CLOSE
	      
	        : boxed_radio_column			//Radio column caller
	        {					//Radio column OPEN
	        label = "Project County";
		        : radio_button			//CC radio button caller
		        {				//CC radio button OPEN
		        key = "Clark";
		        label = "Clark County";
		        value = "1";			//CC SELECTED BY DEFAULT
		        }				//CC radio button CLOSE
		        : radio_button			//CLV radio button caller
		        {				//CLV radio button OPEN
		        key = "CLV";
		        label = "City of Las Vegas";
		        }				//CLV radio button CLOSE
		        : radio_button			//CNLV radio button caller
		        {				//CNLV radio button OPEN
		        key = "CNLV";			
		        label = "City of North Las Vegas";
		        }				//CNLV radio button CLOSE
		        : radio_button			//Hend radio button caller
		        {				//Hend radio button OPEN
		        key = "Hendotucky";
		        label = "City of Henderson";
		        }				//Hend radio button CLOSE
	        }					//Radio column CLOSE
	}						//Row CLOSE

	: row						//Array Info Row caller
	{						//Array row OPEN
	label = "Array Information";
		: boxed_column				//Module column caller
		{					//Module column OPEN
		label = "Solar Modules";
			: edit_box			//Mod Manufac caller
			{				//ModMan OPEN
			key = "ModMan";
			label = "Module Manufacturer";
			edit_limit = 30;
			edit_width = 30;
			}				//ModMan CLOSE
			: edit_box			//ModMo caller
			{				//ModMo OPEN
			key = "ModMo";
			label = "Module Model #";
			edit_limit = 30;
			edit_width = 30;
			}				//ModMo CLOSE
			: edit_box			//ModWatt caller
			{				//ModWatt OPEN
			key = "ModWatt";
			label = "Module Peak Power [STC]";
			edit_limit = 4;
			edit_width = 4;
			}				//ModWatt CLOSE
		}					//Module Column CLOSE
		: boxed_column				//Inverter column caller
		{					//Inverter cloumn OPEN
		label = "Inverter";
			: edit_box			//InvMan Caller
			{				//InvMan OPEN
			key = "InvMan";
			label = "Inverter Manufacturer";
			edit_limit = 30;
			edit_width = 30;
			}				//InvMan CLOSE
				: boxed_radio_row	//Volt Row Caller
				{			//Volt OPEN
				label = "System Voltage";
					: radio_button		//240Volt Button Caller
					{			//240Volt button OPEN
					key = "240Volt";
					label = "240V";
					}			//240Volt button CLOSE
					: radio_button		//208Volt Button Caller
					{			//208Volt button OPEN
					key = "208Volt";
					label = "208V";
					}			//208Volt button CLOSE
					: radio_button		//480Volt Button Caller
					{			//480Volt button OPEN
					key = "480Volt";
					label = "480V";
					}			//480Volt button CLOSE
				}			//Volt Row CLOSE
				
		}					//Inverter cloumn CLOSE
	}						//Array info row CLOSE
: button						//exit button caller
{							//exit button OPEN
key = "accept";						
label = "Let's get to drawing.";
is_default = true;
fixed_width = true;
alignment = centered;
}							//exit button CLOSE

: paragraph 						//paragraph caller
{							//paragraph OPEN
	: text_part					//text1 caller
	{						//text1 OPEN
	label = "This information is being stored in the Drawing Properties.";
	alignment = centered;
	is_bold = true;
	}						//text1 CLOSE
	: text_part					//text2 caller
	{						//text2 OPEN
	label = "To change any information in the future type [dwgprop] and press [ENTER]";
	alignment = centered;
	is_bold = true;
	}						//text2 CLOSE
}							//paragraph CLOSE
	
}							//Dialog CLOSE
//end of DCL code

I marked in the code where I believe the issue to be. It is throwing "; error: too few actual parameters" at me. I have gotten this to work a few times. But all of a sudden it just stopped working. 

 

Any help is greatly appreciated. 

0 Likes
Accepted solutions (1)
986 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

I have found the error. I noticed when i reverted back to a previous version of the code that my inputs were delayed. The inputs would from running the routine the first time would appear in the DWGProps after I ran the routine a second time with different inputs. 

 

So I pulled the VLA commands out of the dialog function and now it works properly. On to the next step.

0 Likes
Message 3 of 3

scot-65
Advisor
Advisor
I see three items that may become an issue if these
poor habits are carried over to your next utility.

a) Don't need all those action_tile. Instead, make a call to a
function that will gather all the data at once when the user
commits to the dialog being correct when pressing the OK button.
Think of it as taking a screen capture when everything is correct.

(action_tile "accept" "(MyProgram_GET)(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)") ;<-- is missing from both LSP and DCL

b) Do not execute any code between new_dialog and start_dialog.
(setq sd (start_dialog)) will catch the integer return of done_dialog.
Below the start_dialog is when one executes code:
(if (and sd (> sd 0))
(progn
;<<-- Execute Code Here -->>
);progn
);if

c) Communicate with to the radio_column container and not the radio_buttons.
Add a key to each radio column/row container and when gathering
the information, get_tile that container's key. One will have to convert
later on what the key value means, but that can be at the GET stage
or in the execute section. One can initialize a radio_button by making a call
to the container in your set_tile section of the LISP:
(set_tile "ProjCounty" "Clark")
Remove value=1; from the DCL.

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes