RepCad Posted March 25, 2020 Posted March 25, 2020 Hi all, I need a lisp to add dimension to closed polyline, and is it possible to set all the dimension line only into the polyline? Thanks in advanced. dim.dwg Quote
hanhphuc Posted March 25, 2020 Posted March 25, 2020 many examples just search -> pdim by Marko suppress arrow head looks tidy.. 1 Quote
pmadhwal7 Posted March 25, 2020 Posted March 25, 2020 1 hour ago, amir0914 said: Hi all, I need a lisp to add dimension to closed polyline, and is it possible to set all the dimension line only into the polyline? Thanks in advanced. try this 1 hour ago, amir0914 said: dim.dwg 87.59 kB · 1 download AD-Automatic Dimension Autocad.LSP 1 Quote
RepCad Posted March 25, 2020 Author Posted March 25, 2020 Thank you, is there a way to find out if a point is inside or outside of a closed polyline? Quote
BIGAL Posted March 26, 2020 Posted March 26, 2020 This code is from an old post here I have removed the color problem. ; code by Alanjt (defun _isPointInside (polygon point / temp test) (if (vlax-curve-isClosed polygon) (progn (setq test (eq (length (vlax-invoke (setq temp (vlax-ename->vla-object (entmakex (list '(0 . "XLINE") '(100 . "AcDbEntity") '(100 . "AcDbXline") (cons 10 point) (cons 11 (trans '(1. 0. 0.) polygon 0)) ) ) ) ) 'IntersectWith (vlax-ename->vla-object polygon) acExtendNone ) ) 6 ) ) (vla-delete temp) test ) ) ) ( (_isPointInside (car (entsel "\nselect pline"))(getpoint "\nPick a point")) returns T 1 Quote
RepCad Posted March 26, 2020 Author Posted March 26, 2020 6 hours ago, BIGAL said: This code is from an old post here I have removed the color problem. ; code by Alanjt (defun _isPointInside (polygon point / temp test) (if (vlax-curve-isClosed polygon) (progn (setq test (eq (length (vlax-invoke (setq temp (vlax-ename->vla-object (entmakex (list '(0 . "XLINE") '(100 . "AcDbEntity") '(100 . "AcDbXline") (cons 10 point) (cons 11 (trans '(1. 0. 0.) polygon 0)) ) ) ) ) 'IntersectWith (vlax-ename->vla-object polygon) acExtendNone ) ) 6 ) ) (vla-delete temp) test ) ) ) ( (_isPointInside (car (entsel "\nselect pline"))(getpoint "\nPick a point")) returns T Thank you BIGAL, that was very helpful, I have another question : I'm trying to run circle command for each item in list, but it's not working :(3 is radius) lst = ((x1 y1 z1) (x2 y2 z3) (x3 y3 z3) ..) (mapcar 'Circle (list lst) 3) Quote
BIGAL Posted March 26, 2020 Posted March 26, 2020 Try this (repeat (setq x (length lst)) (setq pt (nth (setq x (- x 1)) lst)) (command "circle" pt 3.0) ) 1 Quote
RepCad Posted March 26, 2020 Author Posted March 26, 2020 (edited) 2 hours ago, BIGAL said: Try this (repeat (setq x (length lst)) (setq pt (nth (setq x (- x 1)) lst)) (command "circle" pt 3.0) ) I knew it before, but I would write that with mapcar or lambda or apply. like this function for midpoint: (defun mid (p1 p2) (mapcar (function (lambda (a1 a2) (/ (+ a1 a2) 2.0))) p1 p2) ;| #lambda |; ) Edited March 26, 2020 by amir0914 Quote
BIGAL Posted March 26, 2020 Posted March 26, 2020 (edited) Thinking a bit more its easily solved if you use is pline clockwise or anti, you can use Reveres to do just that on the pline. Then can use vertices as internal angle is always +90. Need though arc to be done differently. I have a check anti but I need a better one. Your other question (foreach pt lst (Command "circle" pt 3)) Edited March 26, 2020 by BIGAL 1 Quote
RepCad Posted March 28, 2020 Author Posted March 28, 2020 On 3/27/2020 at 3:39 AM, BIGAL said: Thinking a bit more its easily solved if you use is pline clockwise or anti, you can use Reveres to do just that on the pline. Then can use vertices as internal angle is always +90. Need though arc to be done differently. I have a check anti but I need a better one. Your other question (foreach pt lst (Command "circle" pt 3)) Thanks for your reply, my first issue has been resolved by draw a ray and find out the point if is inside or outside of the polyline. now, only problem I have that is the dimension text string has overlap with other texts in polyline. do have a way for this problem? Quote
pkenewell Posted April 1, 2020 Posted April 1, 2020 FYI - if you want to explore the topic more, here is a variant I did on Stephan's program for doing vertical and horizontal dims. AD-Automatic Dimension Autocad (4).LSP Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.