Jump to content

Copy a pipe Network item from XREF to current Drawing as Polyline


RamboGT
 Share

Recommended Posts

I'm trying to figure out how to write a LISP command where I can click on multiple pipe network pipes from an XREF, and it copies them into my current drawing on the current layer, changing the linetype to contiguous, color to ByLayer, and seta  global width of 1.

 

Current theory on how this 'might' be accomplished:

-click on xref pipe network pipe

-it ncopy's item with base point 0,0

-explode items

-burst items

-set global width of all items to 1

-change linetype to contiguous for all items

-change layer to current layer for all items

-join all items that are touching (create one polyline from a group of pipe network pipe items)

 

Thoughts?

 

Thanks.

 

--Matt

Edited by RamboGT
Link to comment
Share on other sites

I don't think you can use ncopy with xref. This is what i came up with last February. (might need some tweaking)

 

Edited by mhupp
  • Like 1
Link to comment
Share on other sites

This is what I use to copy nested items.

(defun c:copyn (/ a b e el i la o ss tm)
  ;; RJP » 2022-11-29
  (sssetfirst nil (setq ss (ssadd)))
  (while (setq e (nentselp "Select nested object to copy: "))
    (cond
      ((wcmatch (setq a (cdr (assoc 0 (entget (car e))))) "ACAD_PROXY_ENTITY,VERTEX")
       (princ (strcat "\n" a " not supported..."))
      )
      ((not (setq tm (caddr e))) (princ (strcat "\n" a " item selected is not nested...")))
      ((setq el (entget (car e)))
       ;; Match layer properties after stripping out *| from name if found
       (and (setq la (entget (tblobjname "layer" (cdr (assoc 8 el)))))
	    (setq i (vl-string-position 124 (cdr (assoc 8 el)) 0 t))
	    (entmake (subst (cons 2 (setq b (substr (cdr (assoc 8 el)) (+ 2 i)))) (assoc 2 la) la))
       )
       (setq e (entmakex (append el
				 (list (cons 410 (getvar 'ctab))
				       (if i
					 (cons 8 b)
					 (assoc 8 el)
				       )
				 )
			 )
	       )
       )
       (vla-transformby (setq o (vlax-ename->vla-object e)) (vlax-tmatrix tm))
       (vla-update o)
       (ssadd e ss)
       (princ (strcat "\nEntity created [ " a " ]"))
      )
    )
  )
  (setvar 'cmdecho 0)
  (command "_.Draworder" ss "" "_Front")
  (setvar 'cmdecho 1)
  (sssetfirst nil ss)
  (princ)
)

 

Link to comment
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.   Restore formatting

  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.

 Share

×
×
  • Create New...