Jump to content

Leaderboard

Popular Content

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

  1. Hi all, I just wrote my first DCL program. It's a renamer for blocks and layers. It has a block walk function to zoom into the block to be renamed from the selection, and the layers are highlighted when picked in the edit box. The rename dialog in ACAD hasn't been touched since I started using it in 2004 so I think this will help identify and rename Blocks and Layers much better. There is a bug whereby if something has been renamed, the zoom to block or highlighting of objects doesn't work. I'll try to fix the bug when I get some spare time. Fixed in v1.01 below. Thoughts on this and improvements are welcome. 3dwannab_Rename_Blocks_and_Layers.lsp 3dwannab_Rename_Blocks_and_Layers.dcl
    2 points
  2. Exactly - and using an image_button in place of a regular button.
    2 points
  3. Solved it, thanks to @pkenewell solution: (action_tile "tabellen_list" "(setq lret (atoi $value)) (set_tile \"dynamic_label\" (nth lret (reverse boomsoorten))) (set_tile \"dynamic_label_2\" (nth lret (reverse boomafkorting))) (set_tile \"dynamic_label_3\" (nth lret (reverse boomgrootte))) (set_tile \"dynamic_label_4\" (nth lret (reverse boomdiametermin))) (set_tile \"dynamic_label_5\" (nth lret (reverse boomdiametermax))) ")
    1 point
  4. You have to close the dialog in the (action_tile) statement before using (ssget). This for example can close the dialog then run your functions after the dialog closes: (action_tile "but1" "(done_dialog)(doButton 1)") (action_tile "but2" "(done_dialog)(doButton 2)") (action_tile "but3" "(done_dialog)(doButton 3)") You can also evaluate a value for (done_dialog) by using the return argument (done_dialog [int]). For example: (defun C:SAMPLE1() ;; Load the DCL file (setq dcl_id (load_dialog "SAMPLE1.dcl")) ;; Load the dialog definition if it is not already loaded (if (not (new_dialog "SAMPLE1" dcl_id)) (exit)) ;; Map buttons to their respective actions (action_tile "but1" "(done_dialog 1)") (action_tile "but2" "(done_dialog 2)") (action_tile "but3" "(done_dialog 3)") (action_tile "cancel" "(done_dialog 0)") ;; Display the dialog box (setq result (start_dialog)) ;; Unload the dialog box (unload_dialog dcl_id) (cond ((= result 1)(doButton 1)) ((= result 2)(doButton 2)) ((= result 3)(doButton 3)) ) ;; Suppress the last echo for a clean exit (princ) )
    1 point
  5. While I don't completely understand the use/purpose, and I can't get the data correctly because my standard CSV delimiter is different, to get the value from the list box then do something with it, you use (action_tile) and (Set_tile). See the following example for an idea (my apologies I don't understand how the data is structured yet and don't have time to figure it out): ;; The popup list returns the index of the selected item as a string with the $value return variable. convert it to an integer and use it to index your data. (action_tile "tabellen_list" "(setq lret (atoi $value))(set_tile \"dynamic_label\" (nth lret ...))(set-tile \"dynamic_label2\" ...)" )
    1 point
  6. Thanks Lee, (many years later and slowly working out how your mind works with these things)
    1 point
  7. Using a very small height and width for the button?
    1 point
  8. Note that the tile can be invisible, similar to the Help button in my TabSort program.
    1 point
  9. So if you press left or right, will that cancel the DCL? In which case have them as OK / Cancel just with a different name... but as RLX... an exit or never mind option too?
    1 point
  10. One tile should have the is_cancel attribute for the 'x' button to remain operational; note that the same tile can have both is_default & is_cancel.
    1 point
  11. @Anushka & @3dwannab You could always just use activex, which can run in the background with the DCL, since it does not use the command line: (defun _RenameBlock (bn nn / bobj) (if (and (tblsearch "BLOCK" bn) (not (tblsearch "BLOCK" nn)) ) (progn (setq bobj (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) bn)) (vla-put-name bobj nn) ) ) )
    1 point
  12. You need (vl-load-com) at the start of the lisp. this will load vla commands. -edit if you have a start up lisp most people put it there only needs to run once but it dosen't hurt to have it at the start of lisp that use vla commands
    1 point
  13. Just added this to the link from SLW210, below modified to select many dimensions. Note the entity to dimension to are lines just now, should work with other entities, just change that line, (defun c:reass ( / DimEnt MyDim Pta Ptb EndA EndB EndA_Lines EndB_Lines) (if (setq ss (ssget '((0 . "DIMENSION")) )) ; select dimensions (repeat (setq i (sslength ss)) ; loop through selection set (setq DimEnt (ssname ss (setq i (1- i)))) (command "_zoom" "O" DimEnt "") (setq MyDim (entget DimEnt)) (setq Pta (cdr (assoc 13 MyDim))) (setq Ptb (cdr (assoc 14 MyDim))) (setq EndA_Lines (ssget "_C" (mapcar '+ Pta (mapcar '/ Pta '(1000 1000 1000))) (mapcar '- Pta (mapcar '/ Pta '(1000 1000 1000))) '((0 . "LINE")) )) ; select entity close to end of dimension line (setq EndB_Lines (ssget "_C" (mapcar '+ Ptb (mapcar '/ Pta '(1000 1000 1000))) (mapcar '- Ptb (mapcar '/ Pta '(1000 1000 1000))) '((0 . "LINE")) )) ; select entity close to end of dimension line ; (command "dimreassociate" DimEnt "" "end" Pta "end" Ptb) (if EndA_Lines (command "dimreassociate" DimEnt "" "end" Pta "")) (if EndB_Lines (command "dimreassociate" DimEnt "" "end" "" "end" Ptb )) (command "_zoom" "previous") ) ; end repeat ) ; end if (princ) ; end quietly )
    1 point
  14. With autocad's autocomplete function, lately, I have had longer command names, since it's easy to use once you've typed them in a couple times.
    1 point
×
×
  • Create New...