乐筑天下

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

[编程交流] VBA CODE-From multiple areas t

[复制链接]

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 21:51:56 | 显示全部楼层 |阅读模式
Hi everybody,
I have a big problem....
I have about 100 DWG with a lot of sheet in the same model space and i must print every sheet, so i am looking for a script in VBA or lisp to create from multiple areas to plot in model space, a layout tab for each area vba autocad.
I found a lisp script, but it doesn't run (plotDWGarr).
(http://www.cadforum.cz/cadforum_en/plotting-a-series-of-drawing-frames-composed-in-a-dwg-drawing-tip7585)
 
Do you know another similar script o to write a VBA to do it?
 
Thank you very much in advance
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 21:59:25 | 显示全部楼层
If I understand correct this will plot all sheets in model space rather than trying to redo all of them.
 
  1. ; plot multi title block in Model space ; By Alan H 2013(PROMPT ".....PRINTING DRAWING TO plotter....")(setq oldsnap (getvar "osmode"))(setvar "osmode" 0)(setq ss2 (ssget "x" '((0 . "INSERT")(2 . "Da1drsht"))))(setq n (sslength ss2))(setq index 0)(repeat n   (setq en (ssname ss2 index))   (setq el (entget en))   (setq inspt (assoc 10 el)) ; insertion pt  (setq xmin (- (cadr inspt) 6.0))  (setq ymin (- (caddr inspt) 6.0))  (setq xymin (strcat (rtos xmin 2 1) "," (rtos ymin 2 1)))  (setq xmax (+ xmin 813.0)) ; hard coded for 813 wide 6mm offset  (setq ymax (+ ymin 566.0)) ;hard code for 566 high  (setq xymax (strcat (rtos xmax 2 1) "," (rtos ymax 2 1))) (COMMAND "-PLOT"  "Y"     "" "//PRODPRN01/Design-5100"       "A3" "M"     "LANDSCAPE"   "N"       "W"   xymin   xymax "1=2"  "C"       "y"   "Designlaser.ctb"      "Y"   "" "n"   "n"       "y" "N" "N" "Y"   ) (setq index (+ index 1)))(setvar "osmode" oldsnap)(princ)
回复

使用道具 举报

2

主题

261

帖子

20

银币

初来乍到

Rank: 1

铜币
8
发表于 2022-7-6 22:08:54 | 显示全部楼层
FrancescoITA
Add example file.
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 22:14:15 | 显示全部楼层
For Bigal:
 
Thank you very much Bigal, after i will try if it runs or no.
However i prefer use a VBA for this script
 
For Maratovich:
Excuse me, here the example.
Example Model (1).pdf
Example.rar
回复

使用道具 举报

2

主题

261

帖子

20

银币

初来乍到

Rank: 1

铜币
8
发表于 2022-7-6 22:23:01 | 显示全部楼层
Look at the options of this topic, there is a solution.
http://www.cadtutor.net/forum/showthread.php?98832-lisp-for-automatically-set-view-ports-from-model-space
http://www.cadtutor.net/forum/showthread.php?98800-Plot-user-paper-size
 
You need to batch printing or creating layouts ?
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 22:26:02 | 显示全部楼层
For Bigal:
 
Excuse me Bigal for my ignorance, but how can i use your script, because i tried, but AutoCad told me that there are some problems.
 
Can you tell me what steps i must do to load and to use your script??^^
 
Thank you very much .
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 22:35:54 | 显示全部楼层
I am interested in both thing, but more to create layout.
回复

使用道具 举报

2

主题

261

帖子

20

银币

初来乍到

Rank: 1

铜币
8
发表于 2022-7-6 22:43:36 | 显示全部楼层
Batch Printing example:
回复

使用道具 举报

2

主题

8

帖子

6

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-6 22:50:04 | 显示全部楼层
maratovich....it is a payment tool....I want create a tool with VBA and i would pay ....
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 22:55:51 | 显示全部楼层
Some bits you need to change are shown in red, copy and paste my 1st post to Notepad save as "Plot-Multi-Mspace.lsp". make changes to the code as shown below, post a dwg with say two title blocks a RAR is a nuisance for me then could change code for you.
 
To run type Appload and pick the lisp Load & close it should run.
 
  1. ; plot multi title block in Model space ; By Alan H 2013(PROMPT ".....PRINTING DRAWING TO plotter....")(setq oldsnap (getvar "osmode"))(setvar "osmode" 0)(setq ss2 (ssget "x" '((0 . "INSERT")(2 . [color=red]"Da1drsht[/color]")))) ;[color=red] title block name[/color](setq n (sslength ss2))(setq index 0)(repeat n   (setq en (ssname ss2 index))   (setq el (entget en))   (setq inspt (assoc 10 el)) ;[color=mediumturquoise] insertion pt of title block[/color]  (setq xmin (- (cadr inspt) [color=red]6.0[/color])) ; [color=red]offset pt lower left[/color]  (setq ymin (- (caddr inspt)[color=red] 6.0[/color]))  (setq xymin (strcat (rtos xmin 2 1) "," (rtos ymin 2 1)))  (setq xmax (+ xmin 813.0)) ; [color=red]hard coded for 813 wide 6mm offset[/color]  (setq ymax (+ ymin 566.0)) ;[color=red]hard code for 566 high[/color]  (setq xymax (strcat (rtos xmax 2 1) "," (rtos ymax 2 1)))[color=red]; scale 1=2 is for an A1 sheet plotted on A3 paper[/color][color=#ff0000]; dwg to pdf means we can check if it works rather than waste paper[/color] (COMMAND "-PLOT"  "Y"     "" [color=red]"DWG to PDF[/color][color=red]"[/color]       "A3" "M"     "LANDSCAPE"   "N"       "W"   xymin   xymax [color=red]"1=2"[/color]  "C"       "y"   [color=red]"Designlaser.ctb[/color]"      "Y"   "" "n"   "n"       "y" "N" "N" "Y"   ) (setq index (+ index 1)))(setvar "osmode" oldsnap)(princ)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-4 13:06 , Processed in 0.345196 second(s), 72 queries .

© 2020-2025 乐筑天下

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