guitarguy1685 发表于 2022-7-5 16:30:48

AutoLISP find & replace based

can you point me in the right direction.
 
I want to write a lisp that will access an external .csv file and Find text in the first column and replace with text in the 2nd column.
 
This is my task
 
I have about 300 glass panels that have been numbed 100, 101, 103, 104 etc.I need to renumber every piece to 300, 301, 303, 304 etc.I don't think I can do this with the OTB find/replace.I can easily create this list in excel and export to csv.
 
Is there anything out there already that may be close that I can rework?

Lee Mac 发表于 2022-7-5 17:05:32

Use this following these instructions.

Dadgad 发表于 2022-7-5 17:23:55

 
When in doubt check Lee Mac out.

BIGAL 发表于 2022-7-5 17:35:35

If the text is only a number then you can use a simple lisp method of just adjusting the current value ie +200 to all text picked.
 

; Adds or subtract a fixed amount to a number; By Alan H 2015(Alert "TO USE JUST TYPE A2LM")(DEFUN c:A2LM ( / el en a v1 v2 ss)(setvar "cmdecho" 1)(setq olddimzin (getvar "Dimzin"))(setvar "dimzin" 0)(if (not AH:getval) (load "getval"))(ah:getval "Enter ht adjust.." 10 (setq v2 (Atof item))(setq ss (ssget (list (cons 0 "Text"))))(setq len (sslength ss))(setq x 0)(repeat len(setq en1 (ssname ss x))       (setq el1 (entget en1))       (setq v1 (atof (cdr (assoc 1 el1))))       (setq a (+ v1 v2))       (setq b (rtos a 2 3))       (setq el (subst (cons 1 b) (assoc 1 el1) el1))       (entmod el)(setq x (+ x 1))) ; repeat(setvar "cmdecho" 1)(setvar "dimzin" olddimzin)(princ)); END DEFUN
页: [1]
查看完整版本: AutoLISP find & replace based