Riccardo_Ferrari Posted January 3 Posted January 3 To import DWG I use the command "Insert" Is there an alternative using Entmake? (or Entmakex) I found a lot of documentation and many examples about Entmake with blocks, but none that was able to call external files. Thanks for your attention. Happy New Year Riccardo Ferrari Quote
lido Posted January 3 Posted January 3 Try https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-block-with-quot-entmake-quot-on-new-drawings/td-p/9097551 1 Quote
Riccardo_Ferrari Posted January 3 Author Posted January 3 On 1/3/2025 at 12:23 PM, lido said: Try https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/insert-block-with-quot-entmake-quot-on-new-drawings/td-p/9097551 Thanks for your attention. I had already found the link you posted, but I could not understand where to put the full pathname of the file you want to import. I still do not understand it, perhaps due to my poor English. So I ask you: in the example you posted, where should "c:\\path\\filename.dwg" be placed? Thank you very much. Riccardo Ferrari Quote
pkenewell Posted January 3 Posted January 3 (edited) @Riccardo_Ferrari to insert a drawing from an external file, you have to use either (command "._Insert ...) or use (vla-InsertBlock) https://help.autodesk.com/view/OARX/2025/ESP/?guid=GUID-17F86FDD-B7FC-4F43-9F16-B4958F73A66D Edited January 3 by pkenewell 1 1 Quote
Steven P Posted January 3 Posted January 3 As per the link entmake creates a new instance of a block - a new copy of it but the block has to exist in the drawing, you cannot entmake from a filepath. If I remember right how I did this, you can create a block definition with entmake / entmakex something like: (entmakex (list '(0 . "BLOCK") (cons 2 "BlockName") (cons 70 64) (cons 10 origin) )) ;;entmake each block entity: (entmakex '((0 . "ENDBLK"))) Try the above perhaps using a simple entmake like a line to see if it works... Now all you need to do is assess your block source file, grab all the entities in it (use entget) and put in the above. Remember of course to confirm that line types, text styles and hatch types exist in the target drawing (or create / load them). Something like a batch LISP that opens and then closes each file might help here to record the details - save the details into the temp file as a text file so you can pass the data between drawings. I went a step further, created a LISP for each block (for example BLK_door.lsp the BLK_ is just to distinguish for me a block definition), and in that are all the entity definitions listed as far as I need to go (for a door, it is an arc and 2 lines for what I need), use entget to get the definition. So when I run c:Blk_Door.lsp it calls BLK_Door which returns all the data, using that calls makeblock which creates the block.... but that is a lot of coding... not one to give away (sorry!), though the idea is there and it can be done - happy to help if you want to go that way. Added to this I have a small LISP (example SEL_Door.lsp) which is a vector representation of the block (very simple), this feeds into a DCL pop-up box "Blksel" - these vectors create thumbnails on the fly listed by the file they are saved in (that one is only 550 lines long!) Anyway, point is, it can be done, it works well enough for me.... but programming it is a little more complex than "entmake from file" - pkenewell and insert or vla-insertblock is by far the simplest unless you want a LISP challenge for the fun of it! (I did... but no life) Quote
Riccardo_Ferrari Posted January 4 Author Posted January 4 (edited) Thanks everyone for the replies I understand that importing external DWG files with Entmake is very difficult, maybe not even possible. Many people (like you @pkenewell, thanks) have suggested me vla-InsertBlock, which I tried and it works. I will use that one. Thanks again Riccardo Ferrari Edited January 4 by Riccardo_Ferrari 2 Quote
Recommended Posts
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.