Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Pline Dimensioning!!

11 REPLIES 11
Reply
Message 1 of 12
Anonymous
2790 Views, 11 Replies

Pline Dimensioning!!

Hi,

I am looking for an AutoLISP routine, which gives all aligned dimensions of a closed polyline, drawn in 3d.

I have attached a 2D drawing for reference.

Regards,
Pradeep Hebbar
11 REPLIES 11
Message 2 of 12
Anonymous
in reply to: Anonymous

pradeep_hebbar wrote:

> I am looking for an AutoLISP routine, which gives all aligned
> dimensions of a closed polyline, drawn in 3d.

If someone doesn't throw something at you, email me dotson (at)
dotsoft.com. I've got this on my todo list and you can test (and
continue to use) it.

Terry
Message 3 of 12
Anonymous
in reply to: Anonymous

Hi pradeep_hebbar

Try this snip how it will work for you
Tested on A2005
Thank you

F.
;; Written by Luis Esquivel (brilliance routine!)
;; get coordinates
(defun get_vertices (obj / i verts)
(setq i (1- (vlax-curve-getendparam obj)))
(while (>= i 0)
(setq verts (cons (vlax-curve-getpointatparam obj i) verts)
i (1- i)
)
)
verts
)
(defun C:dimtest (/ acsp adoc cent_coords coords pl txt_coords)
(vl-load-com)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(setq acsp (vla-get-modelspace adoc))
(setq pl (vlax-ename->vla-object (car (entsel))))
(setq coords (get_vertices pl)
coords (append coords (list (car coords))))

(setq cent_coords (mapcar (function (lambda (x y)
(mapcar '/ (mapcar '+ x y) '(2 2 2)))) coords
(cdr coords)))
(setq txt_coords (mapcar (function (lambda (x y z)
(polar x (+ (angle y z) (/ pi 2)) 8.)))
cent_coords coords (cdr coords)))
(mapcar (function (lambda (x y z)
(vla-adddimaligned acsp x y z)))
(mapcar 'vlax-3d-point coords)
(mapcar 'vlax-3d-point (cdr coords))
(mapcar 'vlax-3d-point txt_coords))
(princ)
)
;TesT:(C:dimtest)
Message 4 of 12
Anonymous
in reply to: Anonymous

Hi,

Thanks Fatty,it was a nice one.

Regards,
Pradeep Hebbar
Message 5 of 12
Anonymous
in reply to: Anonymous

Hi Pradeep Hebbar

Glad it will work for you

Thank you

Fatty
Message 6 of 12
Anonymous
in reply to: Anonymous

Hi,

Is it posible to modify the program to work for 3d polyline, with some of the vertices having different (non zero) Z values ?

Rgds,
Pradeep Hebbar
Message 7 of 12
Anonymous
in reply to: Anonymous

Ok I try to do it

F.
Message 8 of 12
Anonymous
in reply to: Anonymous

Hi

See if this would work for you

F.

;helper function
(defun group-by-num (lst num / ls ret)
(if (= (rem (length lst) num ) 0)
(progn
(setq ls nil)
(repeat (/ (length lst) num)
(repeat num (setq ls
(cons (car lst) ls)
lst (cdr lst)))
(setq ret (append ret (list (reverse ls)))
ls nil)))
)
ret
)

(defun C:dimtest2 (/ acsp adoc cent_coords coords pl txt_coords)
(vl-load-com)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(setq acsp (vla-get-modelspace adoc))
(setq pl (vlax-ename->vla-object (car (entsel))))

(setq coords (vlax-get pl 'Coordinates)
coords (group-by-num coords 3)
coords (append coords (list (car coords))))

(setq cent_coords (mapcar (function (lambda (x y)
(mapcar '/ (mapcar '+ x y) '(2 2 2)))) coords
(cdr coords)))
(setq txt_coords (mapcar (function (lambda (x y z)
(polar x (+ (angle y z) (/ pi 2)) 8.)))
cent_coords coords (cdr coords)))
(mapcar (function (lambda (x y z)
(vla-adddimaligned acsp x y z)))
(mapcar 'vlax-3d-point coords)
(mapcar 'vlax-3d-point (cdr coords))
(mapcar 'vlax-3d-point txt_coords))
(princ)
)
;TesT:(C:dimtest2)
Message 9 of 12
Anonymous
in reply to: Anonymous

Hi,

Thanks for your efforts. It is working fine.


Regards,
Pradeep Hebbar
Message 10 of 12
Anonymous
in reply to: Anonymous

Hi

BTW first one works both with LW and 3DPLINE
and it work better I think

Thank you
happy lisping

:)
Message 11 of 12
Anonymous
in reply to: Anonymous

pradeep_hebbar wrote:

> Thanks for your efforts. It is working fine.

Unless your polyline is reversed?

Terry
Message 12 of 12
Anonymous
in reply to: Anonymous

hii again ,,,,  s there any lisp that join open vectors with sharp clean corners not the fzz distance one.

 

 

 

thanx

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost