乐筑天下

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

[综合讨论] HELP:Advise on script to inser

[复制链接]

48

主题

304

帖子

256

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
240
发表于 2022-7-6 23:38:19 | 显示全部楼层 |阅读模式
I needed to insert a block into many drawings at the same location.
 
After some study, I am able to run this script with scriptpro.
 
  1. ATTREQ 1ATTDIA 0-INSERT"*d:\new block.dwg"2527.1006043527,827.369441206792310savey
But the issue is i have 2 layout. The above script will only insert to the default layout only.
 
Can someone advise how insert in both layout?
 
Thanks
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 23:42:14 | 显示全部楼层
Very  simple the ctab variable can be used to change layouts so in your script (Setvar "ctab" "layout 2") and add Mspace Z E just in case your inside a layout viewport other wise it will insert in the model. NOTE must use brackets this is a mini lisp command in a script .
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
240
发表于 2022-7-6 23:46:31 | 显示全部楼层
 
Ok. I will give it a shot.
 
BTW, since you mention it is now a mini lisp command in a script, i can still run it with scriptpro?
 
Thanks
回复

使用道具 举报

10

主题

598

帖子

594

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-6 23:50:16 | 显示全部楼层
You could use BIGAL's idea just adding the 2 lines to your script
  1. CTABlayout 2
I honestly don't know if it will make a difference, being an LT user I don't know the effects of adding lisp code to scripts
回复

使用道具 举报

6

主题

31

帖子

25

银币

初来乍到

Rank: 1

铜币
30
发表于 2022-7-6 23:54:03 | 显示全部楼层
Try replacing your insert part of the script with this.
  1. (foreach layout (layoutlist) (setvar "ctab" layout) (command "pspace") (command "-insert" "d:\new block.dwg" "2527.1006,827.3694" "1" "0"))
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 23:55:08 | 显示全部楼层
Sorry it will not work with LT Steven is correct just do it as a command you can do on one line if you like
Ctab "layout 2" use " if you have spaces in layout name.
回复

使用道具 举报

10

主题

598

帖子

594

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-6 23:59:50 | 显示全部楼层
BIGAL I don't think the OP has LT I just added the comment for any possible LT users who may look-in :>)
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
240
发表于 2022-7-7 00:03:08 | 显示全部楼层
Hi guys. Thanks for the input. I am using autocad full version.
 
I will try to study all inputs & see how to work it out.
 
Thanks
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
240
发表于 2022-7-7 00:06:44 | 显示全部楼层
Hi JamCAD.
 
I add in as suggested in 2 different ways and i got errors for both.
 
1st way script
  1. ATTREQ 1ATTDIA 0-INSERT(foreach layout (layoutlist) (setvar "ctab" layout) (command "pspace") (command "-insert" "d:\new block.dwg" "2527.1006,827.3694" "1" "0"))10savey
 
1st way error
 
 
2nd way script
  1. ATTREQ 1ATTDIA 0(foreach layout (layoutlist) (setvar "ctab" layout) (command "pspace") (command "-insert" "d:\new block.dwg" "2527.1006,827.3694" "1" "0"))10savey
 
2nd way error
 
 
What did I do wrong?
 
 
 
回复

使用道具 举报

48

主题

304

帖子

256

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
240
发表于 2022-7-7 00:10:00 | 显示全部楼层
Got it working with this script.
 
  1. ATTREQ 1ATTDIA 0ctabA2-INSERT"*d:\new block.dwg"2527.1006043527,827.369441206792310ctabA3-INSERT"*d:\new block.dwg"2527.1006043527,827.369441206792310savey
 
Thanks guys
 
 
 
 
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 04:24 , Processed in 0.417329 second(s), 72 queries .

© 2020-2025 乐筑天下

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