乐筑天下

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

[综合讨论] Script (not LISP!) to change V

[复制链接]

2

主题

4

帖子

2

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-7 03:06:27 | 显示全部楼层 |阅读模式
I've been trying unsuccessfully to create a script/macro that does the following from within a sheet file with a base plan xref:
-user input: active viewport
-user input: plan, RCP, demolition, enlarged plan
-load the vplayer linetypes, colors, and visibility appropriate to the selected view mode above
 
Behind the scenes, I have created a base plan template on our server with .las files for each of the appropriate layer settings so they can  be called by the script.
 
I had hoped that I could have a combination of scripts and macros do the job of:
-entering the model space of the viewport selected
-assigning the selected layer settings for the xref layers appropriate to the user selected view (plan, etc)
-making vplayers=modelspace layers and then
-return the xref to base settings in model space while retaining the newly created vp settings.
 
This may seem overly complicated, but the reason I want to do it this way is to allow our office to create a base resource for layer settings in the form of a template with layerstates; that way, if we have to change settings in the future, we change it once - the script can be run on any new and old files to make the change.
 
I think I can figure out most of the above...but I'm stuck on assigning modelspace xref layers to vplayer settings and having them "stick" in the viewport.  If I could access a variable for each layer property and assign it to a variable for vp settings for that layer, it would be a simple matter of using something like *base*|* for the layer name and having the script go through all of the layers.  Is there a way to do this?  Without access to LISP (AutoCAD LT), this seems difficult.
 
Thanks for reading this far...I couldn't come up with a more concise way to put the question!
回复

使用道具 举报

2

主题

4

帖子

2

银币

初来乍到

Rank: 1

铜币
10
发表于 2022-7-7 03:48:09 | 显示全部楼层
Well, here I am answering my own question...but perhaps someone more knowledgable can comment - I'm in pretty deep water here.
 
So, I created a macro as follows:
  1. ^C^C_-vports \\mspace;z;c \;z;s \'_script
 
This creates a new viewport, which gets user input to pick points, center the plan in model space, and then for the scale of the viewport. It's assumed that the user has already loaded the base-plan xref. I was looking for a way to make scale entry simpler...putting in "1/48xp" for quarter scale isn't very intuitive.
 
Then, I created a script for the user to run from within the macro:
 
  1. ;This script creates a plan layer setup within a viewportXREF RELOAD *BASE*VPLAYERFREEZE *BASE*|*FREEZE A-ANNO-NOTE*FREEZE A-ANNO-DIMS*THAW A-ANNO-NOTE-PLANTHAW A-ANNO-DIMS-PLANTHAW *A-FLOR*THAW *A-EXST-FLOR*THAW *A-EXST-WALL*THAW *A-WALL*PSPACE
 
This does the job of setting up the layers to print properly from within the viewport. It isn't perfect, and there's no error checking. Now I just have to create the other scripts (RCP, Demo, etc).
 
As for using variables in macros from my first post: the setenv command creates random variables...but I'm thinking my current route is probably the best. Comments?
回复

使用道具 举报

0

主题

1

帖子

1

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-7 04:17:43 | 显示全部楼层
whats your work around for running the script in a drawing that doesn't have any layers with those suffix or prefix?  "No matching layer names found."
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-9 22:00 , Processed in 0.483801 second(s), 58 queries .

© 2020-2025 乐筑天下

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