Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/21/2024 in all areas

  1. @DeEng I suggest the following code instead. The value of (done_dialog) is returned from (start_dialog) when a call to (done_dialog) is made with an integer argument. (defun c:MAIN () (setvar "OSMODE" 0) (create-layers) (setq dcl_id (load_dialog "kart.dcl")) (if (not dcl_id) (alert "DCL file could not be loaded!") ) (if (new_dialog "main_dialog" dcl_id) (progn (action_tile "btn_info" "(done_dialog 1)");<---set return value in (done_dialog) to be captured by the result of (start_dialog) (action_tile "btn_holes" "(done_dialog 2)") (action_tile "btn_open_model" "(done_dialog 3)") (action_tile "btn_open_card" "(done_dialog 4)") (action_tile "btn_working_directory" "(done_dialog 5)") (action_tile "btn_exit" "(done_dialog 0)") (setq useraction (start_dialog));<---- Capture result of (done_dialog) ) ) (unload_dialog dcl_id) (cond ((= userAction 1) (show_info_dialog)) ((= userAction 2) (show_holes_dialog)) ((= userAction 3) (open_model_file)) ((= userAction 4) (open_card_file)) ((= userAction 5) (select_working_directory)) ((= userAction 0) (princ "\nDone."));<---- Exit is not necessary here. (T (alert "No valid action selected.")) ) ) The AutoCAD Help is not very clear on this, but you can use ANY integer value in (done_dialog) and it will be returned to (start_dialog). https://help.autodesk.com/view/ACDLT/2024/ENU/?guid=GUID-A150544E-ACE5-415F-AAB4-930E2715FDC7 ALSO: as i noted previously, (exit) is not necessary. It evokes the error handler, which is not desired to exit a function cleanly.
    1 point
  2. I haven't tried your code, but reading it I see that (command) is used but that the osmode variable is not managed. This can create bad point feedback following the current snap. Another note: I see that international mode is used, that's good. But an oversight (on line 28): (osnap (cadr e0) "end") put an underline in front of "_end" . If using a non-US version this may return a null point. I have my own version for you if you want to try it. text_curv.lsp
    1 point
  3. Thank you for posting your solution. It may help someone else down the road.
    1 point
  4. It's funny how often the solution comes 10 seconds after posting a question.. I obviously purged the drawing, but I forgot that -purge all doesn't include registered apps. Problem solved. Edit: for clarity - the lisp removes whatever was on the drawing and the purge registered apps executed after solves the problem.
    1 point
  5. @DeEng Ok - here are some thoughts: 1) It's very difficult to diagnose the problem if a) we don't have any way to run it, and 2) we don't understand the purpose. However - I can see the following: 2) The first obvious thing I see wrong with the code is this line: (action_tile "btn_exit" "(exit)") You should never use "exit" here as it stops all code processing and sends to the error handler, which doesn't allow the dialog to close or unload properly. It should rather be: (action_tile "btn_exit" "(done_dialog)") 3) The second obvious thing i see is that you MUST close the dialog before you run (command). You are trying to run the LINE command while the dialog is still open which is not allowed. You have to close the dialog before you can do the LINE command. Your defun (AnalyzeAdditionalLines) tries to run while the dialog is open, hence the main problem I think. I suggested changing: (action_tile "btn_open_model" "(open_model_file)") (action_tile "btn_open_card" "(open_card_file)") to this: (action_tile "btn_open_model" "(done_dialog)(open_model_file)") (action_tile "btn_open_card" "(done_dialog)(open_card_file)") Or you have to rearrange your function (AnalyzeAdditionalLines) to run after the dialog closes. You can use an argument (done_dialog n) with an integer that can be captured with (start_dialog), such as (setq retval (start_dialog )) and use a conditional statement example (cond ((= ret 1) (do_this1)) ((= ret 2) (do_this2)...) etc to do different things after the dialog closes, then optionally re-load the dialog after within a (while) loop such as (while (> ret 0) ....)
    1 point
×
×
  • Create New...