TunzaGibbo Posted December 5, 2018 Posted December 5, 2018 I want my lisp file to insert a block in a certain way. After "_insert" I would like the program to go to a specific folder where I keep my blocks. This code works fine if I have a block name where the question marks are. Is there some code I can enter where the question marks are to get the dialogue box? (command "_insert" "??????????" pause 1 "" 0 ) Quote
Lee Mac Posted December 6, 2018 Posted December 6, 2018 Here is one option: (if (setq blk (getfiled "Select block" "" "dwg" 16)) (command "_.-insert" blk "_S" 1 "_R" 0 "\\") ) Quote
TunzaGibbo Posted December 6, 2018 Author Posted December 6, 2018 Thank you Lee (command "_insert" "C:\\Users\\Tony Clean Install\\#Advance\\Blocks\\Cameras\\Camera HD Detail.dwg" pause 1 "" 0 ) if I was to use this line (which works well) How could I incorporate in this line the ability to explode the block regards Tony Quote
asos2000 Posted December 6, 2018 Posted December 6, 2018 (if (and (vl-cmdf "_insert" "C:\\Users\\Tony Clean Install\\#Advance\\Blocks\\Cameras\\Camera HD Detail.dwg" pause 1 "" 0 ) ; inser block (setq CMHDD (ssget "x" '((0 . "INSERT") (2 . "Camera HD Detail")))) ) (progn (vl-cmdf "_.EXPLODE" CMHDD "") (vl-cmdf "_.-purge" "blocks" "Camera HD Detail" "n") )) Quote
asos2000 Posted December 6, 2018 Posted December 6, 2018 1 hour ago, BIGAL said: Why not explode entlast ! Yes Quote
Lee Mac Posted December 6, 2018 Posted December 6, 2018 Alternatively, you could use something like this: (setq pth "C:\\Users\\Tony Clean Install\\#Advance\\Blocks\\Cameras\\Camera HD Detail.dwg" blk (vl-filename-base pth) ) (if (or (tblsearch "block" blk) (and (or (findfile pth) (prompt (strcat "\n" pth " not found.")) ) (or (progn (command "_.-insert" pth nil) (tblsearch "block" blk) ) (prompt (strcat "\n" blk " could not be defined.")) ) ) ) (command "_.-insert" (strcat "*" blk) "\\" 1 0) ) 1 Quote
TunzaGibbo Posted December 6, 2018 Author Posted December 6, 2018 Thankyou everyone for your contributions. This is what I am finally using and it works perfect. (command "_insert" "Camera HD Detail.dwg" pause 1 "" 0)(setq blex (entlast))(command "_explode" blex) 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.