Jump to content

Recommended Posts

Posted

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

Posted

many examples just search ->  pdim by Marko

suppress arrow head looks tidy..

 

 

 

 

  • Like 1
Posted

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

Posted

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
Posted
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)

Posted

Try this

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

 

  • Like 1
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
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
Posted
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?

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...