Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/01/2025 in all areas

  1. Following on from @mhupp suggestion its pretty easy to do a two item dcl and preset one option. The dcl code is short and can live inside the lisp. (defun wow ( / fo butt val ans) (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line " Presuf : dialog { " fo) (write-line " label =\"Prefix Suffix\" ; " fo) (write-line " : row { " fo) (write-line " : boxed_radio_row { " fo) (write-line " : radio_button { " fo) (write-line " key = \"Rb1\" ; " fo) (write-line " label = \"Prefix\" ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " : radio_button { " fo) (write-line " key = \"Rb2\" ; " fo) (write-line " label = \"Suffix\" ; " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " } " fo) (write-line " } " fo) (write-line " spacer_1 ; " fo) (write-line " ok_cancel ; " fo) (write-line " } " fo) (close fo) (setq dcl_id (load_dialog fname)) (if (not (new_dialog "Presuf" dcl_id) ) (exit) ) (setq butt "Rb1") (action_tile "accept" "(setq val (get_tile butt))(done_dialog)") (action_tile "cancel" "(done_dialog)") (start_dialog) (unload_dialog dcl_id) (vl-file-delete fname) (if (= val "1") (setq ans "Pre") (setq ans "Suff") ) (princ ans) ) (wow)
    1 point
  2. This is another way of setting a default option from a prompt. (initget "Prefix Suffix") (setq rep (cond ((getkword "\nAdd Text @ [Prefix/<Suffix>]: ")) ("Suffix") ) ) This will prompt the user "Add Text @ [Prefix/<Suffix>]:" just visually using < > to mark the default answer. if the user hits enter on the prompt the kword isn't set so rep defaults to "Suffix" Using cond instead of if's & wrapping it with getkword means the user doesn't have to type out exactly Prefix or Suffix . to then trigger other if's later in the lisp.
    1 point
  3. I looked at the file and its plain ascii text, are you sure need to write a binary file ? I used to have DEBUG so could look at a file and see if its plain text or binary. Can you post a file that has more than one line please. Just a comment in Acad and Bricscad the start up suite is contained in the registry.
    1 point
  4. Another give it a try. ; https://www.cadtutor.net/forum/topic/98615-copy-blocks-to-curve-according-to-another-curve/ ; get blocks along a pline at any XY then redo as a straight line. ; By AlanH July 2025 (defun c:wow ( / bname co-ord ent obj plent pt spac ss x) (setq oldsnap (getvar 'osmode)) (setvar 'osmode 0) (setq plent (car (entsel "\pick pline joining blocks "))) (setq obj (vlax-ename->vla-object (car (entsel "\nPick block object ")))) (setq pt (getpoint "\nPick left point ")) (setq spac (getreal "\Enter spacing ")) (setq bname (vlax-get obj 'effectivename)) (setq co-ord (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= (car x) 10)) (entget plent)))) (setq ss (ssget "F" co-ord '((0 . "INSERT")))) (command "line" pt (mapcar '+ pt (list (* (- (sslength ss) 1) spac) 0.0 0.0)) "") (repeat (setq x (sslength ss)) (setq ent (ssname ss (setq x (- x 1)))) (setq obj (vlax-ename->vla-object ent)) (if (= (vlax-get obj 'effectivename) bname) (progn (command "copy" ent "" (vlax-get obj 'Insertionpoint) pt) (setq pt (mapcar '+ pt (list spac 0.0 0.0))) ) ) ) (princ) )
    1 point
  5. @HypnoS Please give it a try cpy-blk-2-poly.lsp
    1 point
×
×
  • Create New...