Jump to content

Insert a point at each vertex of selected 2D or 3D polyline!


Margusrebase

Recommended Posts

Hi guy's, those codes are great! I was looking for something similar where in my actual file it would put a point at the 4 corners only .  MLE3060EMID W.dwg As i work at reducing the weight of the file i went from my 3d drawing to this 2D using a script but what'S lef is almost only line. I've tried all your lisp but it puts dots everywhere... :( Could you Help me to spot the corner of the "desk" 

Link to comment
Share on other sites

  • Replies 24
  • Created
  • Last Reply

Top Posters In This Topic

  • Margusrebase

    7

  • ronjonp

    5

  • Grrr

    5

  • Lee Mac

    3

On 10/9/2017 at 3:26 PM, Lee Mac said:

Here's another way:


(defun c:pvtx ( / e i p s )
   (if (setq s (ssget '((0 . "*polyline"))))
       (repeat (setq i (sslength s))
           (setq e (ssname s (setq i (1- i))))
           (repeat (- (setq p (fix (+ (vlax-curve-getendparam e) 1 1e-)) (logand 1 (cdr (assoc 70 (entget e)))))
               (entmake (list '(0 . "POINT") (cons 10 (vlax-curve-getpointatparam e (setq p (1- p))))))
           )
       )
   )
   (princ)
)
(vl-load-com) (princ)
 

FWIW, this:


(- (setq p (fix (+ (vlax-curve-getendparam e) 1 1e-)) (logand 1 (cdr (assoc 70 (entget e)))))
 

Could also be written:


(+ (setq p (fix (+ (vlax-curve-getendparam e) 1 1e-)) (vlax-get (vlax-ename->vla-object e) 'closed))
 

But the latter will likely be slower due to vlax-ename->vla-object.

 Hi Lee I went to you site and found the Bounding box Reactor But it's not loading. I tought that mayby it would have been the perfect solution to outline my drawing and the add point at vertext with one of these command

Link to comment
Share on other sites

1 hour ago, Jord_91 said:

Hi guy's, those codes are great! I was looking for something similar where in my actual file it would put a point at the 4 corners only .  MLE3060EMID W.dwg As i work at reducing the weight of the file i went from my 3d drawing to this 2D using a script but what'S lef is almost only line. I've tried all your lisp but it puts dots everywhere... :( Could you Help me to spot the corner of the "desk" 

 

RE; puting dots everywhere, is PDMODE set to 0 (zero) ? If so try setting it to 3.

Link to comment
Share on other sites

Bounding box will not work as you have lines, to get 4 corners join outside 1st.

 

Pretty quick to put 4 dots on this dwg manually.

 

You could do a min max of entities selected ie a defacto bounding box.

Lastly I have shorthands for osnap so make one for osmode 1 which is end point and a normal osnaps

 


(defun 1 ()(setvar 'osmode 1))

(defun 47 (setvar 'osmode 47))

 

to use type


1

point

pick corner spacebar

pick corner spacebar

pick corner spacebar

pick corner

47

 

 

 

 

Link to comment
Share on other sites

Use lee-mac Selection set bounding box. (setq box (LM:ssboundingbox (ssget))) returns the two corners. You can work out the others. Tested on your dwg.

Edited by BIGAL
Link to comment
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
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...