MarcoW Posted November 2, 2010 Share Posted November 2, 2010 Hi folks, I was wondering, if I need to make a line by lisp, I "entmake" one. When I want to make other entities, I "entmake" them also. When it comes to inserting a block, should I then go on the "entmake" tour again? I believe the block is already made, it needs to be inserted so not entmade. Am I right? I'd rather use vl-cmdf in stead of "_.insert", is that true? Thats all for today :-) Any help is very much appreciated. Regards, MarcoW. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 2, 2010 Share Posted November 2, 2010 (edited) Since that you already have made your block and existed in the current drawing , you need only to use a command to isert that block .... First . (command "_.-insert" "[color="red"][b]YourBlockName[/b][/color]" pause "" "" "") Second . (vl-cmdf "_.-insert" "[b][color="red"]YourBlockName[/color][/b]" pause "" "" "") By "entmakex" (entmakex (list (cons 0 "INSERT") (cons 2 "Y[b][color="red"]ourBlockName[/color][/b]"); type you Block Name (cons 10 '(0.0 0.0 0.0)))); Insertion point for your Block Both are the same result . Hope this what you meant . Tharwat Edited November 2, 2010 by Tharwat entmakex added Quote Link to comment Share on other sites More sharing options...
asos2000 Posted November 2, 2010 Share Posted November 2, 2010 Entmake BLOCK to create a block (defun CreatBlock ( BlkNme ) (entmake (list (0 . "BLOCK") (100 . "AcDbEntity") (67 . 0) (8 . "0") (100 . "AcDbBlockReference") (cons 2 BlkNme) (10 0 0 0) (70 . 0) ) ) ;;;entmake all objects in block (entmake '((0 . "ENDBLK") (100 . "AcDbBlockEnd") (8 . "0"))) (princ) ) Entmake INSERT to insert the block (entmakex (list (cons 0 "INSERT") (cons 2 BlkNme) (cons 8 BlkLyr) (cons 10 Pnt) (cons 41 BlkScl) (cons 42 BlkScl) (cons 43 BlkScl) ) ) But first you have to check if the block inserted or not (defun Create_Layers () (if (not (tblsearch "BLOCK" "BlkNme")) (progn (CreatBlock CADTutor) ) ) ) Quote Link to comment Share on other sites More sharing options...
asos2000 Posted November 2, 2010 Share Posted November 2, 2010 and Entmake is faster than calling command Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 2, 2010 Share Posted November 2, 2010 Check this out I believe the block is already made, it needs to be inserted so not entmade. Am I right? I'd rather use vl-cmdf in stead of "_.insert", is that true? So there is no need for "entmake" since the desired Block is already made and existed in the dwg. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted November 2, 2010 Share Posted November 2, 2010 Marco, Where things can get dicey, is if the INSERT has ATTRIButes. For entmake: the INSERT entity must contain (66 . 1) sequential entities follow flag you make each ATTRIBute as a individual entity you must make a SEQEND entity to finish For command - either: Add a string value for ATTRIBute to the command sequence Accept the default for each ATTRIBute value like this: (while (> (getvar "CMDACTIVE") 1) (command "")) Also for the command style, you will need to check to see if an external file exists: (or (tblsearch "BLOCK" block_name) (findfile (strcat block_name ".dwg"))) -David Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 2, 2010 Share Posted November 2, 2010 vla-insertblock is a good alternative - performs faster than the command call, but no faffing around with entmake'ing Block definitions, or attributes. Quote Link to comment Share on other sites More sharing options...
BlackBox Posted November 2, 2010 Share Posted November 2, 2010 I was going to suggest vla-insertblock, but Lee beat me to it. Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 2, 2010 Share Posted November 2, 2010 vla-insertblock is a good alternative - performs faster than the command call, but no faffing around with entmake'ing Block definitions, or attributes. And you automatically get the current annotation (if using annotative blocks) - my biggest like over entmake. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 2, 2010 Share Posted November 2, 2010 And you automatically get the current annotation (if using annotative blocks) - my biggest like over entmake. I'll have to take your word on that one - I've never delved into the world of annotative.... Quote Link to comment Share on other sites More sharing options...
alanjt Posted November 2, 2010 Share Posted November 2, 2010 I'll have to take your word on that one - I've never delved into the world of annotative.... That's why I always stress using using vla for any *text or block objects. Quote Link to comment Share on other sites More sharing options...
MarcoW Posted November 3, 2010 Author Share Posted November 3, 2010 (edited) @ Tharwat & Asos: The vl-cmdf function is the one to prefer besides the "command" one I believe. But also I think both of them are not really lisp but more as a macro-thing. I don't know how to explain there is nothing to "create" rather then to just insert by command. The "entmake" option does really create something allthough in case of inserting existing blocks it is a bad example. Entmaking a line or polyline is a better example. But conclusion: I will explore about entmake and entmakeX. (Yes I'll dig in that difference too...) Oh yeah, I read about entmake being much faster then just "commands". @ David: I am shure that all my blocks have attributes. So what will happen if I insert a block that has 3 attributes, this way: (entmakex (list (cons 0 "INSERT") (cons 2 BlkNme) (cons 8 BlkLyr) (cons 10 Pnt) (cons 41 BlkScl) (cons 42 BlkScl) (cons 43 BlkScl) ) ) TBH: I cannot completely follow the "sequential" part. But then the vla-insertblock option Lee suggested: it seems much easier but I need some resource to dig in. Maybe it is in the developers bible or the help section. Will look for it! I've never delved into the world of annotative.... Neither have I.... but I should. Annotative stuff (not lisp but the scaling) is on my wishlist also since I use several different viewportscales in one layout. All of you thanks again, and I will be back with more wuestions, thats for sure! With kind regards, MarcoW. Edited November 3, 2010 by MarcoW No more excuses, now some good old decent reply :-) Quote Link to comment Share on other sites More sharing options...
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.