Jump to content
amir0914

Polyline Dimension

Recommended Posts

amir0914

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.

Screenshot (1456).png

dim.dwg

Share this post


Link to post
Share on other sites
hanhphuc

many examples just search ->  pdim by Marko

suppress arrow head looks tidy..

 

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites
pmadhwal7
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.

Screenshot (1456).png

 

 

try this

 

 

1 hour ago, amir0914 said:

 

AD-Automatic Dimension Autocad.LSP

  • Like 1

Share this post


Link to post
Share on other sites
amir0914

Thank you, is there a way to find out if a point is inside or outside of a closed polyline? 

Share this post


Link to post
Share on other sites
BIGAL

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 

  • Like 1

Share this post


Link to post
Share on other sites
amir0914
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)

Share this post


Link to post
Share on other sites
BIGAL

Try this

(repeat (setq x (length lst))
(setq pt (nth (setq x (- x 1)) lst))
(command "circle" pt 3.0)
)

 

  • Like 1

Share this post


Link to post
Share on other sites
amir0914
Posted (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 by amir0914

Share this post


Link to post
Share on other sites
BIGAL
Posted (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 by BIGAL
  • Like 1

Share this post


Link to post
Share on other sites
amir0914
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?

Share this post


Link to post
Share on other sites
pkenewell

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

Share this post


Link to post
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...