DXF splitting and Merging

DXF splitting and Merging

Anonymous
Not applicable
745 Views
0 Replies
Message 1 of 1

DXF splitting and Merging

Anonymous
Not applicable

Hi, I Need to merge couple of DWG into a single Dwg for that I'm using the below Lisp code

 

(defun c:InsertBlks (/ d doc lst pt pt1 dir b blk blkn ex xx)
(vl-load-com)
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(if
(and (setq
dir (vl-filename-directory
(getfiled "Select a DWG for folder" (getvar 'dwgprefix) "dwg" 😎
)
)
(setq lst (vl-directory-files dir "*.dwg"))
(setq xx (princ (strcat "\n" (itoa (length lst)) " blocks found")))
(setq pt1 (getpoint "\nSelect ins.point for first block: "))
(setq d
(distance (getpoint pt1 "\nSelect distance to space blocks (or 0,0): ")
pt1
)
)
(setq ex (= "Y" (strcase (getstring "\nExplode inserted blocks? [Y/N] <N>: "))) xx T)
)
(foreach b lst
(princ (strcat "\n" b " "))
(setq blk (vla-insertblock
(if (= (getvar 'cvport) 1)
(vla-get-paperspace doc)
(vla-get-modelspace doc)
)
(vlax-3d-point (setq pt1 (polar pt1 0.0 d)))
(strcat dir "\\" b)
1
1
1
0.0
));insert, setq
(if ex (progn
(princ " exploding")
(setq blkn (vla-get-effectivename blk))
(vl-catch-all-apply 'vla-explode (list blk)) (vl-catch-all-apply 'vla-delete (list blk))
(vl-catch-all-apply 'vla-delete (list (vla-item (vla-get-blocks doc) blkn)))
))
); for
)
(princ "Done.")
(princ)
)

 

But now I have Several DXF which I need to merge in to Single DXF file  so someone could help me to update the Required changes in the Above code Dwg to DXF?

 

In addition to that can we have a Lisp solution where I could split back to Several DXF

thanks in advance

 

0 Likes
746 Views
0 Replies
Replies (0)