I looked through the past threads, but couldn't quite find a specific answer to this. I need to redefine a block with a dialog box up, so I can't use (command). I have no problem using (entmake) to make a block reference or the insert entity. But how do I make the block reference to a DWG that hasn't been inserted yet? There isn't any DXF group to put the filepath in. Or, of course, if I've missed something, and there's some other swanky way to redefine a block with a dialog box open, much help would be appreciated. thanks. --Jeremiah
;Entmake and VLA Example; (defun c:upkey (/) (if (= (tblsearch "style" "arch") nil)(command "style" "arch" "architxt.shx" "" "" "" "" "" "")) (entmake '((0 . "block")(2 . "door")(70 . 2)(10 0.0 0.0 0.0)(8 . "0"))) (entmake '((0 . "ELLIPSE") (5 . "53") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (62 . 4) (6 . "ByBlock") (100 . "AcDbEllipse") (10 0.0 0.0 0.0) (11 -0.25 0.0 0.0) (210 0.0 0.0 1.0) (40 . 0.5) (41 . -2.44921e-016) (42 . 6.28319) ) ) (entmake '((0 . "ATTDEF") (10 -0.29701 -0.046875 0.0) (40 . 0.09375) (1 . "--") (50 . 0.0) (41 . 0.875) (51 . 0.0) (7 . "ARCH") (71 . 0) (72 . 1) (11 0.0 0.0 0.0) (210 0.0 0.0 1.0) (3 . NO.") (2 . "door") (73 . 0) (74 . 2) (70 . 0) (8 . "0") ) ) (entmake '((0 . "endblk"))) (princ) ) (defun c:test (/ db) (setq db (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))) ) (setq db (vla-add db (vlax-3d-point(list 0 0 0)) "sample")) (vla-addline db (vlax-3d-point (list 0.0 0.0 0.0))(vlax-3d-point (list 0.0 1.0 0.0))) (vla-addline db (vlax-3d-point (list 0.0 0.0 0.0))(vlax-3d-point (list 0.0 -1.0 0.0))) (vla-addline db (vlax-3d-point (list 0.0 0.0 0.0))(vlax-3d-point (list 1.0 0.0 0.0))) (vla-addline db (vlax-3d-point (list 0.0 0.0 0.0))(vlax-3d-point (list -1.0 0.0 0.0))) (vlax-dump-object ms t) (princ) )
Look into Vla-Add. (setq BlkObj (vla-Add blockcollection (vlax-3D-Point bip) "BlockName")) Then add all the components. Bill
add what components? As I mentioned, this is a DWG file. unless I can use vla functions to read in an external file entity by entity, how am I to know what the DWG is comprised of? and, can you direct me to some reference on vla-add? --Jeremiah
Sorry mis-read the post, Vla-insert would do it. InsertBlock Method Inserts a drawing file or a named block that has been defined in the current drawing. Example: (setq *acadobj* (vlax-get-acad-object) *acaddoc* (vla-get-activedocument *acadobj*) *mspace* (vla-get-modelspace *acaddoc*)) (setq Blk1 (vla-InsertBlock *mspace* (vlax-3D-Point '(0 0 0)) "g:\\wblock\\elect\\320021.dwg" 1 1 1 0)) Ignores if another block by that name is already in the drawing. You might not need the Blk1 var. Bill