Freerefill 发表于 2022-7-6 15:25:12

好吧,我破坏了我的代码,为了复制你得到的错误,瞧,我相信我的第一个猜测是正确的。我认为你没有C:\目录^
 
尝试用以下代码替换代码:
在看到“Y:\ttlblk.txt”的地方,只需在两个位置将“Y:\”部分替换为您选择的某个目录。如果可行,请告诉我。是的,我在其他地方做了一些编辑,所以只需复制整个代码。
 
还要注意双反斜杠。在AutoCAD中,反斜杠表示使用了控制代码,例如“n”表示回车。因此,您不能只添加反斜杠,否则AutoCAD会认为您使用的是控制代码。。因此,如果你想要反斜杠,你需要使用它两次,“\\”。键入文件路径时不要忘记这一点。
 
至于创建新文件,是的,这可以通过多种方式完成,从。bat文件复制粘贴。我现在刚刚做了这个,我觉得它很甜:
 
请注意,这适用于您想要指定的任何文件类型。只需编辑您看到的两个变量(请记住将其保留在引号中),以指示文件类型以及将附加到新文件名的内容。没有检查是否输入空字符串(“”),因此。。呃。。不要那样做>>'还有,你给了一个星号。。不确定这是否表明你想要“某物”,或者你实际上想要一个星号。。据我所知,星号对文件名无效,所以在这里也不要使用它。或任何其他无效字符。。。。我真的应该写一些支票。哦,好吧。也许改天吧。
 
再说一次,如果对你有效,请告诉我。^^

Leebles 发表于 2022-7-6 15:27:44

早上好,freerefill,非常感谢您的代码。
 
今天早上醒来的第一件事就是看到你已经发布了它。在家里快速试用了一下,就快到了。它只填写了几个属性字段。(drg标题是其中之一)。
 
我办公室里只有09 LT版本,所以当我今晚回来的时候,我会再玩一次。
 
今天早上我没有机会测试另一个程序,但我很期待

Freerefill 发表于 2022-7-6 15:31:28

I'm very glad it worked out for you. It's good to know I'm not completely useless. ^.^
 
And yea, it won't catch all the title block attributes. Basically, each attribute has a name and a value. The name is.. sort of like the prompt you see when you edit it, and the value is what you actually specify for the.. well, value. If one title block attribute has a name of "SHEET_TITLE" with the value "Doohicky Widget", and the title block you're trying to populate has an attribute with the value "TITLE", the program will not populate that space. I noticed a few discrepancies between the two title blocks, but fortunately, not many at all. I'm sure the better way to have done it would be to have gone through and matched them up individually, rather than simply exporting the bulk of them... oh well.
 
I'm sure there's a way to put these two functions into a loop using a script.. it wasn't long ago when someone who was using LT had asked for a similar thing (script-based version of populating a title block), and we did manage to muddle through with some level of success. There's a way to export a file list using a batch file (almost in the exact same way I did it with Visual LISP) and from there you can write that data to a script file... ah, but no, you'd still need to run the LISP on all of them, so I guess that wouldn't work.
 
At any rate, I am glad it's working. If you have any questions, suggestions, comments, criticisms, chocolate or delicious cake, I'm sure to be very receptive. Especially for the last two.

Leebles 发表于 2022-7-6 15:35:07

can certainly provide you with the latter two if it saves me time lol,
 
is there any way of "snatching" the model profile (Actual Size) and dropping it in the model view of the new sheet?
 
Again would save me a tremendous amount of time. (got a cheeky streak in me too). Appreciate you are more than busy so if you dont get time no worries. Again cheers for the help.
 
Lee

Leebles 发表于 2022-7-6 15:39:05

and reading back through your last comment, the bullk attributes are fine, can always change the new sheet so the attributes are word for word. ;-)
 
Cheers and have a great weekend

Freerefill 发表于 2022-7-6 15:41:37

Right now, the code is set up to grab everything from Modelspace with the exception of... what looks like the two title blocks or borders you have.It should take everything else. It's basically copy-paste, there shouldn't be any difference. If you want, you can knock off the two "IF" statements in the (copyMSpace) function, so that it looks like this:
 

(defun copyMSpace( / ) (command "copyclip" (ssget "X" (list (cons 410 "Model"))) "") (princ) )
 
Doing that, it should get everything on Modelspace, including the title blocks. You'd just have to delete what you don't need later.
 
Again, if it isn't getting something, the only thing I could think is that it's on an off, frozen or locked layer. If that's the case, it would be easy to incorporate a fix for that within the code.
 
And I'll be expecting that chocolate and cake soon.... >.>'''
页: 1 [2]
查看完整版本: 编辑属性和视口