乐筑天下

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

[综合讨论] Script doesn't work, but

[复制链接]

4

主题

13

帖子

9

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 23:06:57 | 显示全部楼层 |阅读模式
Hi all,
         
        Fairly new to scripting and have hit a roadblock.
         
        Essentially, the attached file works if I execute the commands by typing it out from the command line.
        Except when I am dropping the scr version in, it seems to stop and get confused after selecting all.
         
        All I am trying to do (so far) In this script is the following,
         
           
  •                 I switch to model space       
  •                 select all and change all Lineweights and Linetypes of selected objects to 'by layer'       
  •                 then setting All layer Lineweights to 0       
  •                 then setting layer 0 to a lineweight of 0.2
         
        Can anyone spot what I am doing wrong here? Appreciate the help.
         
回复

使用道具 举报

17

主题

1274

帖子

25

银币

后起之秀

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

铜币
260
发表于 2022-7-6 23:30:33 | 显示全部楼层
At a glance for changing properties both Ltype & Ltscale start with LT.
        Changing LT to Ltype may help.
        As Lineweights are real numbers setting them to 0.0 instead of 0 may help.
        I believe the stopscript command may be used in other software but not in AutoCAD?
         
        I'm a lisper who hasn't written any scripts in a long time.
回复

使用道具 举报

10

主题

598

帖子

594

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-6 23:41:01 | 显示全部楼层
Run your script and then press F2 for the command history, you should be able to see where the problem is, if there is a problem you would probably see something like 'invalid command' or some other error message before the script tries to go onto the next command or input from your script. (a script won't stop at an error it just tries to blindly continue on so you need to look for the first error) then it is just a question of fix the error and try again.
        If you are not sure then run the script then copy your coomand history and post it here.
回复

使用道具 举报

4

主题

13

帖子

9

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 23:51:59 | 显示全部楼层
 
        Hi, thanks for that. This is exactly what I tried to do, but it isn't making much sense to me.
         
        I have copied what I can see from F2. What is bizzare, is that typing it out I can't replicate it?
         
                                                        
        </blockquote>         
         
回复

使用道具 举报

4

主题

13

帖子

9

银币

初来乍到

Rank: 1

铜币
20
发表于 2022-7-6 23:59:55 | 显示全部楼层
 
        Hi There,
         
        I am seeing that LT is for "LineType" and S is for "Linetype Scale"
回复

使用道具 举报

10

主题

598

帖子

594

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-7 00:18:06 | 显示全部楼层
The error message you recieve here shows up where the problem is. In fact the error is with the 'CHANGE' command, but this is the difficult bit you need to decipher what is happening
        You have just used the 'SELECT' command to select all objects but running the 'CHANGE' command is then prompting you too select objects (scripts often don't work with a preselection and expect the selection to occur after the command is issued).
        So your script issues the 'CHANGE' command and Autocad prompts for a 'selection' coincidently in this case your next line in the script is 'P' which you are using for the  'PROPERTIES' option of the CHANGE command, but Autocad is expecting a selection so it is seeing 'P' as standing for PREVIOUS selection.
        To fix this you need to rewrite the script order to this.
  1. TILEMODE1-LAYERU*CHANGEALLPLTBYLAYERLWBYLAYER-LAYERLW0*LW0.2IRR_ELECTRICAL_stopscript
You will still see an error at the end though. As pointed out by @tombu 'stopscript' is not an Autocad command so this results in an error message 
  1. Command: _stopscriptUnknown command "STOPSCRIPT".  Press F1 for help.
But this is at the end of your script so doesn't break your script it just gives the error message shown (in Autocad scripts automaticaaly stop at the end)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 04:25 , Processed in 0.436868 second(s), 64 queries .

© 2020-2025 乐筑天下

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