bababarghi 发表于 2022-7-5 17:37:19

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)

BIGAL 发表于 2022-7-5 17:54:48

Maybe why (setq blk ? The insert works without the setq

bababarghi 发表于 2022-7-5 18:14:20

 
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)

Lee Mac 发表于 2022-7-5 18:24:37

Do you receive the error for all blocks, or for one block in particular?

bababarghi 发表于 2022-7-5 18:51:22

 
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]
查看完整版本: Problem with "vla-InsertBlock"