Boundary Error "Point is directly on an object"

Boundary Error "Point is directly on an object"

jaimuthu
Advocate Advocate
525 Views
6 Replies
Message 1 of 7

Boundary Error "Point is directly on an object"

jaimuthu
Advocate
Advocate
(defun c:p2h (/ _addhatch _boundary b spc s)
  (defun _addhatch (spc bnd lyr / h)
    (if	(setq h (vlax-invoke spc 'addhatch achatchobject "Solid" :vlax-true))
      (progn (vlax-invoke h 'appendouterloop (list bnd))
	     (vla-put-layer h lyr)
	     (vla-evaluate h)
	     (vla-update h)
	     h
      )
    )
  )
  (defun _boundary (p / e)
    (setq e (entlast))
    (bpoly p)
    (if	(not (equal e (entlast)))
      (entlast)
    )
  )
  (cond
    ((setq s (ssget '((0 . "POINT"))))
     (setq spc (vlax-ename->vla-object (cdr (assoc 330 (entget (ssname s 0))))))
     (setvar 'cmdecho 0)
     (command "_.undo" "_begin")
     (foreach e	(vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
       (if (setq b (_boundary (cdr (assoc 10 (entget e)))))
	 (progn (_addhatch spc (vlax-ename->vla-object b) (cdr (assoc 8 (entget e)))) (entdel b))
       )
     )
     (command "_.undo" "_end")
     (setvar 'cmdecho 1)
    )
  )
  (princ)
)
0 Likes
Accepted solutions (2)
526 Views
6 Replies
Replies (6)
Message 2 of 7

Moshe-A
Mentor
Mentor
Accepted solution

@jaimuthu  hi,

 

The problem with this drawing...under each point there is a small line with 0.2 length

for test, remove this line and run the lisp and you will see it does work.

 

Moshe

 

0 Likes
Message 3 of 7

jaimuthu
Advocate
Advocate

yes i did not see the line Thanks for your Reply

0 Likes
Message 4 of 7

komondormrex
Mentor
Mentor
Accepted solution

@jaimuthu 

move tested point for boundary 20 units higher

(defun c:p2h (/ _addhatch _boundary b spc s)
  (defun _addhatch (spc bnd lyr / h)
    (if	(setq h (vlax-invoke spc 'addhatch achatchobject "Solid" :vlax-true))
      (progn (vlax-invoke h 'appendouterloop (list bnd))
	     (vla-put-layer h lyr)
	     (vla-evaluate h)
	     (vla-update h)
	     h
      )
    )
  )
  (defun _boundary (p / e)
    (setq e (entlast))
    (bpoly p)
    (if	(not (equal e (entlast)))
      (entlast)
    )
  )
  (cond
    ((setq s (ssget '((0 . "POINT"))))
     (setq spc (vlax-ename->vla-object (cdr (assoc 330 (entget (ssname s 0))))))
     (setvar 'cmdecho 0)
     (command "_.undo" "_begin")
     (foreach e	(vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
       (if (setq b (_boundary (mapcar '+ '(20 0) (cdr (assoc 10 (entget e))))))
	 (progn (_addhatch spc (vlax-ename->vla-object b) (cdr (assoc 8 (entget e)))) (entdel b))
       )
     )
     (command "_.undo" "_end")
     (setvar 'cmdecho 1)
    )
  )
  (princ)
)

 

0 Likes
Message 5 of 7

jaimuthu
Advocate
Advocate

its work thanks for your reply

0 Likes
Message 6 of 7

jaimuthu
Advocate
Advocate

thank

0 Likes
Message 7 of 7

jaimuthu
Advocate
Advocate

work

0 Likes