乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 59|回复: 4

[编程交流] Problem with "vla-InsertBlock"

[复制链接]

26

主题

84

帖子

58

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
130
发表于 2022-7-5 17:37:19 | 显示全部楼层 |阅读模式
Folks, can someone plz tell me why I get ; error: Automation Error. Object permanently erased error?
 
  1. (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)
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 17:54:48 | 显示全部楼层
Maybe why (setq blk ? The insert works without the setq
回复

使用道具 举报

26

主题

84

帖子

58

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
130
发表于 2022-7-5 18:14:20 | 显示全部楼层
 
Nope. setq wasn't the issue. Any other idea?
 
  1. (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 "[i]Block Full Path[/i]")) (vla-InsertBlock ps (vlax-3d-point '(0.0 0.0 0.0)) ValidBlockName 1.0 1.0 1.0 0.0) (princ))(test)
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-5 18:24:37 | 显示全部楼层
Do you receive the error for all blocks, or for one block in particular?
回复

使用道具 举报

26

主题

84

帖子

58

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
130
发表于 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?
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-13 03:11 , Processed in 0.664754 second(s), 62 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表