Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/08/2018 in all areas

  1. You must have your UCS other than World system and that's why the mark point located somewhere else. Anyway, I have updated my previous post and please replace them again then try again. NOTE: its not necessarily to quote every reply to write a reply but its up to you anyway.
    1 point
  2. Just replace this: (alert (strcat "Centriod = " (vl-princ-to-string cen))) with this: (entmake (list '(0 . "POINT") (cons 10 (trans cen 0 1)))) And get sure is that the PDMODE system variable is other than zero to be able to see the mark point.
    1 point
  3. Hi, Give this a shot and let me know. (defun c:cnt ( / nxt pnt lst obj reg cen) ;;--------------------------------------------;; ;; Tharwat - Date: 08.12.2018 ;; ;; Print Centriod point from picked points. ;; ;;--------------------------------------------;; (cond ((= 4 (logand 4 (cdr (assoc 70 (entget (tblobjname "LAYER" (getvar 'CLAYER))))))) (alert "Current layer is locked<!>")) ((and (setq nxt " ") (while (setq pnt (getpoint (strcat "\nSpecify" nxt "point : "))) (setq lst (cons pnt lst) nxt " Next ") ) lst (setq obj (entmakex (append (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(100 . "AcDbPolyline") (cons 90 (length lst)) '(70 . 1)) (mapcar (function (lambda (p) (cons 10 p))) lst)))) ) (cond ((vl-catch-all-error-p (setq reg (vl-catch-all-apply 'vlax-invoke (list (vla-get-block (vla-get-activelayout (vla-get-ActiveDocument (vlax-get-acad-object) ) ) ) 'Addregion (list (vlax-ename->vla-object obj)) ) ))) (alert "Error. Can't create the region <!>")) (t (setq reg (car reg) cen (vlax-get reg 'Centroid)) (alert (strcat "Centriod = " (vl-princ-to-string cen))) (print cen) (vla-delete reg)) )) ) (and obj (entdel obj)) (princ) ) (vl-load-com) (princ "\nType CNT to start.")
    1 point
  4. Study this example and it should be clear to you what to modify to get sub function work with point list... Note that it would be preferable to draw polygon in advance as segments must not cross each other... So actually you don't need to modify anything from Lee's examples - you have to provide LWPOLYLINE polygon ENAME as an argument... http://www.lee-mac.com/polygoncentroid.html HTH., M.R.
    1 point
×
×
  • Create New...