Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/23/2022 in all areas

  1. 1 point
  2. If you were to consider third party add-ons, DotSoft's XL2CAD will place an Excel table in your drawing as a bound collection of Mtext, Polylines, and Hatches. The appearance matches the spreadsheet and it is still linked so that if the spreadsheet changes, it updates without interaction on the next drawing open. In the event you didn't want updating an instance can be locked.
    1 point
  3. Its a fas so useless for us to look at as its compiled. So you picking points in some way so AGAIN why not do the label when you pick a point, it can be either on a pline or a offset point and the square off will be used. Do you really need the Excel ? This is real rough but gives you an idea of how it could be done. Need info like text style and height, correct version writes at 90 to pline. ; sq pt off pline (defun c:wow (obj pt pt2 dist ) (setq obj (vlax-ename->vla-object (car (entsel "Pick obj")))) (setvar 'textstyle "Standard") (while (setq pt (getpoint "\nPick point or Enter to exit ")) (setq pt2 (vlax-curve-getclosestpointto obj pt)) (setq dist (vlax-curve-getdistatpoint obj pt2)) (command "text" pt2 2.5 "" (rtos dist 2 3)) ) (princ) )
    1 point
  4. Try this, you will need a (vl-load-com) line somewhere before it to use VLA- commands, and you can set the version to save as by altering the last ac2010_dwg (vla-SaveAs (vla-get-ActiveDocument (vlax-get-acad-object)) (strcat myfilepath myfilename ".dwg") ac2010_dwg) (version codes: ac2018_dwg ac2013_dwg ac2010_dwg ac2007_dwg ac2004_dwg ac2004_dwg are generally that year +2 years so ac2018_dwg is 2018 to 2020 version)
    1 point
  5. Good to hear that. Please add the following codes. (progn (vla-put-layer att (cdr (assoc 8 (entget ent)))) t) Before the following codes in the routine. (entdel ent) Like this: (progn (vla-put-layer att (cdr (assoc 8 (entget ent)))) t) (entdel ent)
    1 point
  6. Give this a try. (defun c:Test (/ sel int ent att spc) ;; Tharwat - Date: 19.Jun.2017 ;; (if (and (or (tblsearch "BLOCK" "ROOMTAG") (alert "Attributed Block <ROOMTAG> is not found in drawing <!>") ) (princ "\nSelect Mtexts to be replaced with Attributed Block <ROOMTAG> :") (setq sel (ssget "_:L" '((0 . "MTEXT")))) ) (progn (defun unformatmtext (string / text str) ;; ASMI - sub-function ;; ;; Get string from Formatted Mtext string ;; (setq text "") (while (/= string "") (cond ((wcmatch (strcase (setq str (substr string 1 2))) "\\[\\{}`~]" ) (setq string (substr string 3) text (strcat text str) ) ) ((wcmatch (substr string 1 1) "[{}]") (setq string (substr string 2)) ) ((and (wcmatch (strcase (substr string 1 2)) "\\P") (/= (substr string 3 1) " ") ) (setq string (substr string 3) text (strcat text " ") ) ) ((wcmatch (strcase (substr string 1 2)) "\\[LOP]") (setq string (substr string 3)) ) ((wcmatch (strcase (substr string 1 2)) "\\[ACFHQTW]") (setq string (substr string (+ 2 (vl-string-search ";" string)) ) ) ) ((wcmatch (strcase (substr string 1 2)) "\\S") (setq str (substr string 3 (- (vl-string-search ";" string) 2)) text (strcat text (vl-string-translate "#^\\" " " str)) string (substr string (+ 4 (strlen str))) ) (print str) ) (t (setq text (strcat text (substr string 1 1)) string (substr string 2) ) ) ) ) text ) (setq spc (vlax-get (vla-get-activelayout (vla-get-activedocument (vlax-get-acad-object)) ) 'block ) ) (repeat (setq int (sslength sel)) (setq ent (ssname sel (setq int (1- int)))) (and (setq att (vla-insertblock spc (vlax-3d-point (cdr (assoc 10 (entget ent)))) "ROOMTAG" 1.0 1.0 1.0 0. ) ) (vl-some '(lambda (x) (if (eq (strcase (vla-get-tagstring x)) "ROOMNO") (progn (vla-put-textstring x (unformatmtext (cdr (assoc 1 (entget ent)))) ) t ) ) ) (vlax-invoke att 'getattributes) ) (entdel ent) ) ) ) ) (princ) )(vl-load-com)
    1 point
×
×
  • Create New...