Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/29/2024 in all areas

  1. I have removed the dwg file from your post.
    1 point
  2. I do agree that the "Excel" way is easier. But if you wish my Lisp solution, here you are: (defun c:pp() (setq separator ";") (setq textHeight 0.5) (setq fileName (getfiled "coords text" "" "CSV" 0) file (open fileName "r") ) (while (setq row (read-line file)) (setq p1 (1+ (vl-string-position (ascii separator) row)) p2 (1+ (vl-string-position (ascii separator) row p1)) x (read (substr row 1 p1)) y (read (substr row (1+ p1) (- p2 p1))) txt (substr row (1+ p2)) ) (entmake (list (cons 0 "TEXT") (list 10 x y 0) (cons 1 txt)(cons 40 textHeight))) ) (close file) ) Save the Excel sheet in CSV format. Because the "comma" sometimes is not comma, open the file in notepad and examine the separator. Change the second line in this Lisp accordingly. Also you may wish to change the text height -in the third line. Enjoy!
    1 point
  3. If all you're after is importing the text, then I'd go with what @BIGAL suggested. By forming some formulae, you can create the necessary strings that you can simply just paste into the command line: 30000 is just an example text height that's set, and 0.0 is the rotation angle.
    1 point
  4. Another when selecting objects. Makes VL objects. (if (= ss nil) (progn (Alert "Selection set was not created \n\n will now exit\n\nPlease check dwg and redo")(exit)) ) (repeat (setq i (sslength ss)) (setq obj (vlax-ename->vla-object (ssname ss (setq i (1- i))))) ;; Do your thing here )
    1 point
  5. Like devitg post XLS, yes can read Excel direct. Only question is there always a header line ? You could do it in Excel using a Concatenate command just copy in example column E to Autocad command line. =CONCATENATE("(command ",CHAR(34),"TEXT",CHAR(34)," ",CHAR(34),A1,",",B1,CHAR(34)," ","2.5 0 ",CHAR(34),C1,CHAR(34),")")
    1 point
  6. Hello duke, Welcome to the world of AutoLISP. Hopefully you will have a fun time learning it as you go. Just as Steven has pointed out, what you have done is the most common method of processing entities in a selection set. If anything, most programmers would simply reduce one more line by writing it like this: (repeat (setq i (sslength ss)) (setq i (1- i)) ;; Do your thing here ) Of course, there would be times when you would need to use a list instead of a selection set. In this case, you will need to convert them into a list first. Such functions are already available: SelectionSet to List.
    1 point
  7. Ignore multiple dwg's for moment. As you say only have title block once then its easy. (setq ss (ssget "X" '((0 . "INSERT")(cons 2 "EPCB000")))) You now have a selection set containing the block. (setq obj (vlax-ename->vla-object (ssname ss 0))) (setq atts (vlax-invoke obj 'Getattributes)) The variable atts holds all the attributes. You can then say change the value in each attribute, as you want to change many it makes it easy. You can just loop trough the attributes and change the "TEXTSTRING" the value of the attribute, you can also check for a particular attribute and say change G11 to G12. Ok next question how do you propose to supply the new values ? One way is to make a list of the new values say keep the code in a lisp file and just change the 1 line with the new answers, or keep the values in a text file change it and then run on multiple dwg's if required. This is the type of question linked to excel which can read say a row of details. The excel containing multiple dwg names.
    1 point
×
×
  • Create New...