Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 11/07/2023 in all areas

  1. Try this: The values for x, y scales and rotation should be a number, not a string (Number: 1 or string: "1") The point should be a list and not a string. - Replaced your El_mm line to keep it as a number (worth doing a check if this value comes from another LISP that it is a number) - 2 different options to calculate the point, P_fixed, the second half of the mapacar line is a good example how to set elevation to 0 (mapcar '* '(1 1 0) P)) - Insert as described above (defun c:test ( / ) (setq P (getpoint "Pick Point: \n")) ;; pick point (setq El_mm 105100) ;; New Elevation (setq P_fixed (mapcar '+ (list 0 0 El_mm) (mapcar '* '(1 1 0) P))) ;;Point at elevation ;;or (setq P_fixed (list (car p) (cadr pt) EL_mm)) ;;Point at elevation (command "-insert" "C:\\Myblock\\RBlock.dwg" P_fixed 1 1 0) )
    2 points
  2. First thing you have to know is the center from which you will define cw direction. Here you have a little problem, since the center is usually defined as a polygon centroid. So in some cases the top dimension will not be considered first (image attached to explain better). You could manually pick center if that is an option. Here is the code from Lee Mac, with a little adjustment so the north is start of direction, code from https://www.theswamp.org/index.php?topic=36854.msg418494#msg418494 EDIT: result here is a list of dimension coordinates, just to mention that (setq ss (ssget (list (cons 0 "TEXT") (cons 8 "-Parcel Dim") (cons 410 (getvar "ctab"))))) (setq n 0) (setq coord_lst nil) (while (< n (sslength ss)) (setq coord (cdr (assoc 10 (entget (ssname ss n))))) (setq coord_lst (cons coord coord_lst)) (setq n (1+ n)) );while (setq coord_lst_cw ((lambda (ref 2pi) (vl-sort coord_lst (function (lambda (a b) (> (2pi (- (angle ref a) (/ pi 2))) (2pi (- (angle ref b) (/ pi 2)))))))) ((lambda (n) (mapcar '/ (apply 'mapcar (cons '+ coord_lst)) (list n n n))) (float (length coord_lst))) (lambda (a) (rem (+ pi pi a) (+ pi pi)))) );setq
    2 points
  3. if your want to use the point with visual lisp instead of command in Autocad you need to wrap the xyz with vlax-3D-point function. (setq P_fixed (vlax-3D-point (list (car p) (cadr p) EL_mm)))
    1 point
  4. To Fuccaro, you dont need this if the situation is always as indicated in sample dwg. The desired pline is boundary around text and no other plines etc within the shape. (princ "select polyline") (setq pl (entget (car (entsel))) If you use bpoly using the text insert point, then pl is (entlast) get co-ords etc run code then delete the dummy pl. Just a suggestion. Why not use. (setq pl (entget (car (entsel "\nPlease pick pline ")))
    1 point
  5. One obvious is your setting the ctb after you have plotted. Move that step to start of code.
    1 point
  6. 1 point
  7. May I try again? (defun c:pp () (princ "Select center text") (setq c (car (entsel)) cPoz (cdr (assoc 10 (entget c))) h (cdr (assoc 40 (entget c)))) (princ "select polyline") (setq pl (entget (car (entsel))) points (mapcar 'cdr (vl-remove-if-not '(lambda (x) (= 10 (car x))) pl)) ) (setq ss (ssget "wp" points '((0 . "TEXT")))) (ssdel c ss) (setq txt nil) (repeat (setq i (sslength ss)) (setq el (entget (ssname ss (setq i (1- i)))) txt (cons (list (cdr (assoc 1 el)) (setq ang (- (/ pi 2.0) (angle cPoz (cdr (assoc 10 el))))) ) txt ) ) ) (setq txt (vl-sort txt '(lambda(a b) (< (cadr a) (cadr b)))) txt1 (mapcar 'abs (mapcar 'cadr txt)) vmin (apply 'min txt1) i (- (length txt) (length (member vmin txt1))) p1 (getpoint "start of list")) (repeat (length txt) (princ (strcat "| " (itoa i) " " (car (nth i txt)))) (entmake (list '(0 . "TEXT") (cons 1 (car (nth i txt))) (cons 40 h) (cons 10 p1))) (setq i (if (< i (1- (length txt))) (1+ i) 0) p1 (mapcar '+ p1 (list 0 (* h -1.5) 0))) ) )
    1 point
  8. 1 point
  9. This will process correct only the line segments of the polyline: (defun c:pp() (princ "Select center text") (setq c (cadr (entsel))) (princ "select polyline") (setq pl (entget (car (entsel))) points nil txtH 4) ;txtH is the height of the text. Change to suit (setq p2 (cdr (assoc 10 (reverse pl)))) (foreach x pl (cond ((= 10 (car x)) (setq p1 (cdr x) txt (rtos (* 1.0 (distance p1 p2))) poz1 (mapcar '/ (mapcar '+ p1 p2) (list 2 2)) poz (polar c (angle c poz1) (- (distance c poz1) (* 1.5 txtH))) en (entmake (list '(0 . "TEXT") (cons 1 txt) (cons 10 poz) (cons 40 txtH) (cons 50 (angle p2 p1)))) p2 p1 )) ) ) )
    1 point
  10. Just a comment Ar-conc misbehaves so does Gravel when you are working in real world co-ordinates like 52712245,297678. A simple fix is to set the hatch origin to a point on your project.
    1 point
  11. 1st comment 11.175 is missing in lot 564. Getting the text is the easy part. Doing a output in the way you want is complicated. Lee-mac has a nice pline output, that may be useful. http://www.lee-mac.com/polyinfo.html
    1 point
  12. You'll need to set that up in your Dimension Style. Check through the FIT category. See the "Draw dim line between ext lines" (DIMTOFL sysvar) and check it, test some of the other options as well.
    1 point
  13. Type Diameter Dimension tool measures the diameter of an arc or circle. To create a Diameter dimension, click object 1 (i.e. - the circle) then click point 2 (on outside of circle) to create the dimension line.
    1 point
×
×
  • Create New...