Hi.
I have a drawing with multiple lines and arcs.
I need to place a point od every line end and every arc end and every arc mid.
Overkill at the end to delete multiple.
Please help.
Thank you.
Kind regards,
Dario
Solved! Go to Solution.
Solved by ВeekeeCZ. Go to Solution.
Solved by ВeekeeCZ. Go to Solution.
This is your code modified to add a label with a prompt to choose a starting value.
Thoughts?
(vl-load-com)
(defun c:nobiscumv11 (/ s e i a b c p l startnum)
(setq startnum (getint "\nEnter the starting label number: "))
(if (setq s (ssget '((0 . "ARC,LINE"))))
(repeat (setq i (sslength s))
(setq e (ssname s (setq i (1- i)))
a (vlax-curve-getstartpoint e)
b (vlax-curve-getendpoint e)
c (if (= "ARC" (cdr (assoc 0 (entget e))))
(vlax-curve-getpointatdist e (/ (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) 2))))
(foreach p (list a b c)
(if (and p (not (vl-remove-if-not '(lambda (x) (equal p x 1e-5)) l)))
(setq l (cons p l))))))
(foreach p l
(setq textstr (strcat "" (itoa startnum)))
(setq textent (entmakex
(list (cons 0 "TEXT")
(cons 10 (list (+ (car p) 1.0) (+ (cadr p) 1.0) 0.0))
(cons 1 textstr)
(cons 40 1.25)
(cons 7 "STANDARD")
)
))
(entupd textent)
(setq startnum (1+ startnum))
(entmake (list '(0 . "POINT") (cons 10 p))))
(princ)
)
Try this then.
(vl-load-com) (defun c:nobiscumv11 ( / *error* s e i a b c p l f n) (defun *error* (errmsg) (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end")) (princ (strcat "\nError: " errmsg))) (if f (close f)) (princ)) (if (and (setq s (ssget '((0 . "ARC,LINE")))) (setq n (1- (cond ((getint "Initial number <1>: ")) (1)))) (setq f (open (strcat (getvar 'DWGPREFIX) (vl-string-right-trim ".dwg" (getvar 'DWGNAME)) "-Coord.csv") "w")) (write-line "NAZIV,E(HTRS),N(HTRS),Z" f) ; heading ) (repeat (setq i (sslength s)) (setq e (ssname s (setq i (1- i))) a (vlax-curve-getstartpoint e) b (vlax-curve-getendpoint e) c (if (= "ARC" (cdr (assoc 0 (entget e)))) (vlax-curve-getpointatdist e (/ (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) 2)))) (foreach p (list a c b) (if (and p (not (vl-remove-if-not '(lambda (x) (equal p x 1e-5)) l))) (setq l (cons p l)))))) (foreach p l (entmake (list '(0 . "POINT") (cons 10 p))) (entmake (list '(0 . "TEXT") (cons 10 (mapcar '+ p '(0.2 0.2 0))) '(40 . 1.25) (cons 1 (itoa (setq n (1+ n)))))) (write-line (strcat (itoa n) "," (rtos (car p) 2 2) "," (rtos (cadr p) 2 2) "," (rtos (caddr p) 2 2)) f)) (*error* "end") )
Very good.
One final request would be to separate exported values into columns.
Thank you very much.
Well, that was my previous question about......
(vl-load-com) (defun c:nobiscumv11 ( / *error* s e i a b c p l f n) (defun *error* (errmsg) (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end")) (princ (strcat "\nError: " errmsg))) (if f (close f)) (princ)) (if (and (setq s (ssget '((0 . "ARC,LINE")))) (setq n (1- (cond ((getint "Initial number <1>: ")) (1)))) (setq f (open (strcat (getvar 'DWGPREFIX) (vl-string-right-trim ".dwg" (getvar 'DWGNAME)) "-Coord.csv") "w")) (write-line "NAZIV;E(HTRS);N(HTRS);Z" f) ; heading ) (repeat (setq i (sslength s)) (setq e (ssname s (setq i (1- i))) a (vlax-curve-getstartpoint e) b (vlax-curve-getendpoint e) c (if (= "ARC" (cdr (assoc 0 (entget e)))) (vlax-curve-getpointatdist e (/ (vlax-curve-getdistatparam e (vlax-curve-getendparam e)) 2)))) (foreach p (list a c b) (if (and p (not (vl-remove-if-not '(lambda (x) (equal p x 1e-5)) l))) (setq l (cons p l)))))) (foreach p l (entmake (list '(0 . "POINT") (cons 10 p))) (entmake (list '(0 . "TEXT") (cons 10 (mapcar '+ p '(0.2 0.2 0))) '(40 . 1.25) (cons 1 (itoa (setq n (1+ n)))))) (write-line (strcat (itoa n) ";" (vl-string-translate "." "," (rtos (car p) 2 2)) ";" (vl-string-translate "." "," (rtos (cadr p) 2 2)) ";" (vl-string-translate "." "," (rtos (caddr p) 2 2))) f)) (*error* "end") )
I would like to keep the point as a decimal point but have the values separated into columns.
Are they always a closed shape if so use bpoly make a new pline and number the vertices will be in sequential order, so long as the shape is closed and no miscloses.
The dwg is a bit to simple as I expect not all shapes will be like the sample, so no code, can you provide a more detailed dwg ? If the dwg is correct say so and easy task to do.