乐筑天下

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

[编程交流] Auto lisp (link excel and auto

[复制链接]
dgp

1

主题

3

帖子

2

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-5 22:26:20 | 显示全部楼层 |阅读模式
Hello,
I’m having difficulty using Auto lisp and I’m wondering if anyone can help me out.
I’m looking for a way to link both an excel table and an AutoCAD drawing together, where if I plug a number into the excel cell it will automatically change a property shape in the AutoCAD drawing to a certain color. I will have 10 different colors and a few hundred property shapes.
 
For example:
 
In excel: If I plug in the following values;
 
 
 
Property Number/        Color Value  /                                  Property Shape in autocad
  200   /                               1 /                                     Property turns green
  300           /                             2 /                                     Property turns red
  400          /                              1 /                                     Property turns green
 
Thanks
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-5 23:50:25 | 显示全部楼层
This has been done before this is a good starting point.
 
Found
  1. (defun HATLOT (lotnum col / HATOBJ FPTS PT1 TPT )(SETQ OLDSNAP (GETVAR "OSMODE"))(SETVAR "OSMODE" 0)(setq lotfound (ssget "X" (LIST (CONS 0 "MTEXT")(CONS 1 lotnum)(CONS 8 "C-BLDG-NMBR"))))(SETQ TPT (ASSOC 10 (ENTGET (ssname lotfound 0))))(SETQ PT1 (LIST (NTH 1 TPT)(NTH 2 TPT)))(SETQ FPTS (LIST (POLAR PT1 1.57 2 ) PT1)) ; 2 is a dummy value just past text hole(SETQ HATOBJ (ENTGET (SSNAME (SSGET "f" FPTS '((0 . "HATCH"))) 0)))(ENTMOD (subst col (assoc 8 HATOBJ) HATOBJ))); this is where you would loop through the lots csv from excel number - color;(while read csv(setq lotnum (getstring "\nEnter lot number")) ; read from file(SETQ COL (cons 8 "60% complete")) ; dummy line for testing make value read from file(HATLOT lotnum perc) ; end while(setvar "osmode" oldsnap)(princ)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 06:35 , Processed in 0.521554 second(s), 56 queries .

© 2020-2025 乐筑天下

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