David Bethel 发表于 2022-7-5 19:10:17

 
 
 
Storing the enames makes more sense than an (ssget) call.Well done as always !-David

Lee Mac 发表于 2022-7-5 19:11:07

 
Thanks David
 
 
Excellent to hear!
 
 
I'm not sure why the two programs would yielddifferent results, as the process of determining a duplicate point isessentially following the same method in both programs (rounding X &Y to a given tolerance and querying the result against an associationlist); my code uses a tolerance of 0.001 defined at the top of the code,whereas David's prompts the user for the tolerance, therefore, did youuse the same tolerance when testing both programs?
 
Lee

sethacre 发表于 2022-7-5 19:16:36

Sorry I got late for the answer.
 
Tolerance was predefined as 0.001 at David's code and shown in the command box. When prompted i just pressed enter. I tried typing 0.001 and ended up with the same result.

BIGAL 发表于 2022-7-5 19:20:13

Tharwat just for your info you can set rules in CIV3d when triangulating to make the surface and the obvious one is a Z must be more than 0.0 so no need to add extra code. Obviously you can go negative when surveying below sea level.
 
When our guys survey a retaining wall they take top and bottom two points on top of each other but they make sure they are a few mm apart so not true vertical then can have a breakline top and bottom and they do not cross.

David Bethel 发表于 2022-7-5 19:23:50

Interesting.Can you post a sample dwg ?

sethacre 发表于 2022-7-5 19:28:28

Sure.
 
These are the points of a corrider surface from another local CAD program.
DupPoints.DWG

David Bethel 发表于 2022-7-5 19:30:32

That is weird.Using a similar approach as Lee. I get 1234 entities on the new layer ( 107 duplicates )
 

(defun c:maxz-dps (/ ln lc f ss i en ed pt rp z fl) (setq ln "NEW1" lc 1) (while (tblsearch "LAYER" ln)      (setq lc (1+ lc) ln (strcat "NEW" (itoa lc)))) (initget 6) (setq f (getdist "\nPoint Value Tolerence :   ")) (or f (setq f 0.001)) (and (setq ss (ssget '((0 . "POINT"))))      (setq i 0)      (while (setq en (ssname ss i))             (setq ed (entget en)                   pt (cdr (assoc 10 ed))                   rp (list (round (car pt) f)                            (round (cadr pt) f))                  z (caddr pt))             (cond ((not (assoc rp fl))                  (setq fl (cons (list rp z en) fl)))                   ((> z (nth 1 (assoc rp fl)))                  (setq fl (subst (assoc rp fl) (list rp z en) fl))))             (setq i (1+ i)))) (princ (strcat "\nMoving Points To Layer " ln)) (foreach p fl    (setq ed (entget (nth 2 p)))    (entmod (subst (cons 8 ln) (assoc 8 ed) ed))) (prin1));;VVA(defun round (num prec) (* prec (if (minusp num)             (fix (- (/ num prec) 0.5))             (fix (+ (/ num prec) 0.5)))))
 
 
-David
页: 1 [2]
查看完整版本: 选择重复点