Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/13/2023 in all areas

  1. FWIW, here's a similar program I've posted previously - https://www.theswamp.org/index.php?topic=44444.msg496892#msg496892
    3 points
  2. In case someone is interested... I was making a Match all dynamic props function; I found this "origin" problem, Google brought me here... Here's what I did ;;(setq source (car (entsel "\nSelect source block: "))) ;;(setq dest (car (entsel "\nSelect destinaion block: "))) (defun match_props (source dest / props ) (setq props (LM:getdynprops (vlax-ename->vla-object source))) (setq props (filter_props props)) (LM:setdynprops (vlax-ename->vla-object dest) props) ) ;; the "ORIGIN" key is a READONLY prop, so it must beremoved (defun filter_props (props / newprops prop) (setq newprops (list)) (foreach prop props (if (= "Origin" (car prop)) T (setq newprops (append newprops (list prop))) ) ) newprops )
    2 points
  3. try it and see... maybe in a small test LISP ?
    1 point
  4. thank you very much. It helps me a lot
    1 point
  5. @SLW210 This isn't really a lisp issue its more of a interface one. They were made when facing the wrong way (Bottom view I think). So their 210 looks like (210 0.0 0.0 -1.0) This will mirror them around but the right way but also wont 100% fix the issue. because some will have to be adjusted. ;;----------------------------------------------------------------------------;; ;; Flips Backwards ploylines (defun C:SWAP (/ SS) (if (setq SS (ssget "_X" '((210 0.0 0.0 -1.0)))) (progn (vl-cmdf "_.Mirror3d" SS "" "xy" "0,0,0" "y") (prompt (strcat "\nEntities Swapped: " (itoa (sslength SS)))) ) (prompt "\nNothing to Swap!") ) (princ) )
    1 point
  6. Might be different in other software but in BricsCAD yes. you can always test with (type variable) (defun C:test (/ aa bb) (setvar 'textsize 2) (setq aa (getvar "TEXTSIZE")) ;; aa is a real number? (setq bb (getvar "cmdecho")) ;; bb is int (prompt "\naa is ") (princ (type aa)) (prompt "\nbb is ") (princ (type bb)) )
    1 point
  7. so is this correct? (setq aa (getvar "TEXTSIZE")) ;; aa is a real number? (setq bb (getvar "cmdecho")) ;; bb is int?
    1 point
  8. (setq x "100") ;string (setq x 100) ;integer (setq x 100.0) ;double or real number math with two integers will only produce an integer (/ 3 2) = 1 math with an integer and real will produce a real number (/ 3 2.0) = 1.5 Why I called it double 2. Most system variables are stored as real numbers it just depends on what variable it is. like cmdecho is either 1 or 0 on/off so that is just an integer. but textsize is stored as a real number.
    1 point
  9. One minor thing. (setq globalvar_ht (atof "1")) = (setq globalvar_ht 1) Also wouldn't hurt to put a decimal point on the variables with numbers especially if your going to use them in calculations. (setq globalvar_ht 1.0) Example: (defun C:test (/ x) (setq x 100) ;integer (setq x (/ x 6)) (princ x) (prompt (strcat "\n" (rtos x 2 5) "\n")) (setq x 100.0) ;double (setq x (/ x 6)) (princ x) (princ) )
    1 point
  10. Have you tried the program I have posted here?
    1 point
  11. 1 point
  12. Here is that code without BBCode Tags : (defun c:mt (/ cEnt mEnt) (if (and (setq cEnt (car (nentsel "\nSelect Source Text: "))) (member (cdr (assoc 0 (entget cEnt))) '("TEXT" "MTEXT" "ATTRIB"))) (progn (redraw cEnt 3) (while (and (setq mEnt (car (nentsel "\nSelect Destination Text: "))) (member (cdr (assoc 0 (entget mEnt))) '("TEXT" "MTEXT" "ATTRIB"))) (entmod (subst (assoc 1 (entget cEnt)) (assoc 1 (entget mEnt)) (entget mEnt)))) (redraw cEnt 4)) (princ "\n<!> Incorrect Selection <!>")) (princ)) (defun c:mt2 (/ cEnt mEnt sLst) (if (and (setq cEnt (car (nentsel "\nSelect Source Text: "))) (member (cdr (assoc 0 (entget cEnt))) '("TEXT" "MTEXT" "ATTRIB"))) (progn (redraw cEnt 3) (if (setq ss (ssget "_X" '((-4 . "<NOT") (0 . "TEXT,MTEXT,INSERT") (-4 . "NOT>")))) (mapcar '(lambda (x) (redraw x 2)) (setq sLst (mapcar 'cadr (ssnamex ss))))) (while (and (setq mEnt (car (nentsel "\nSelect Destination Text: "))) (member (cdr (assoc 0 (entget mEnt))) '("TEXT" "MTEXT" "ATTRIB"))) (entmod (subst (assoc 1 (entget cEnt)) (assoc 1 (entget mEnt)) (entget mEnt))))) (princ "\n<!> Incorrect Selection <!>")) (command "_regenall") (princ)) (defun c:mt3 (/ cEnt ss) (vl-load-com) (if (and (setq cEnt (car (nentsel "\nSelect Source Text: "))) (member (cdr (assoc 0 (entget cEnt))) '("TEXT" "MTEXT" "ATTRIB"))) (progn (redraw cEnt 3) (if (setq ss (ssget '((0 . "TEXT,MTEXT")))) (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (entmod (subst (assoc 1 (entget cEnt)) (assoc 1 (entget x)) (entget x)))))) (princ "\n<!> Incorrect Selection <!>")) (command "_regenall") (princ)) HTH., M.R.
    1 point
×
×
  • Create New...