- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm trying to create a dialog box to draw a circle which have 2 choice. First one is 2 point (2p) to draw a circle and the other is 1 point and radius. I create a radio list for that. What I want is when I click on 1 choice and another dialog box open and you can enter data on that dialog box and then when you click Ok. Autocad execute the command of drawing a circle. But my lsp and dcl codes don't work. Can sb explain to me? Here is my lsp and dcl code:
LSP code:
(defun C:selena(/ dcl_id userclick)
(if (not (setq dcl_id (load_dialog "selena.dcl")))
(progn
(princ"\n dcl file can not be loaded")
(exit)
)
(progn
(if (not (new_dialog "selena" dcl_id))
(progn
(princ"\n the definition can not be loaded")
(exit)
)
(progn
(action_tile "2point" "(setq choice1 (atoi(get_tile \"2point\")))")
(action_tile "center_radius" "(setq choice2 (atoi(get_tile \"center_radius\")))")
(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(set userclick (start_dialog))
(unload_dialog dcl_id)
(if userclick
(progn
(if (= choice1 1)
(defun gomez (/ dcl_id1 userclick)
(if (not (setq dcl_id1 (load_dialog "gomez.dcl")))
(progn
(princ"\n dcl file cann't be loaded")
(exit)
)
(progn
(if (not (new_dialog "gomez" dcl_id1))
(progn
(princ"\n the definition can not be loaded")
(exit)
)
(progn
(action_tile "X1" "(setq X1 (atof(get_tile \"X1\")))")
(action_tile "Y1" "(setq Y1 (atof(get_tile \"Y1\")))")
(action_tile "X2" "(setq X2 (atof(get_tile \"X2\")))")
(action_tile "Y2" "(setq Y2 (atof(get_tile \"Y2\")))")
(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq userclick (start_dialog))
(unload_dialog dcl_id1)
(if userclick
(progn
(command "circle" "2p" (list X1 Y1) (list X2 Y2))
)
(progn
(alert"\n exit the program")
)
)
)
)
)
)
)
)
(if (= choice2 1)
(progn
(defun superman(/ dcl_id2 userclick)
(if (not (setq dcl_id2 (load_dialog "superman.dcl")))
(progn
(princ"\n dcl file can not be loaded")
(exit)
)
(progn
(if (not (new_dialog "superman" dcl_id2))
(progn
(princ"\n the definition can not be loaded")
(exit)
)
(progn
(action_tile "X" "(setq X (atof(get_tile \"X\")))")
(action_tile "Y" "(setq Y (atof(get_tile \"Y\")))")
(action_tile "radius" "(setq radius (atof(get_tile \"radius\")))")
(action_tile "accept" "(done_dialog 1)")
(action_tile "cancel" "(done_dialog 0)")
(setq userclick (start_dialog))
(unload_dialog dcl_id2)
(if userclick
(progn
(command "circle" (list X Y) radius )
)
(progn
(alert"\n exit the program")
)
)
)
)
)
)
)
)
)
)
(progn
(alert"\n exit the program")
)
)
)
)
)
)
)
DCL code 1 :
selena
:dialog{
:boxed_column{
:boxed_radio_column{
:radio_button{
key="2point";
label="select 2 point on plane";
}
:radio_button{
key="center_radius";
label="select center and radius";
}
}
:row{
:button{
key="accept";
label="ok";
is_default=true;
is_cancel=true;
}
:button{
key="cancel";
label="cancel";
is_default=true;
is_cancel=true;
}
}
}
}
DCL code 2:
gomez
:dialog{
:boxed_column{
:row{
:edit_box{
key="X1";
label="X1";
}
:edit_box{
key="Y1";
label="Y1";
}
}
:row{
:edit_box{
key="X2";
label="X2";
}
:edit_box{
key="Y2";
label="Y2";
}
}
:row{
:button{
key="accept";
label="ok";
is_default=true;
is_cancel=true;
}
:button{
key="cancel";
label="cancel";
is_default=true;
is_cancel=true;
}
}
}
}
DCL code 3 :
superman
:dialog{
:boxed_column{
:row{
:edit_box{
key="X";
label="X";
}
:edit_box{
key="Y";
label="Y";
}
}
:edit_box{
key="radius";
label="radius";
}
:row{
:button{
key="accept";
label="ok";
is_default=true;
is_cancel=true;
}
:button{
key="cancel";
label="cancel";
is_default=true;
is_cancel=true;
}
}
}
}
Solved! Go to Solution.