i need a autolips code to save all the block in the file to individual dxf with its block name
Solved! Go to Solution.
Solved by komondormrex. Go to Solution.
this app will let you select the blocks you want and export them out as dwg
https://apps.autodesk.com/ACD/en/Detail/Index?id=6861263512373641535&appLang=en&os=Win32_64
You can do this in ARX or .NET
I’m using Python just because it’s easy to prototype quick stuff
https://github.com/CEXT-Dan/PyRx
import PyRx as Rx
import PyGe as Ge
import PyGi as Gi
import PyDb as Db
import PyAp as Ap
import PyEd as Ed
import traceback
def PyRxCmd_doit():
try:
db = Db.curDb()
bt = Db.BlockTable(db.blockTableId())
for name, id in bt.toDict().items():
btr = Db.BlockTableRecord(id)
if btr.isLayout():
continue
if btr.isAnonymous():
continue
if btr.isFromExternalReference():
continue
if btr.isFromOverlayReference():
continue
if(name.startswith("A$")):
continue
doutDb = db.wblock(id)
outDb.dxfOut("E:\\temp\\{}.DXF".format(name))
except Exception as err:
traceback.print_exception(err)
maybe this
https://blog.draftsperson.net/wblock-all-lisp-routine/
just replace the extension from .dwg to .dxf
I didn't try though
╔═══════════════════════════════════════════╗
║ Nr. blocuri =35
║ Format-nume BlocK = *
║ Ora si data =
║ Cale pe disc = C:\Vlaxcompil\0User\
║ Timpul de scriere = *
║ Lista numelor blocurilor este
║ si blocuri sunt salvat\343 in acelasi
║ director << Here you all names>
╠═══════════════════════════════════════════╣
║ NORD1
║ STILBET
║ PUTAMER
║ PUNCT
║ CVCAN
║ GAGER
║ HIDRANT
║ CVGAZE
║ CVTEL
║ PTSTALP
║ STLEA
║ STELLIN
║ STLEMN
║ STILLMN
║ STTEL
║ STELCF
00)Always you save the "CurrentDrawing.dwg" , where your need path for store all blocks/dwg
01)You see the snapshot.gif
02You my explorer-picture "topGradRepeat.jpg:
03)You open "anexa1_35_landscapeb5_2k.dwg"
04)You appload "pp_libcache_block_plugin.vlx"
06)You enter the command (C:q2) pr Q2[enter]
Try this: DwgACCBlk2Dxf.lsp
It'll first export all the blocks as dwgs.
Then it'll convert them to dxfs.
So you'll end up with both dwgs & dxfs.
check the following. will save all drawing blocks to drawing path\All_Blocks_DXF\ in DXF format. if block with same name already is in directory it will be skipped.
(defun c:all_dwg_blocks_to_dxf (/ blocks_dxf_directory block_count block_name block_dxf_name)
(setvar 'cmdecho 0)
(setq blocks_dxf_directory (strcat (vlax-get (vla-get-activedocument (vlax-get-acad-object)) 'path) "\\All_Blocks_DXF")
block_count 0
)
(if (null (vl-file-directory-p blocks_dxf_directory))
(vl-mkdir blocks_dxf_directory)
)
(vlax-map-collection (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
'(lambda (block)
(and
(setq block_name (vla-get-name block))
(snvalid block_name)
(null (findfile (setq block_dxf_name (strcat blocks_dxf_directory "\\" (setq block_name (vla-get-name block)) ".dxf"))))
(setq block_count (1+ block_count))
(command "_-wblock" block_dxf_name "" block_name)
)
)
)
(setvar 'cmdecho 1)
(princ (strcat "\nTotal " (itoa block_count) " blocks saved to \"" blocks_dxf_directory "\" directory"))
(princ)
)
in ABOVE CODE need ADDITIONALLY ONE to automatically explode all the blocks before SAVING
Lots of options by just doing a simple search like this one
https://www.cadtutor.net/forum/topic/44634-explode-all-blocks/
added
(defun c:all_dwg_blocks_to_dxf (/ insert_sset exploded_list blocks_dxf_directory block_count block_name block_dxf_name)
(if (setq insert_sset (ssget "_x" '((0 . "insert"))))
(foreach insert (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex insert_sset))))
(setq exploded_list (list insert))
(while exploded_list
(foreach insert exploded_list
(setq exploded_list (append exploded_list (vlax-invoke insert 'explode))
exploded_list (vl-remove insert exploded_list)
)
(vla-erase insert)
)
(setq exploded_list (vl-remove-if-not
'(lambda (object) (= "AcDbBlockReference" (vla-get-objectname object)))
exploded_list
)
)
)
)
)
(setvar 'cmdecho 0)
(setq blocks_dxf_directory (strcat (vlax-get (vla-get-activedocument (vlax-get-acad-object)) 'path) "\\All_Blocks_DXF")
block_count 0
)
(if (null (vl-file-directory-p blocks_dxf_directory))
(vl-mkdir blocks_dxf_directory)
)
(vlax-map-collection (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
'(lambda (block)
(and
(setq block_name (vla-get-name block))
(snvalid block_name)
(null (findfile (setq block_dxf_name (strcat blocks_dxf_directory "\\" (setq block_name (vla-get-name block)) ".dxf"))))
(setq block_count (1+ block_count))
(command "_-wblock" block_dxf_name "" block_name)
)
)
)
(setvar 'cmdecho 1)
(princ (strcat "\nTotal " (itoa block_count) " blocks saved to \"" blocks_dxf_directory "\" directory"))
(princ)
)
SORRY
ACTUALLY WHAT IAM LOOKING FOR IS, AFTER EXTACTING THE BLOCKS AND SAVING IT AS SEPARTED DXF, I NEED TO EXPLODE THE SKETCH IN THE NEW CREATED DXF
you'd better post an example of your block and show what you need to be exploded.
Can't find what you're looking for? Ask the community or share your knowledge.