Using DCL to Manipulate Custom Properties

Using DCL to Manipulate Custom Properties

Anonymous
Not applicable
1,389 Views
2 Replies
Message 1 of 3

Using DCL to Manipulate Custom Properties

Anonymous
Not applicable

Hi I am trying to construct a GUI to manipulate custom properties in a more organized way for the population of formats. I was able to get the DCL to  load and have the appearance I desired and could get the property of "Drawing Number" to load into the field, but am having trouble getting the change to the field to be applied to the property. I have attached the Lisp and DCL code. Thank you, any help would be greatly appreciated.

(prompt "\nType TEST_DCL1 to run...")
(vl-load-com)
(defun C:TEST_DCL1 ()

(setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(setq db (vla-get-Database doc))
(setq si (vla-get-SummaryInfo db))

(setq pn (vla-GetCustomByKey si "Drawing Number" 'value3))

(setq dcl_id (load_dialog "test_dcl1.dcl"))
 
     (if (not (new_dialog "test_dcl1" dcl_id))
	 (exit )
     );if

(set_tile "PNo" value3)

(progn

(mode_tile "PNo" 1)

(action_tile "PNa" "(vla-SetCustomByKey si "Drawing Number" $value)"))

(start_dialog)

(unload_dialog dcl_id)
 
(princ)
 
);defun
(princ)
test_dcl1
 
: dialog
 
{
label = "Clerical Data Control Menu";
 
	: row {
	: column { width = 8;

		: text {label = "Part Number";}
		
		: text {label = "Drawing Type";}
		
		: text {label = "Part Name";}
		
		: text {label = "Cage Code";}
		
		: text {label = "Contract number";}
	}

	: column { width = 14;

		: edit_box {key = "PNo"; width = 10; value = "";}

	:row {
		: radio_button {label = "Printed Board"; key = PB; value = "0";}

		: radio_button {label = "Printed Board Assembly"; key = PBA; value = "0";}

		}

		: edit_box {key = "PNa"; width = 10;}

		: edit_box {key = "CaC"; width = 10;}

		: edit_box {key = "CNo"; width = 10;}
	}
	}
	ok_cancel;
	}
0 Likes
Accepted solutions (1)
1,390 Views
2 Replies
Replies (2)
Message 2 of 3

dlanorh
Advisor
Advisor

Not all properties are writeable, some are read only.

Use

(if (vlax-property-available-p your_obj T)
  (vlax-put-property"your_obj 'your_property new_value)
)

I can't be sure but I think most database objects are (RO) Read Only.

 

Try to find the "acadauto.chm" on your system. It's invaluable.

Try (vlax-dump-object your_obj T). This, like most lisp expressions, can be used on the command line by enclosing in brackets as shown. This dumps all the objects properties and methods to the text screen (F2). Anything marked (RO) is read only.

 

So select each in oreder below and copy and paste on the command line, and press enter

 

(vlax-dump-object (setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object))) T)
(vlax-dump-object (setq db (vla-get-Database doc)) T)
(vlax-dump-object (setq si (vla-get-SummaryInfo db)) T)

 

I am not one of the robots you're looking for

0 Likes
Message 3 of 3

Anonymous
Not applicable
Accepted solution

It displayed the properties as writable. I was able to find the solution to the code though. It appears the 2 sets of quotes in the  action tile command was tripping it up. So by setting the tile to a a variable and referencing it after the DCl unloads the code executed correctly. But thanks for the vlax-dump-object function that's something I didn't know about and will be greatly helpful going forward.

Working code: 

(prompt "\nType TEST_DCL1 to run...")
(vl-load-com)
(defun C:TEST_DCL1 ()

(setq doc (vla-get-ActiveDocument (vlax-get-Acad-Object)))
(setq db (vla-get-Database doc))
(setq si (vla-get-SummaryInfo db))

(setq dcl_id (load_dialog "test_dcl1.dcl"))

(vla-GetCustomByKey si "Drawing Number" 'value1)
(vla-GetCustomByKey si "Second Title" 'value3)
(vla-GetCustomByKey si "Cage Code" 'value4)
(vla-GetCustomByKey si "Contract Number" 'value5)

     (if (not (new_dialog "test_dcl1" dcl_id))
	(exit)
     );if

(set_tile "PNo" value1)
(set_tile "PNa" value3)
(set_tile "CaC" value4)
(set_tile "CNo" value5)


(action_tile "PNo" "(setq PNo $value)")
(action_tile "PNa" "(setq PNa $value)")
(action_tile "CaC" "(setq CaC $value)")
(action_tile "CNo" "(setq CNo $value)")

(start_dialog)

(unload_dialog dcl_id)

(vla-SetCustomByKey si "Drawing Number" PNo)
(vla-SetCustomByKey si "Second Title" PNa)
(vla-SetCustomByKey si "Cage Code" CaC)
(vla-SetCustomByKey si "Contract Number" CNo)

(princ)

)
(princ)
0 Likes