dcl

dcl

Anonymous
Not applicable
798 Views
1 Reply
Message 1 of 2

dcl

Anonymous
Not applicable

any one help a didnt get value from dcl

 

 

(defun c:test (/ b p1 p2)
(vl-load-com)

(setq l 1000)


(setq dcl_id (load_dialog "samp1.dcl"))
(if (not (new_dialog "samp1" dcl_id)

);not

(exit)
);if
(set_tile "eb1" "1000")
(mode_tile "eb1" 1)

(action_tile "eb1"
"(ebox_action $value $reason)")
(defun ebox_action (val why)
(if (or (= why 2) (= why 1))
(set_tile "eb1" val)))




(action_tile
"cancel"

"(done_dialog) (setq userclick nil)"
);action_tile

(action_tile
"accept"
(strcat
"(progn
(setq d1 (get_tile \"eb1\"))"
" (done_dialog)(setq userclick T))"
)
);action tile

(start_dialog)
(unload_dialog dcl_id)

 


(cond ((not (tblsearch "BLOCK" "PIPE"))
(alert "\"PIPE\" block is not available in current drawing."
)
)
((tblsearch "BLOCK" "PIPE")
(setq b (vla-insertblock
(vla-get-modelspace
(vla-get-activedocument (vlax-get-acad-object))
)
(vlax-3d-point p1)
"PIPE"
1.
1.
1.
0
)
)
(LM:setdynpropvalue b "Distance1" l)
)
)
)
(princ)
)

;; Set Dynamic Block Property Value - Lee Mac
;; Modifies the value of a Dynamic Block property (if present)
;; blk - [vla] VLA Dynamic Block Reference object
;; prp - [str] Dynamic Block property name (case-insensitive)
;; val - [any] New value for property
;; Returns: [any] New value if successful, else nil

(defun LM:setdynpropvalue (blk prp val)
(setq prp (strcase prp))
(vl-some
'(lambda (x)
(if (= prp (strcase (vla-get-propertyname x)))
(progn
(vla-put-value
x
(vlax-make-variant
val
(vlax-variant-type (vla-get-value x))
)
)
(cond (val)
(t)
)
)
)
)
(vlax-invoke blk 'getdynamicblockproperties)
)
)

 

 

 

 

samp1 : dialog {
label = "PVC pipe SCH40" ;


: edit_box { //define edit box
key = "eb1" ; //give it a name
label = "Pipe Length(mm)" ; //give it a label
edit_width = 6 ;
allow_accept = true; //6 characters only
} //end edit box


ok_cancel ;

}

 

0 Likes
799 Views
1 Reply
Reply (1)
Message 2 of 2

scot-65
Advisor
Advisor
There are three items I see that are not quite correct.

a) Calls to a function/subroutine where the function/subroutine is defined ABOVE the line that calls the function/subroutine. Place function above [new_dialog].

b) The tile called "eb1" is disabled. This means the tile cannot be selected. Action_tile is meaningless
unless the tile is enabled. No where in your program do you enable "eb1".
...(mode_tile "eb1" 1)
(action_tile "eb1"...
Perhaps you meant to (mode_tile "eb1" 2)?

c) action_tile only accepts a total of four quotes ["]. All statements for the second pair of quotes must be contained inside the second pair of quotes. If additional quotes are used, they must be escaped.
(action_tile "accept" (strcat "(progn (setq d1 (get_tile \"eb1\"))" " (done_dialog)(setq userclick T))"));action tile
"(strcat" is outside the second pair of quotes and there are two additional quotes that are not needed.
Also, strcat is not needed inside an action_tile.
Anything past done_dialog is not read. It should be the last statement inside the second pair of quotes.

???

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

0 Likes