Jump to content
Sign in to follow this  
nalsur8

Separate/copy layer to other place by user pick point then sorting them..

Recommended Posts

nalsur8

Separate/copy layer to other place by user pick point then sorting them horizontal

 

below code not sorting horizontal.how to change the code, become horizontal (see image attached)

 

(defun c:test1 ( / _move d ss l lst ) (vl-load-com)
 (defun _move ( obj p q dist )
   (vla-move (setq obj (vla-copy obj)) (vlax-3D-point p) (vlax-3D-point q))
   (vla-move obj (vlax-3D-point '(0. 0. 0.)) (vlax-3D-point (list dist 0. 0.)))
 )
 (if
   (and
     (ssget "_:L")
     (setq p1 (getpoint "\nBase Point: "))
     (setq p2 (getpoint "\nDesired Location: " p1))
     (setq p1 (trans p1 1 0) p2 (trans p2 1 0))
   )
   (progn
     (vlax-for obj (setq d 10. ss (vla-get-ActiveSelectionSet (vla-get-ActiveDocument (vlax-get-acad-object))))
       (_move obj p1 p2
         (cond
           ( (cdr (assoc (setq l (vla-get-layer obj)) lst)) )
          ((cdr (assoc (vl-string-right-trim "D" l) lst)))
                ((cdr (assoc (strcat l "D") lst)))
           ( (setq lst (cons (cons l (setq d (- d 650.))) lst)) d )
         )
       )
     )
     (vla-delete ss)
   )
 )
 (princ)
)

lay sort.jpg

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Sign in to follow this  

×
×
  • Create New...