Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

dialog causes lockup

3 REPLIES 3
Reply
Message 1 of 4
r-t-design
508 Views, 3 Replies

dialog causes lockup

new to the dialog boxes. Been trying a routine and failing. Can't figure out why.
The routine opens the dialog, which should allow me to pick 1 out of 3 blocks to instert and to define the scale of the block, text to be inputed, and the text style to be used. The idea was planed to first define defaults for the dialog. Once the dialog is opened I could change or except the defaults. It should then insert the selected block and print the text. If the lisp file is executed a second time it should use the last values used as the defaults. So far all I can do is call up the dialog box, change my inputs or leave them as default, but once I select OK autocad locks up.

 

tree.dsl file

tree : dialog {
label = "Tree Style Insert";
  : row {
	: boxed_column {
	label = "Type of Tree to Insert";
		: radio_column {
			: radio_button {
				label = "Pine";
				key = "pine";
				mnemonic = "P";
			}
   	     		: radio_button {
				label = "Oak";
				key = "oak";
				mnemonic = "O";
			}
			: radio_button {
				label = "Juniper";
				key = "juniper";
				mnemonic = "J";
			}
		}
	}
	: boxed_column {
		: edit_box {
			label = "Scale of Tree";
			key = "scl";
			mnemonic = "S";
			edit_width = 7;
		}
		: edit_box {
			label = "Text for Tree";
			key = "txt";
			mnemonic = "T";
			edit_width = 7;
		}
		: edit_box {
			label = "Text Style";
			key = "ts";
			mnemonic = "X";
			edit_width = 7;
		}
	}
  }
  ok_cancel;
}

 

tree.lsp file

 

(defun c:tree (/ dcl_id)
  (setq dcl_id (load_dialog "tree.dcl"))
  (if  (not (new_dialog "tree" dcl_id))
    (exit)
  )
  (if (= loop nil)(setdef)(setdef2))
  (action_tile "accept" "(setvals) (done_dialog)")
  (start_dialog)
  (princ)
)

;;; Sets defaults ;;;
(defun setdef ()
  (setq tree "pine"
	tscl 12
	ttxt 12  ;(strcat "12" (chr 34))
	tts "DIM")
  (set_tile "pine" "1")
  (set_tile "scl" (rtos 12 2 0))
  (set_tile "txt" "12");(strcat "12" (chr 34)))
  (set_tile "ts" "DIM")
  (princ)
)

;;;  ReDefine Defaults ;;;
(defun setdef2 ()
  (setq txt (strcat "12" (chr 34)))
  (if (= tree "pine")(set_tile "pine" "1"))
  (if (= tree "oak")(set_tile "oak" "1"))
  (if (= tree "juniper")(set_tile "juniper" "1"))
  (set_tile "scl" (rtos tscl 2 0))
  (set_tile "txt" ttxt)
  (set_tile "ts" tts)
  (princ)
)

;;; Sets values and inserts ;;;
(defun setvals ()
  (action_tile "pine" "(setq tree $key)")
  (action_tile "oak" "(setq tree $key)")
  (action_tile "juniper" "(setq tree $key)")
  (setq tscl (atof (get_tile "scl")))
  (setq ttxt (get_tile "txt"))
  (setq tts (get_tile "ts"))
  (command "insert" tree "s" tscl pause "")
  (command "text" "s" tts pause "" ttxt)
  (setq loop 1)
  (princ)
)

 



as a note, tree.lsp file in in c:/program files/autocad.../lispfile folder, which is called to in autocad. it is where all my lisp files are stored and autoloaded from. and the tree.dcl file is in the Express folder. I originally saved it in the Lispfile folder, but for some reason it would not load from there, but did load once I saved it to the Express folder. But now it crashed all the time. I even tried putting tree.lsp file in the Express folder, but did not change the results. Still crashed.

3 REPLIES 3
Message 2 of 4
devitg
in reply to: r-t-design

Please upload a the sample dwg , in ACAD2008 or less
Message 3 of 4

Looks like you are missing quotation marks in the line

	ttxt 12  ;(strcat "12" (chr 34))

 

SET_TILE expects strings, not integers.

 

--

 

Message 4 of 4
r-t-design
in reply to: r-t-design

Yes I missed that one.  Final line reads (setq ttxt "12\"").  thanks for that

 

Here is a sample of the tree dwg.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost