Problem with "vla-InsertBlock"
Folks, can someone plz tell me why I get ; error: Automation Error. Object permanently erased error?(defun test () (vl-load-com) (setq acad1 (vlax-get-acad-object)) (setq doc1 (vla-get-ActiveDocument acad1)) (setq ps (vla-get-PaperSpace doc1)) (setq ValidBlockName (findfile "...MY BLOCK FULL PATH.." ) ) (setq blk (vla-InsertBlock ps (vlax-3d-point '(0.0 0.0 0.0)) ValidBlockName 1.0 1.0 1.0 0.0 ) ) (princ))(test) Maybe why (setq blk ? The insert works without the setq
Nope. setq wasn't the issue. Any other idea?
(defun test () (vl-load-com) (setq acad1 (vlax-get-acad-object)) (setq doc1 (vla-get-ActiveDocument acad1)) (setq ps (vla-get-PaperSpace doc1)) (setq ValidBlockName (findfile "Block Full Path")) (vla-InsertBlock ps (vlax-3d-point '(0.0 0.0 0.0)) ValidBlockName 1.0 1.0 1.0 0.0) (princ))(test) Do you receive the error for all blocks, or for one block in particular?
Hmmm. Good pick Lee. Actually it works fine with other blocks. I found out the problem is because of a nested block called _Oblique which has not been used anywhere in entire drawing and I can't even purge it. How can I modify my code to ignore the duplicate object? Or I need to load another lisp to get rid of that nested block first and then insert my desired block?
页:
[1]