Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/24/2024 in all areas

  1. I added some comments below to show what it does differently. Mostly its just a loop instead of the same code 6 times. The Dynamic block functions are not for changing attributes but the different custom properties a dynamic block can have. For changing attributes you can look at the other link CyberAngel provided on the other post. But since you are trying to fill in a dynamic block that looks just like a mleader, why not just use an actual mleader like this: (defun c:testKRIS ( / *error* dch dcl des mv d1 d2 d3 d4 d5 d6) (defun *error* ( msg ) (if (and (= 'int (type dch)) (< 0 dch)) (unload_dialog dch) ) (if (= 'file (type des)) (close des) ) (if (and (= 'str (type dcl)) (findfile dcl)) (vl-file-delete dcl) ) (if (and msg (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))) (princ (strcat "\nError: " msg)) ) (princ) ) (cond ( (not (setq dcl (vl-filename-mktemp nil nil ".dcl") des (open dcl "w") ) ) (princ "\nUnable to open DCL for writing.") ) ( (progn (foreach str '( "ed : edit_box" "{" " alignment = left;" " width = 20;" " edit_width = 10;" " fixed_width = true;" "}" "" "test : dialog" "{" " spacer;" " key = \"dcl\";" " : ed" " {" " key = \"mv\";" " label = \"MV:\";" " }" " :boxed_column { " " label = \"Diepte vd buizen\";" " :row {" " : ed" " {" " key = \"d1\";" " label = \"A:\";" " }" " : ed" " {" " key = \"d4\";" " label = \"X:\";" " }}" " :row {" " : ed" " {" " key = \"d2\";" " label = \"B:\";" " }" " : ed" " {" " key = \"d5\";" " label = \"Y:\";" " }}" " :row {" " : ed" " {" " key = \"d3\";" " label = \"C:\";" " }" " : ed" " {" " key = \"d6\";" " label = \"Z:\";" " }}" " }" " : boxed_row" " { " " label = \"BOK berekeningen\";" " :column {" " : ed { key = \"res\"; label = \"BOK:\"; is_enabled = false; }" " : ed { key = \"res2\"; label = \"BOK2:\"; is_enabled = false; }" " : ed { key = \"res3\"; label = \"BOK3:\"; is_enabled = false; }" " }" " :column{" " : ed { key = \"res4\"; label = \"BOK4:\"; is_enabled = false; }" " : ed { key = \"res5\"; label = \"BOK5:\"; is_enabled = false; }" " : ed { key = \"res6\"; label = \"BOK6:\"; is_enabled = false; }" " }" " }" " : button" " {" " key = \"cal\";" " label = \"Calculate\";" " }" " spacer;" " ok_only;" "}" ) (write-line str des) ) (setq des (close des) dch (load_dialog dcl) ) (<= dch 0) ) (princ "\nUnable to load DCL file.") ) ( (not (new_dialog "test" dch)) (princ "\nUnable to display 'test' dialog.") ) ( t (set_tile "dcl" "Calculate Area") (action_tile "mv" "(setq mv $value)") (action_tile "d1" "(setq d1 $value)") (action_tile "d2" "(setq d2 $value)") (action_tile "d3" "(setq d3 $value)") (action_tile "d4" "(setq d4 $value)") (action_tile "d5" "(setq d5 $value)") (action_tile "d6" "(setq d6 $value)") (action_tile "cal" (vl-prin1-to-string '( (lambda ( / m) (foreach box '("res" "res2" "res3" "res4" "res5" "res6") (set_tile box "") ) (if (and mv (setq m (distof mv))) (progn (setq lijst_results (cons ; Add item to start of a list (strcat "MV: " mv "\\P") ; Add MV to the list before saving to lijst_results (mapcar ; Loop function (lambda) over 3 lists '(lambda (box naam var / a v) ; Function (if (and ; Checks from your code var (setq a (distof var)) (setq v (rtos (- m a) 2 2)) ; Save string in a variable since its used twice ) (progn (set_tile box v) (strcat naam ": " v "\\P") ; return to list including enter ) (progn "" ) ) ) (list "res" "res2" "res3" "res4" "res5" "res6") ; List 1 called Box (list "A" "B" "C" "X" "Y" "Z") ; List 2 called Naam (list d1 d2 d3 d4 d5 d6) ; List 3 called Var ) ) ) ) (alert "Vul maaiveld waarden in.") ) ) ) ) ) (start_dialog) (if lijst_results (command "_mleader" "\\" ; Pause for input startpoint "\\" ; Pause for position of text (apply 'strcat lijst_results) ; Fill in info ) ) ) ) (*error* nil) (princ) )
    1 point
  2. Because you want a yellow pline section working with curves in a pline it is difficult, a quick workaround is copy the pline say to right 200 then adjust the 2 points chosen points X+200, trim the pline both ends, change its layer so becomes yellow, move it back -200, all done. Removes all the headaches of trimming and remaking plines. No Code at this stage just a suggestion. Image shows idea.
    1 point
  3. If your paying for the dwg file then insist that you get what you want, not what they want to give you. If not get another contractor. We supplied a CIV3D file and surface 3dfaces if they were using non CIV3D.
    1 point
  4. lets see what ChatGPT says
    1 point
  5. Try this modification of your code - minimally tested, but I am exploiting using inters and polar to work with linear, rotated, or aligned dimensions at any angle. Doesn't do anything on any other type of dimension. (defun C:D2 (/ cmd osm olderr ss PT index DS N13 N14) (setq cmd (getvar "CMDECHO") osm (getvar "OSMODE") olderr *error* *error* myerror ) (princ "Please select dimension object!") (setq ss (ssget '((0 . "DIMENSION")))) (setq PT (getpoint "\nPoint to trim or extend:") PT (trans PT 1 0) ) (command "UCS" "_W") (repeat (setq index (sslength ss)) (setq DS (entget (ssname ss (setq index (1- index)))) dtyp (cdr (assoc 70 ds)) ) (cond ((member dtyp (list 32 160))(setq ang (cdr (assoc 50 ds)))) ((member dtyp (list 33 161))(setq ang (angle (cdr (assoc 13 ds)) (cdr (assoc 14 ds))))) ) (if ang (progn (setq n13 (inters (cdr (assoc 13 ds)) (polar (cdr (assoc 13 ds)) (+ ang (/ pi 2)) 1) pt (polar pt ang 1) nil ) ds (subst (cons 13 n13) (assoc 13 ds) ds) n14 (inters (cdr (assoc 14 ds)) (polar (cdr (assoc 14 ds)) (+ ang (/ pi 2)) 1) pt (polar pt ang 1) nil ) ds (subst (cons 14 n14) (assoc 14 ds) ds) ) (entmod ds) ) ) ) (command "UCS" "_P") (setvar "CMDECHO" cmd) (setvar "OSMODE" osm) (setq *error* olderr) (princ) )
    1 point
×
×
  • Create New...