乐筑天下

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

[编程交流] 插入带a的多个块

[复制链接]

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 04:29:24 | 显示全部楼层
Nice, it will be interesting to see if it works or not
回复

使用道具 举报

5

主题

183

帖子

178

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 04:31:49 | 显示全部楼层
Just an update Lee. Sorry I have not posted an update about the Lisp you wrote for me but emergencies came up and then I had to dive into Civil 3D for a volume balance calc for some detention ponds. I will get to the lisp soon. Hopefully this week.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 04:34:43 | 显示全部楼层
Hey, no probs. - do what you gotta do
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 04:38:58 | 显示全部楼层
Not sure but doing (read line) twice may do just that ! Skip a line each loop?
 
lisp carries out each instruction within pairs
 
try
(while (setq new_line (read-line fileopen))
 
code here
then use variable new_line  if its Nil loop exits
 
) ;end while
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 04:39:56 | 显示全部楼层
Forgot do you now want the code for reading a xyz file, how is your file set up does it use commas to seperate variables or are the x y z a set number of characters ?
 
 
100.123, 200,456,300.789
 
123456789012345678901
100.123 200.456 300.789
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 04:45:18 | 显示全部楼层
 
 
Good point AL, and good solution - I must admit, I have never used this method for inserting blocks into drawings, and my posted LISP was untested also. - but thanks for your input.
回复

使用道具 举报

21

主题

146

帖子

127

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
106
发表于 2022-7-6 04:48:12 | 显示全部楼层
Have you guys figured this one out?
 
I would be quite keen to use it myself and could provide you with some feedback if necessary (relating to its function, not its code).
 
currently I use Microstation for this tool. But I plan on doing an all encompassing form driven block/coordinate functions menu when I feel more competent with C#.
回复

使用道具 举报

114

主题

1万

帖子

1万

银币

中流砥柱

Rank: 25

铜币
543
发表于 2022-7-6 04:48:52 | 显示全部楼层
Hiya Wannabe,
 
This should worked (although untested!):
 

[code](defun c:ITREE (/ *error* file1 blk pts)   (defun *error* (msg)   (setvar "cmdecho" 1)   (if (= msg "")       (princ (strcat (itoa blk) " Blocks Inserted."))       (princ "\nError or Esc Pressed.")   ) ;_  end if   ) ;_  end defun   (selfile)   (setvar "cmdecho" 0)   (setq file1    (open file "r")     blk    0   ) ;_  end setq   (while   (/= (setq pts (read-line file1)) nil)      (command "-insert" "C:\\" ;
回复

使用道具 举报

5

主题

183

帖子

178

银币

初来乍到

Rank: 1

铜币
25
发表于 2022-7-6 04:52:55 | 显示全部楼层
 
The order of the file does not matter because I can export to any format, (i.e. xyz, yxz, etc and comma, tab or space delimited). My preference though would be yxz comma delimited.
回复

使用道具 举报

106

主题

1万

帖子

101

银币

顶梁支柱

Rank: 50Rank: 50

铜币
1299
发表于 2022-7-6 04:56:21 | 显示全部楼层
Here is two example the first uses fixed lengths for x yx z etc (please note code wont work as is but can be used within you program check brackets etc)
 
  1. (defun lay_name ()   (setq ans "")   (setq char_found "")   (while (/= x y)     (setq char_found (substr new_line x 1))     (setq x (+ x 1));      (if (= char_found (chr 92))     (if (= char_found " ")       (setq x y)       (setq ans (strcat ans char_found))     )   ))(while (setq new_line (read-line fo)) (setq x 1) (setq y 17) (lay_name) (setq new_name ans ) (setq x 17) (setq y 32) (lay_name) (setq name ans) (setq x 33) (setq y 36) (lay_name) (setq col ans) (setq x 37) (setq y 47) (lay_name) (setq line ans) (setq ans_var (strcat "(" "setq  " name " " (chr 34)  new_name (chr 34) ")" )) (setq ans_col (strcat "(" "setq  " (strcat name "col") " "  col ")" ))  (setq ans_line (strcat "(" "setq  " (strcat name "lin") " "  (chr 34) line (chr 34) ")" ))
 
2nd example is comma delimted
 
  1. (defun xyz () (setq ans "") (setq char_found "") (while (/= char_found ",")   (setq char_found (substr new_line x 1))   (setq x (+ x 1))   (setq ans (strcat ans char_found)) )                    ;end while)                    ;end defun (defun xyzend () (setq ans "") (setq char_found "") (while (/= char_found (chr 13))   (setq char_found (substr new_line x 1))   (setq x (+ x 1))   (setq ans (strcat ans char_found)) )                    ;end while)                    ;end(setq xyzfiles (getfiled "\nENTER CO-ORD File name  " "" "" 4))(setq fopen (open xyzfiles "R"))(SETQ XX 1)(while (setq new_line (read-line fopen))(PRINC XX) (setq x 1) (setq y 5) (xyz) (setq ptno ans)            ;pull ptno out (xyz) (setq easting ans) (xyz) (setq northing ans) (xyzend) (setq height ans)
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-10 18:30 , Processed in 0.946833 second(s), 70 queries .

© 2020-2025 乐筑天下

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