乐筑天下

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

[编程交流] Can't get selection right

[复制链接]

1

主题

1

帖子

0

银币

初来乍到

Rank: 1

铜币
5
发表于 2022-7-6 09:48:31 | 显示全部楼层 |阅读模式
Hello,
 
I'm new in this forum and new to visual lisp programming.
So i need help with my code.
 
  1. (defun c:imp (/ file_to_process file_open sx_f text_list str_find s_x s_y icount1 icount2 icount cross_ent iname) (setq file_to_process (getfiled "\nChoose file" "F:\" "txt" 16)) (setq str_list (ssadd)) (setq text_list (ssadd)) (setq iName 0) (vl-cmdf "._zoom" "_E") (if (setq file_open (open file_to_process "r"))        (while (setq sx (read-line file_open))      (if (setq str_find (ssget "_X" (list (cons 0 "*TEXT")(cons 1 sx))))        (progn      (setq text_list (ssadd (ssname str_find 0) text_list))      (setq str_list (ssadd (ssname str_find 0) str_list))      (setq iName (1+ iName))      (setq s_X (cadr (assoc 10 (entget (ssname str_find 0)))))      (setq s_Y (caddr (assoc 10 (entget (ssname str_find 0)))))       (setq iCount1 s_X)      (setq iCount2 s_Y)      (setq iCount "")          (while iCount        (setq iCount1 (1- iCount1))        (setq iCount2 (1- iCount2))            (if (setq cross_ent (ssget "_C" (list s_X s_Y 0) (list iCount1 iCount2 0) '((62 . 20))))            (progn        (setq iCount nil)              (setq str_list (ssadd (ssname cross_ent 0) str_list))          );progn        );if          );while        );progn      );if    );while ) ;if (sssetfirst nil str_list) (close file_open) (princ))(princ)
I want to find first polyline that is surrounding the text object, but when i run my code it finds it but doesn't select it.
 
I think the problem is here:
  1.             (if (setq cross_ent (ssget "_C" (list s_X s_Y 0) (list iCount1 iCount2 0) '((62 . 20))))  ;a polyline with color = 20          (progn        (setq iCount nil)              (setq str_list (ssadd (ssname cross_ent 0) str_list))          );progn        );if
But i can't get it work right.
Can someone explain what i'm doing wrong ?
回复

使用道具 举报

0

主题

39

帖子

44

银币

限制会员

铜币
-1
发表于 2022-7-6 10:37:19 | 显示全部楼层
1. Why Z in  cutting frame coordinates (list s_X s_Y 0) (list iCount1 iCount2 0)? It is no need because will be ignored. And why it is Integer 0 not Real 0.0?
 
2. The best way to view your cutting frame temporarily add to your code
 
  1. (vl-cmdf "_.rectangle" (list s_X s_Y) (list iCount1 iCount2))
 
and set break point after it.
回复

使用道具 举报

0

主题

39

帖子

44

银币

限制会员

铜币
-1
发表于 2022-7-6 11:16:39 | 显示全部楼层
Note reversed. Atsiprašome brolis.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-7 00:10 , Processed in 0.815980 second(s), 58 queries .

© 2020-2025 乐筑天下

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