Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/16/2023 in all areas

  1. Use this ;;; just72 (left->0, center->1, right->2,aligned (if vertical alignment=0)->3) ;;; just73 (baseline->0, bottom->1, middle->2,top->3) (cons 72 just72) ;;; Horizontal Alignment (cons 73 just73) ;;; Vertical Alignment ;; or if you are using "just" numbers '(72 . 1) '(73 . 2) And the insertion point should be 11 instead of 10
    2 points
  2. These have always worked for me if you don't want to entmod the text. (defun c:jul() (jut "l")) ;;ju: Justify + l: Left (defun c:juc() (jut "c")) ;; c: centre (defun c:jur() (jut "r")) ;; r: right (defun c:jutl() (jut "tl"));; t: top (defun c:jutc() (jut "tc")) (defun c:jutr() (jut "tr")) (defun c:juml() (jut "ml"));; m: middle (defun c:jumc() (jut "mc")) (defun c:jumr() (jut "mr")) (defun c:jubl() (jut "bl"));; b: Bottom (defun c:jubc() (jut "bc")) (defun c:jubr() (jut "br")) (defun jut (just / var ent) (setq var (getvar "CMDECHO")) (setvar "CMDECHO" 0) ;;https://www.cadtutor.net/forum/topic/35569-text-justification-lisp/ (princ (strcat "\nSelect Text")) (if (setq ss (ssget "_:L" '((0 . "ATTDEF,MTEXT,TEXT")))) (command "_.justifytext" ss "" just) ) (setvar "CMDECHO" var) (princ) )
    1 point
  3. Your drawing converted pretty good IMO. PL - text.dwg
    1 point
  4. I never once said anything about it being brilliant. I do not remember the steps, but you can flatten the PDF and use Acrobat's OCR before bringing into AutoCAD. I used to use Acrobat and Illustrator to create vector from PDF, etc. and previous to that GhostScript, pdftotxt and ImageMagick on PDFs. It's a learning curve, but up until a few years ago I did all of this on a Linux distro and used the terminal a lot. pdftotext(1) (xpdfreader.com ImageMagick – Download With a few tweaks, I usually get pretty good results, there are some settings, as well as you can add more fonts to match up. It is a pain in the *** it only does horizontal text. Though, if you could get a LISP to rotate the view to align them horizontal, it would speed things up. I never tried the OCR in Raster Design, but you could try making the lines in AutoCAD into an image and try different OCR programs, most do reasonably well on black letters on white background. Fortunately for me, I usually have to make them actual text only occasionally these days. Lots more people using TTF fonts as well helps. So here is the settings for set up the PDFSHXTEXT.
    1 point
  5. Just need to fix the hatch as it was non-associative. Here's that fix ; (command "_hatch" "s" p "") ;; Original hatch command. Created a non-associative hatch (command "-hatch" "P" "SOLID" "A" "A" "Y" "" "T" "." "S" p "" "") ;; Working for solid hatch with asssocitivity @mdchuyen, to hatch with pattern name: (command "-hatch" "P" "Ansi31" "555" "0" "A" "A" "Y" "" "T" "." "S" p "" "") ;; Hatch with pattern name where scale is 555.
    1 point
  6. You should change this line for (cons 40 th)
    1 point
  7. "matches the data in my own spreadsheet" it is possible to export data direct to excel, so the need to miss cells can be carried out fairly easy. Steven P I thought i sent you a copy of my Alan Excel Library.lsp or Getexcel.lsp either will show how to export or get data to and from excel, skipping the need for CSV.
    1 point
  8. If you want try... (defun c:tri ( / TA TB TC cc1 r1 cc2 r2 dce dxf_210 xi yi i cr1 cr2 vi xt yt h1 h2 h i1 i2 key) (setq Tx (if (not Tx) 65 Tx) TA (getstring (strcat "\nEnter start point of text <" (chr Tx) ">: ")) ) (if (not (eq TA "")) (setq Tx (1+ (setq TA (ascii TA)))) (setq TA Tx Tx (1+ Tx))) (setq TB (getstring (strcat "\nEnter end point of text <" (chr Tx) ">: "))) (if (not (eq TB "")) (setq Tx (1+ (setq TB (ascii TB)))) (setq TB Tx Tx (1+ Tx))) (setq TC (getstring (strcat "\nEnter third point of text <" (chr Tx) ">: "))) (if (not (eq TC "")) (setq Tx (1+ (setq TC (ascii TC)))) (setq TC Tx Tx (1+ Tx))) (initget 9) (setq cc1 (getpoint "\nPick specify start point?: ")) (initget 9) (setq cc2 (getpoint cc1 "\nPick or specify end point?: ")) (grdraw cc1 cc2 1) (initget 39) (setq r1 (getdist cc1 (strcat "\n" (chr TA) "<----->" (chr TC) " Length: "))) (initget 39) (setq r2 (getdist cc2 (strcat "\n" (chr TB) "<----->" (chr TC) " Length: "))) (grdraw cc1 cc2 0) (setq dce (distance cc1 cc2) dxf_210 (trans '(0 1 0) (getvar "UCSYDIR") 0) ) (if (equal (/ dce (+ r1 r2)) 1E-16) (setq xi (/ (+ (* r2 (car cc1)) (* r1 (car cc2))) dce) yi (/ (+ (* r2 (cadr cc1)) (* r1 (cadr cc2))) dce) i (cons xi (cons yi '(0.0))) ) (if (and (not (zerop (- r1 r2))) (equal (/ dce (+ r1 r2)) 1E-16)) (progn (if (= r1 (max r1 r2)) (setq cr1 cc1 cr2 cc2) (setq cr1 cc2 cr2 cc1) ) (setq xi (/ (- (* (max r1 r2) (car cr2)) (* (min r1 r2) (car cr1))) dce) yi (/ (- (* (max r1 r2) (cadr cr2)) (* (min r1 r2) (cadr cr1))) dce) i (cons xi (cons yi '(0.0))) ) ) (progn (if (or (> dce (+ r1 r2)) (< (+ (min r1 r2) dce) (max r1 r2))) (prompt "\nNo intersection !...") (progn (setq vi (angle cc1 cc2)) (if (> r1 r2) (setq xt (- (/ (* (+ r1 dce r2) (- (+ r1 dce) r2)) (* 2 dce)) r1) yt (- dce xt) h1 (sqrt (- (expt r1 2) (expt xt 2))) h2 (sqrt (- (expt r2 2) (expt yt 2))) xi (/ (+ (* yt (car cc1)) (* xt (car cc2))) dce) yi (/ (+ (* yt (cadr cc1)) (* xt (cadr cc2))) dce) ) (setq xt (- (/ (* (+ r2 dce r1) (- (+ r2 dce) r1)) (* 2 dce)) r2) yt (- dce xt) h1 (sqrt (- (expt r2 2) (expt xt 2))) h2 (sqrt (- (expt r1 2) (expt yt 2))) xi (/ (+ (* xt (car cc1)) (* yt (car cc2))) dce) yi (/ (+ (* xt (cadr cc1)) (* yt (cadr cc2))) dce) ) ) (setq h (/ (+ h1 h2) 2) i1 (polar (cons xi (cons yi '(0.0))) (+ vi (/ pi 2)) h) i2 (polar (cons xi (cons yi '(0.0))) (- vi (/ pi 2)) h) ) (princ "\n<Move cursor> for choice; <Enter>/[Space]/Right-Click for end!.") (while (and (not (member (setq key (grread T 4 2)) '((2 13) (2 32)))) (/= (car key) 25)) (redraw) (grdraw cc1 cc2 7) (cond ((eq (car key) 5) (if (< (distance i1 (cadr key)) (distance i2 (cadr key))) (set 'i i1) (set 'i i2) ) (grdraw cc1 i 7) (grdraw i cc2 7) ) ) ) (setq cc1 (trans cc1 1 dxf_210) cc2 (trans cc2 1 dxf_210) i (trans i 1 dxf_210) ) (entmake (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") (cons 67 (if (eq (getvar "CVPORT") 1) 1 0)) (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model")) (cons 8 (getvar "CLAYER")) (cons 62 (atoi (getvar "CECOLOR"))) (cons 6 (getvar "CELTYPE")) (cons 370 (getvar "CELWEIGHT")) '(100 . "AcDbPolyline") '(90 . 3) (if (eq (getvar "PLINEGEN") 1) '(70 . 129) '(70 . 1)) (cons 43 (getvar "PLINEWID")) (cons 38 (getvar "ELEVATION")) (cons 39 (getvar "THICKNESS")) (cons 10 (list (car cc1) (cadr cc1))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (cons 10 (list (car i) (cadr i))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (cons 10 (list (car cc2) (cadr cc2))) '(40 . 0.0) '(41 . 0.0) '(42 . 0.0) '(91 . 0) (cons 210 dxf_210) ) ) (mapcar '(lambda (d a p / ) (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 67 (if (eq (getvar "CVPORT") 1) 1 0)) (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model")) (cons 8 "Some layer") '(62 . 1) '(100 . "AcDbText") '(10 0.0 0.0 0.0) '(40 . 8) (cons 1 (strcat "(" (rtos d 2 2) ")")) (cons 50 (if (minusp (cos a)) (+ pi a) a ) ) '(72 . 1) (cons 11 p) (cons 210 dxf_210) '(100 . "AcDbText") '(73 . 1) ) ) ) (mapcar '(lambda (i / ) (distance (list (caar i) (cadar i)) (list (caadr i) (cadadr i)))) (list (list cc1 cc2) (list cc1 i) (list cc2 i))) (mapcar '(lambda (i / ) (angle (car i) (cadr i))) (list (list cc1 cc2) (list cc1 i) (list cc2 i))) (mapcar '(lambda (i / ) (list (* (+ (caar i) (caadr i)) 0.5) (* (+ (cadar i) (cadadr i)) 0.5))) (list (list cc1 cc2) (list cc1 i) (list cc2 i)) ) ) (mapcar '(lambda (x p / ) (entmake (list '(0 . "TEXT") '(100 . "AcDbEntity") (cons 67 (if (eq (getvar "CVPORT") 1) 1 0)) (cons 410 (if (eq (getvar "CVPORT") 1) (getvar "CTAB") "Model")) (cons 8 "Some layer") '(62 . 1) '(100 . "AcDbText") '(10 0.0 0.0 0.0) '(40 . 8) (cons 1 (chr x)) '(50 . 0.0) (cons 7 (getvar "TEXTSTYLE")) '(72 . 1) (cons 11 p) (cons 210 dxf_210) '(100 . "AcDbText") '(73 . 1) ) ) ) (list TA TB TC) (list cc1 cc2 i) ) (redraw) ) ) ) ) ) (prin1) )
    1 point
×
×
  • Create New...