• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

selection points and change their layer on 3d polylinee

  • Thread starter Thread starter siba0016
  • Start date Start date

siba0016

Guest
Hello, I am working in a file with many points that are all in the same layer. I would like to assign, if possible through a lisp, the layer of polylinea to the points that are contained there.
3d open polylinee work in autocad.
Thank you.
 
the points are found both in polylinea and in the vertices.
I have a 3d polylinea and points along the polylinea, end and knots
 
See if it's your case.
Code:
(defun c:test ( / points 3dp 3dplst n int pt npl pl)
    (command "_.undo" "_begin")
    (if (and
            (setq points (ssget "_x" '((0 . "point"))))
            (setq 3dp (ssget "_x" '((0 . "polyline") (-4 . "&=") (70 . 8))))
        )
        (progn
            (repeat (setq n (sslength 3dp))
                (setq 3dplst (cons (vlax-ename->vla-object (ssname 3dp (setq n (1- n)))) 3dplst))
            )
            (repeat (setq n (sslength points))
                (setq pt (vlax-ename->vla-object (ssname points (setq n (1- n)))))
                (setq npl (length 3dplst))                
                (while
                    (progn
                        (setq int (vlax-invoke pt 'intersectwith (setq pl (nth (setq npl (1- npl)) 3dplst)) acextendnone))
                        (if int (vla-put-layer pt (vla-get-layer pl)))
                        (not (or int (zerop npl)))
                    )
                )
            )
        )
    )
    (command "_.undo" "_end")
    (princ)    
)
 
See if it's your case.
Code:
(defun c:test ( / points 3dp 3dplst n int pt npl pl)
    (command "_.undo" "_begin")
    (if (and
            (setq points (ssget "_x" '((0 . "point"))))
            (setq 3dp (ssget "_x" '((0 . "polyline") (-4 . "&=") (70 . 8))))
        )
        (progn
            (repeat (setq n (sslength 3dp))
                (setq 3dplst (cons (vlax-ename->vla-object (ssname 3dp (setq n (1- n)))) 3dplst))
            )
            (repeat (setq n (sslength points))
                (setq pt (vlax-ename->vla-object (ssname points (setq n (1- n)))))
                (setq npl (length 3dplst))                
                (while
                    (progn
                        (setq int (vlax-invoke pt 'intersectwith (setq pl (nth (setq npl (1- npl)) 3dplst)) acextendnone))
                        (if int (vla-put-layer pt (vla-get-layer pl)))
                        (not (or int (zerop npl)))
                    )
                )
            )
        )
    )
    (command "_.undo" "_end")
    (princ)    
)
Thanks, it works in 80% of the cases, it saved me a lot of work, only flaw, does not feel the 3d polylines generated by splilines.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top