乐筑天下

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

[编程交流] Inputting point data, with lay

[复制链接]

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 22:21:13 | 显示全部楼层 |阅读模式
Hello,
 
I have been trying to inport survey data that includes a descriptor into autocad from an excel file, with some prior forum posts on here I've been successful completing that.
 
Now I am trying to change the layers as part of the data entry, the idea being that all my points are on the base layer "0" and that the text goes into either a "Good" or "Bad" layer with different colors.  I thought I had this figured out but the "clayer" command doesn't close out when a space is given, does anyone have ideas on what might solve this?
 
I have zero coding/lisp background so hopefully the answer isn't that, any help you could give would be appreciated though.
 
Attached is a sample excel sheet with the two basic sets of info arrangements I have now for comment/review.
 
point+text exemple.xls
回复

使用道具 举报

10

主题

598

帖子

594

银币

初来乍到

Rank: 1

铜币
48
发表于 2022-7-5 22:54:20 | 显示全部楼层
The problem is that the command clayer expects a text input which is fine, but it also accepts a space as text, so where your script is correct in using a space for the equivalent of "enter" it all breaks down with certain commands another similar one is "-layer", this also mucks things up. Someone else might have a different method, but I either use excel VBA to create a script file and code in the line returns, or physically create the seperate lines of text which makes your code column larger than your data, (another method would be to split your data over 3 lines each time, it depends where it comes from).
Anyway attached is one way if you select the 3 cells colored yellow and drag/copy the formulas down it should repeat correctly for as many rows as you need (the formulas are setup to start at row 8 if you move things about they will need adjusting).
Good luck
 
PS Welcome to CADTutor
point+text exemple.xls
回复

使用道具 举报

1

主题

2

帖子

1

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 23:36:04 | 显示全部楼层
Steven,
 
Thanks for the quick reply and your take on the solution, that was the one way I was thinking of doing it to keep everything in excel.
 
I actually ended up taking the dive into AutoLISP after coming across a clearly written walkthrough on the cad-notes . com site "Your first Autolisp program".  I created a basic program that defined three new functions with the clayer command inside that works well with my excel sheet, both are attached below for anyone to work with themselves since this seems like a very common issue for us beginners.
 
My solution had me create a lisp but it was very painless and keeps the excel data all in one row, which lets me go into my actual data files and easily modify it onto an end column to run through the heavy data sets.  This may not be the most elegant solution for advanced users but I'll take it.
 
good layer.LSP
revised point text exemple.xls
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 06:01 , Processed in 0.365504 second(s), 58 queries .

© 2020-2025 乐筑天下

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