Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/15/2019 in all areas

  1. Hello All, The CADTutor website will be moving to a new web host shortly and I thought it best to give you advanced warning. Although the moving of files from one server to another can be done quite quickly, there is always a delay while DNS propagation takes place, so and it's likely that this forum will be closed for around two days (hopefully less) while the migration takes place. The rest of the site will remain available during migration. Other than the temporary closure of the forum, you shouldn't notice any other changes except that (hopefully) the site will appear more responsive. I don't yet have a firm timescale for this but it's likely to take place in the next two weeks. I'll update this thread once I know more details.
    1 point
  2. Try this: (defun c:foo (/ a h j l lines mp p p3 p4 pa r s text) ;; Get a list of midpoints and angles ( not for arced segments ) (defun _mpa (e / l l2) (setq l (mapcar 'cdr (vl-remove-if-not '(lambda (x) (vl-position (car x) '(10 11))) (entget e))) ) (setq l2 (append (cdr l) (list (car l)))) (mapcar '(lambda (r j) (list (mapcar '/ (mapcar '+ r j) '(2 2)) (angle r j))) l l2) ) ;; RJP » 2019-08-15 (if (setq s (ssget ":L" '((0 . "Lwpolyline,Line,Text")))) (progn (foreach x (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (if (= "TEXT" (cdr (assoc 0 (entget x)))) (setq text (cons x text)) (setq lines (cons (_mpa x) lines)) ) ) (if (setq lines (apply 'append lines)) (foreach x text (setq p (cdr (assoc 11 (entget x)))) (setq l (car (vl-sort lines '(lambda (a b) (< (distance p (car a)) (distance p (car b)))))) ) (setq h (* 0.75 (cdr (assoc 40 (entget x))))) (setq p3 (polar (setq mp (car l)) (setq pa (+ (/ pi 2) (setq a (cadr l)))) h)) (setq p4 (polar mp (+ pi pa) h)) (if (< (distance p p4) (distance p p3)) (setq p3 p4) ) (entmod (subst (cons 50 (lm:readable a)) (assoc 50 (entget x)) (entget x))) (entmod (subst (cons 10 p3) (assoc 10 (entget x)) (entget x))) (entmod (subst (cons 11 p3) (assoc 11 (entget x)) (entget x))) (grdraw p p3 3) ) ) ) ) (princ) ) (defun lm:readable (a) ((lambda (a) (if (and (< (* pi 0.5) a) (<= a (* pi 1.5))) (lm:readable (+ a pi)) a ) ) (rem (+ a pi pi) (+ pi pi)) ) )
    1 point
  3. It can be modified but really a quick fix for your sample drawing is to explode the polylines then run the code.
    1 point
  4. Solved, thanks to all. True Type Font the solution.
    1 point
  5. 1 point
  6. If you want the actual height of the text in the drawing use the TEXTBOX function. A string with the same height like "1234" will not be the same physical height as "{1234,". Try it (if (setq e (car (entsel "\nPick text: "))) (print (abs (apply '- (mapcar 'cadr (textbox (entget e)))))) )
    1 point
  7. Can you explain why you want to achieve this?
    1 point
×
×
  • Create New...