Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/17/2019 in all areas

  1. (defun replace ( lst toreplace newincome / tl1 tl2 ml returnlist) (setq tl1 (reverse lst)) ; reverses order (setq tl1 (member toreplace tl1)) ; erases what is after the member (setq tl1 (cdr tl1)) ; erases member (setq tl1 (reverse tl1)) ; returns to original order (print tl1) ; debug (setq tl2 (member toreplace lst)) ; erases what is before the member (setq tl2 (cdr tl2)) ; erases member (print tl2) ; debug (setq ml (list newincome)) ; the new member, in list format (print ml) ; debug (setq returnlist (append tl1 ml tl2)) ; makes the new list returnlist ) (defun c:tstrep( / listoriginal membertoreplace newincome resultado tl3) (setq listoriginal (list 0 1 2 3 4 5 6)) (setq membertoreplace 3) (setq newincome 8) (setq resultado (replace listoriginal membertoreplace newincome)) (print resultado) )
    1 point
  2. There is no default view that can be accessed in this manner. Views have to be created first. In your case it is probably easier to work with the zoom methods of the application object.
    1 point
  3. 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
  4. Offset the POLYLINE outside (or required side) , Use LeeMac'S Code. Erase the outside or unwanted POLYLINE. Thanks to LeeMac, Tharwat and dianorh for the codes.
    1 point
  5. If you select a single vertex does this vertex get the letter "A" or the letter of the vertex parameter (i.e. if it is the 3rd vertex in the polyline it would get the letter "C")? This is the revised code to place the text outside the polyline for all vertices. I will try to incorporate a single vertex when I have the answer to the above question. (defun c:LPV ( / ent ll ur m_pt last_v e_pt s_pt t_ht cnt v_pt) (cond ( (and (setq ent (car (entsel "\nSelect Polyline to Label : "))) (= (cdr (assoc 0 (entget ent))) "LWPOLYLINE") );end_and (vla-getboundingbox (vlax-ename->vla-object ent) 'll 'ur) (setq m_pt (mapcar '(lambda (x y) (/ (+ x y) 2.0)) (vlax-safearray->list ll) (vlax-safearray->list ur)) last_v (vlax-curve-getendparam ent) e_pt (vlax-curve-getendpoint ent) s_pt (vlax-curve-getstartpoint ent) t_ht (getvar 'textsize) t_fact 1.1 cnt 0.0 );end_setq (if (equal e_pt s_pt 0.001) (setq last_v (1- last_v))) (while (<= cnt last_v) (setq v_pt (vlax-curve-getpointatparam ent cnt)) (entmakex (list (cons 0 "TEXT") (cons 7 (getvar 'textstyle)) (cons 40 t_ht) (cons 10 (polar m_pt (angle m_pt v_pt) (+ (* t_ht t_fact) (distance m_pt v_pt)))) (cons 11 (polar m_pt (angle m_pt v_pt) (+ (* t_ht t_fact) (distance m_pt v_pt)))) (cons 1 (chr (+ 65 (fix cnt)))) (cons 72 1) (cons 73 2) );end_list );end_entmakex (setq cnt (1+ cnt)) );end_while ) ( (alert "Not a Polyline")) );end_cond (princ) );end_defun (princ)
    1 point
  6. Ideally you would rename one or the other LISP. If the LISP with the duplicated name is called / run from another LISP as a subroutine you could simply reload the file containing the duplicate named LISP as required and make it the most recent one to be loaded. Use a line similar to this. (load "-filepath and LISP file name remember to use \\ insted of single \ as required - " "LISP Failed to Load") So long as the file name and location won't change this should work - not ideal mind,
    1 point
×
×
  • Create New...