Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/08/2021 in all areas

  1. @hosneyalaa Please don't use my codes in such a missy way of coding via copying and pasting then removing my name from my routine. CHECK Always try to write yours to get experience via practicing.
    2 points
  2. 1 point
  3. 1 point
  4. TRY (defun c:QQQQTest ( / int sel ent get ins txt src tar srt) (setq int -1 sel (ssget '((0 . "TEXT") ))) (setq file2open (vl-filename-mktemp "tmp" (getvar 'dwgprefix) ".csv")) (setq f_open (open file2open "w")) (princ "TEXT" f_open) (princ ";" f_open) (princ "X" f_open) (princ ";" f_open) (princ "Y" f_open) (princ "\n" f_open) (while (setq int (1+ int) ent (ssname sel int)) (setq get (entget ent) ins (cdr (assoc 11 get)) txt (cdr (assoc 01 get)) ) (princ txt f_open) (princ ";" f_open) (princ (rtos (car ins) 2 3) f_open) (princ ";" f_open) (princ (rtos (caDr ins) 2 3) f_open) (princ "\n" f_open) ) (close f_open) (startapp "explorer" file2open);opin excel (princ) ) (vl-load-com)
    1 point
  5. Whatever works! Besides speeding the workflow automation reduces the chance for human error. What title block attributes cannot be set automatically can either be picked from a list like the name and registration # of the engineer signing the plans or prompted for like the Field Book #. Repetitive tasks done with every drawing shouldn't take up more than a few minutes. All the drawing details we use are saved in one Typicals drawing available with a click to pick and choose for a detail sheet. Drawing something more that once is a waste of time.
    1 point
  6. So where are you stuck with this? This should give you the centre point of a text, ;;centre point of text (defun c:txtcentre ( / txtset myent acount alignment Edata pt) (defun gettextalign ( myent / txtset Edata ptx_old pty_old pty_new ptx_new mycons) (setq Edata (entget myent)) (setq mycons 10) (if (/= 0 (nth 1 (cdr (assoc 11 Edata))))(setq mycons 11)) (setq ptx_old (nth 1 (assoc mycons Edata))) (setq pty_old (nth 2 (assoc mycons Edata))) (command "_.justifytext" myent "" "MC") (setq Edata (entget myent)) (setq ptx_new (nth 1 (assoc mycons Edata))) (setq pty_new (nth 2 (assoc mycons Edata))) (if (< ptx_old ptx_new)(setq alignx "L")) (if (> ptx_old ptx_new)(setq alignx "R")) (if (= ptx_old ptx_new)(setq alignx "C")) (if (> pty_old pty_new)(setq aligny "T")) (if (< pty_old pty_new)(setq aligny "B")) (if (= pty_old pty_new)(setq aligny "M")) (setq xyalign (strcat aligny alignx)) (command "_.justifytext" myent "" xyalign) xyalign ) (princ "\nSelect Text") (setq txtset (ssget '((0 . "*TEXT")))) (setq acount 0) ;;Loop from here if needed (setq myent (ssname txtset acount)) (setq Edata (entget myent)) (setq alignment (gettextalign myent)) (command "_.justifytext" myent "" "MC") (if (= (cdr (assoc 0 Edata)) "MTEXT") (setq pt (assoc 10 (entget myent))) (setq pt (assoc 11 (entget myent))) ) (setq ptx (car pt)) (setq pty (cdr pt)) (command "_.justifytext" myent "" alignment) ;;end loop here if needed (princ "x:")(princ ptx) (princ "\nY:")(princ pty) ) There are lots of examples out there to export to CSV and you should be able to build that up from above, the drawing and the text string (again lots of examples out there) Lee Mac also had this to find the centre of the text, either in this forum or on his website: (defun LM:txtcentre ( / b e centretext) (cond ( (not (setq e (car (nentsel))))) ( (not (setq b (LM:textbox (entget e)))) (princ "\nInvalid object selected - please select text, mtext or attribute.") ) ( (entmake (list '(000 . "POINT") (cons 010 (trans (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) (car b) (caddr b)) e 0)) (assoc 210 (entget e)) ) ) ) ( (princ "\nUnable to create central point.")) ) (setq centretext (trans (mapcar '(lambda ( a b ) (/ (+ a b) 2.0)) (car b) (caddr b)) e 0) ) (list centretext e) ) So back to my question, where are you stuck with this?
    1 point
×
×
  • Create New...