Hello Everyone
I've been searching for a lisp routine that can make browsing and inserting a block more easy. Using the toolpalette-route is great and "cute" but gruesome to update with thousands of blocks, so many categories and annual changing versions (....well u get the point).
I just need this to be fairly simple and T-squared-straight-forward. Upon typing insert i want to have a windows browsing window instead of the insert dialogue box which ask Insertion point, scale & rotation----I need to go straight to "browse" with a pre-set path. after that choose and select the desired block double-click it and then insert. I found this code below at Lazy drafter I just have no idea how to go about inserting a block. Please help! Thanks in advance
(startapp "explorer" (strcat "/n,/e," "N:\\CAD\\BLOCKS"))
Solved! Go to Solution.
Solved by hmsilva. Go to Solution.
The Getfiled function may be useful...
As a demo:
(Getfiled "Select Drawing File" "N:\\CAD\\BLOCKS\\" "Dwg" 8)
HTH
Henrique
What about drag and drop from explorer into the drawing window? That inserts as a block.
Drag file from explorer to model space drawing window>Pick insertion point>hit space (or enter) 3 times. That inserts for me fairly easily.
Try
(defun c:demo (/ blk) (if (setq blk (getfiled "Select Drawing File" "N:\\CAD\\BLOCKS\\" "Dwg" 8)) (command "_.insert" blk "_S" 1 pause 0) ) (princ) )
HTH
Henrique
@JCprog wrote:
It did work the way it should be. It was just the blocks that werent created properly is the problem. Thanks for code Henrique!!!! Can I make that window a lil bigger? Maybe set its size?
You're welcome, JCprog!
I think it will not be possible to make the window bigger...
Henrique
You can use DesignCentre. Ctrl+2, browse to your folder, then right-click the block, select "Insert as block..." from the short-cut menu, or just drag it to the drawing.
if we want insert multiple blocks to use in the file and if we select only one block can we find remaining blocks on that path without going to that path again and again which is get form getfiled function.
Use THIS
to get the file names returned as a list e.g.
(setq blk_lst (LM:getfiles "Select Blocks" "" "dwg")
the above will allow you to browse to a directory then choose drawings in the left panel and add them to the right panel
pressing OK returns a list of drawings complete with path from the right panel.
Then
(setq pt (getpoint "\nselect insertion point for blocks))
(foreach blk blk_lst (vl-cmdf "-insert" blk pt 1 0) )
This should insert every selected drawing as a block into the drawing at the selected point.
Just make sure that
1. if the drawing contains a block, that the drawing is not the same name as the block it contains
2. or if it is, that the block within the drawing is exploded.
In case 1 just explode all the inserted drawings to leave yourself with the blocks, then erase
In case 2 just erase
I am not one of the robots you're looking for