Jump to content

Leaderboard

  1. rlx

    rlx

    Trusted Member


    • Points

      3

    • Posts

      2,204


  2. BIGAL

    BIGAL

    Trusted Member


    • Points

      2

    • Posts

      19,664


  3. CyberAngel

    CyberAngel

    Trusted Member


    • Points

      1

    • Posts

      1,965


  4. marko_ribar

    marko_ribar

    Trusted Member


    • Points

      1

    • Posts

      2,106


Popular Content

Showing content with the highest reputation on 05/19/2025 in all areas

  1. wow , that's a very good question ... to which I have no answer ... did some searching but found nothing to suggest this is possible with standard AutoCad / DCL
    2 points
  2. Like you, I don't write much code, and when I do, it's to solve a problem and move on to the next project. I tend to use the brute force approach, that is, write statements to emulate the steps I'd follow to accomplish the task. Even if that's not the most efficient way to use the language. If I wanted to learn more about writing AutoLISP, I'd start by going through Lee Mac's awesome repository of code. Edit: To reinforce what BigAl said, it's a good idea to break down a big task into smaller ones. A job that seems overwhelming at first will get easier once you've broken it into manageable blocks.
    1 point
  3. thanx Bigal , glad to hear it's still useful (defun c:mohammadreza ( / fn fp dcl drv) (create_dialog) (if (not (and (setq dcl (load_dialog fn)) (new_dialog "mohammadreza" dcl))) (princ "\nUnable to start dialog") (progn ;;; init tiles... ;;; action tiles (action_tile "cancel" "(done_dialog 0)") (action_tile "accept" "(done_dialog 1)") (if (and fn (findfile fn)) (vl-file-delete (findfile fn))) (setq drv (start_dialog)) (cond ((= drv 0) (princ "\nCancel")) ((= drv 1) (princ "\nAccept")) ) ) ) (princ) ) (defun create_dialog () (if (and (setq fn (vl-filename-mktemp "mohammedreze.dcl")) (setq fp (open fn "w"))) (mapcar '(lambda (x)(write-line x fp)) (list "mohammadreza : dialog {label=\"Mohammadreza 5/'25\";" " :boxed_row {label=\"ÇØáÇÚÇÊ ãÇá˜\";" " :column {:eb {key=\"name\";}:eb {key=\"father_name\";}:eb {key=\"personal_code\";edit_limit=10;}:eb {key=\"address\";}}" " :column {vertical_margin=none;children_fixed_width=true;children_alignment=right;" " :tr {label=\"äÇã æ äÇã ÎÇäæÇÏí\";}:tr {label=\"äÇã ÏÑ\";}:tr {label=\"˜Ï ãáí\";}:tr {label=\"ÂÏÑÓ\";}}}" " ok_cancel;" "}" "eb :edit_box {fixed_width=true;width=25;vertical_margin=none;edit_width=25;}" "tr :text {alignment=right;fixed_width=true;width=25;}" ) ) ) (if fp (close fp)) (gc) )
    1 point
  4. Try this arrangement xxxx : dialog { : boxed_column { fixed_width = true ; label = "ÇØáÇÚÇÊ ãÇá˜"; : row { : edit_box { key = "name"; width = 25; } : text { label = "äÇã æ äÇã ÎÇäæÇÏí"; alignment = right; } } : row { : edit_box { key = "father_name"; width = 25; } : text { label = "äÇã ÏÑ"; alignment = right; } } : row { : edit_box { key = "personal_code"; width = 25; edit_limit = 10; } : text { label = "˜Ï ãáí"; alignment = right; } } : row { : edit_box { key = "address"; width = 25; } : text { label = "ÂÏÑÓ"; alignment = right; } } spacer_1 ; ok_cancel; } } A good way to go is to convert the dcl to lisp so the dcl code is inside the lsp code. (defun wow ( / ) (setq dcl (vl-filename-mktemp nil nil ".dcl") ) (setq des (open dcl "w") ) (foreach x '( "xxxx : dialog {" ": boxed_column { fixed_width = true ;" " label = \"ÇØáÇÚÇÊ ãÇá˜\"; " " : row {" " : edit_box { key = \"name\"; width = 25; }" " : text { label = \"äÇã æ äÇã ÎÇäæÇÏí\"; alignment = right; }" " }" " : row {" " : edit_box { key = \"father_name\"; width = 25; }" " : text { label = \"äÇã ÏÑ\"; alignment = right; }" " }" " : row {" " : edit_box { key = \"personal_code\"; width = 25; edit_limit = 10; }" " : text { label = \"˜Ï ãáí\"; alignment = right; }" " }" " : row {" " : edit_box { key = \"address\"; width = 25; }" " : text { label = \"ÂÏÑÓ\"; alignment = right; }" " }" "spacer_1 ;" "ok_cancel;" "}" "}" " " ) (write-line x des ) ) (close des) (setq dcl_id (load_dialog dcl)) (if (not (new_dialog "xxxx" dcl_id)) (exit) ) (action_tile "name" "(setq val1 (get_tile \"name\"))") (action_tile "father_name" "(setq val2 (get_tile \"father_name\"))") (action_tile "personal_code" "(setq val3 (get_tile \"personal_code\"))") (action_tile "address" "(setq val4 (get_tile \"address\"))") (action_tile "accept" "(done_dialog)") (action_tile "cancel" "(done_dialog)") (start_dialog) (unload_dialog dcl_id) (vl-file-delete dcl) (princ) ) (wow) Thanks to @rlx for his convert dcl to lsp.
    1 point
  5. Look at this pop menu. You can see the block sub sections in the menu. Nice thing about POP image menus is that you can have more than 20 blocks so next and previous works.
    1 point
  6. Here, quickly written, but you can start with it and develop further more... (defun c:blksconnect ( / mid ss i blklst ll ur att n pp ) (or (not (vl-catch-all-error-p (vl-catch-all-apply (function vlax-get-acad-object) nil))) (vl-load-com)) (defun mid ( p1 p2 ) (mapcar (function (lambda ( a b ) (/ (+ a b) 2.0))) p1 p2) ) (if (setq ss (ssget (list (cons 0 "INSERT") (cons 66 1)))) (progn (repeat (setq i (sslength ss)) (setq blklst (cons (ssname ss (setq i (1- i))) blklst)) ) (foreach blk blklst (vla-getboundingbox (vlax-ename->vla-object blk) (quote ll) (quote ur)) (mapcar (function set) (list (quote ll) (quote ur)) (mapcar (function safearray-value) (list ll ur))) (setq ll (trans ll 0 1) ur (trans ur 0 1)) (setq att (entnext blk)) (while (and att (setq n (cdr (assoc 1 (entget att))))) (if (numberp (setq n (atoi n))) (setq blklst (subst (list n (mid ll ur)) blk blklst)) ) (setq att (entnext att)) ) ) (setq blklst (vl-sort blklst (function (lambda ( a b ) (< (car a) (car b)))))) (vl-cmdf "_.pline" "_non" (setq pp (cadar blklst))) (foreach p (cdr (mapcar (function cadr) blklst)) (vl-cmdf "_non" (list (car p) (cadr pp))) (vl-cmdf "_non" (setq pp p)) ) (vl-cmdf "") ) ) (princ) )
    1 point
×
×
  • Create New...