乐筑天下

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

[编程交流] LISP例程开发square

[复制链接]

77

主题

298

帖子

232

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
394
发表于 2022-7-5 23:27:10 | 显示全部楼层
在这里,这个简化版本适用于我最慢的上网本,每个顶点有100段,它适用于所有版本的ACAD。。。我放弃了align命令,使用了纯entmaking 3DFACES,这些面后来会转换为面域,这样如果不需要折线,最终可以合并它们。。。
 
  1. 5
M.R。
回复

使用道具 举报

77

主题

298

帖子

232

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
394
发表于 2022-7-5 23:32:46 | 显示全部楼层
你好,Marko,
 
再次感谢你的努力——我们最近工作很忙,所以我没有机会检查一下日常工作。
 
我会让你知道的。
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 23:34:27 | 显示全部楼层
我正在寻找LISP for AutoCAD中的两个例程,以在两种类型的转换上运行:
-方形到圆形规划
-管道计划以一定角度切割
请确保您没有,可以送我去测试。
非常感谢。
回复

使用道具 举报

77

主题

298

帖子

232

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
394
发表于 2022-7-5 23:39:19 | 显示全部楼层
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 23:41:41 | 显示全部楼层
 
This topic is beginning to get old... So I decided to put it again to be  actual... I did what I could, did you find some solution to your task  lamensterms? By my opinion I think that this routine is definitely  dependable of the type and capacity of the computer you have... And  sometime it perform the task OK as desired, but sometime it don't do  what should - if input is too high (segments per vertex) it can't  execute slice command well and result is strange and by the way routine  doesn't complete to its end... Seeing that no one haven't replied any  further I wonder if you were able to use routine at all... Maybe now  someone has something to offer that can help...
 
Sincerely, M.R.
回复

使用道具 举报

5

主题

1334

帖子

1410

银币

限制会员

铜币
-20
发表于 2022-7-5 23:45:35 | 显示全部楼层
Here, this simplified version worked on my slowest netbook with 100 segments per vertex and it works on all versions of ACAD... I abandoned align command and used pure entmaking 3DFACES, that are later converted to REGIONS so you can union them in the end if you don't need lines for folding...
 
  1. ;; 2-Circle Intersection  -  Lee Mac;; Returns the point(s) of intersection between two circles;; with centres c1,c2 and radii r1,r2(defun LM:Inters2Circle ( c1 r1 c2 r2 / n d1 x z )   (if       (and           (< (setq d1 (distance c1 c2)) (+ r1 r2))           (< (abs (- r1 r2)) d1)       )       (progn           (setq n  (mapcar '- c2 c1)                 c1 (trans c1 0 n)                 z  (/ (- (+ (* r1 r1) (* d1 d1)) (* r2 r2)) (+ d1 d1))           )           (if (equal z r1 1e-               (list (trans (list (car c1) (cadr c1) (+ (caddr c1) z)) n 0))               (progn                   (setq x (sqrt (- (* r1 r1) (* z z))))                   (list                       (trans (list (- (car c1) x) (cadr c1) (+ (caddr c1) z)) n 0)                       (trans (list (+ (car c1) x) (cadr c1) (+ (caddr c1) z)) n 0)                   )               )           )       )   ))(defun mid (p1 p2) (mapcar '(lambda (a b) (/ (+ a b) 2.0)) p1 p2))(defun c:rectround ( / AP ARCENT CMDE D DD DIA ENPAR HIG INCRPAR K LEN OSM PT PTE PTLST PTM PTO RAD SEG SOL SS STPAR VSZ WID ) (vl-load-com) (if (not (vl-catch-all-error-p (vl-catch-all-apply 'sslength (list (ssget "_X"))))) (progn (alert "\nWarning DWG contains entities - there must be no entities - exiting") (exit))) (vl-cmdf "_.ucs" "w") (vl-cmdf "_.plan" "") (vl-cmdf "_.zoom" "c" '(0.0 0.0 0.0) 100.0) (vl-cmdf "_.regen") (vl-cmdf "_.zoom" "v") (setq vsz (getvar 'viewsize)) (vl-cmdf "_.zoom" "p") (vl-cmdf "_.regen") (setq osm (getvar 'osmode)) (setq cmde (getvar 'cmdecho)) (setq ap (getvar 'aperture)) (setvar 'aperture 25) (setvar 'cmdecho 0) (setvar 'osmode 0) (prompt "\nRECTROUND TRANSITION ROUTINE - ENTER TO CONTINUE") (vl-cmdf pause) (while (or (null dia) (> dia vsz)) (setq dia (getdist "\nInput diameter of Round (pick 2 points) : "))) (setq rad (/ dia 2.0)) (while (or (null len) (> len vsz)) (setq len (getdist "\nInput length of rectangle (pick 2 points) : "))) (while (or (null wid) (> wid vsz)) (setq wid (getdist "\nInput width of rectangle (pick 2 points) : "))) (while (or (null hig) (> hig vsz)) (setq hig (getdist "\nInput height of transition (pick 2 points) : "))) (initget 7) (setq seg (getint "\nInput number of segemnts per vertex of rectangle : ")) (vl-cmdf "_.arc" "c" "_non" (list 0.0 0.0 hig) "_non" (list rad 0.0 hig) "_non" (list 0.0 rad hig)) (if (> (getvar 'cmdactive) 0) (vl-cmdf "")) (setq arcent (entlast)) (setq stpar (vlax-curve-getstartparam arcent)) (setq enpar (vlax-curve-getendparam arcent)) (setq incrpar (/ (- enpar stpar) (float seg))) (setq k -1) (repeat (+ seg 1)   (setq pt (vlax-curve-getpointatparam arcent (+ stpar (* (float (setq k (1+ k))) incrpar))))   (setq ptlst (cons pt ptlst)) ) (setq ptlst (reverse ptlst)) (cond   ((and (equal rad (/ len 2.0) 1e- (equal rad (/ wid 2.0) 1e-)   (vl-cmdf "_.rectangle" "_non" '(0.0 0.0 0.0) "_non" (list rad rad 0.0))   (if (> (getvar 'cmdactive) 0) (vl-cmdf ""))   )   ((or (and (> rad (/ len 2.0)) (> rad (/ wid 2.0))) (and (equal rad (/ len 2.0) 1e- (> rad (/ wid 2.0))) (and (> rad (/ len 2.0)) (equal rad (/ wid 2.0) 1e-))   (vl-cmdf "_.pline" "_non" '(0.0 0.0 0.0) "_non" (list rad 0.0 0.0) "a" "s" "_non" (list (* (sqrt 0.5) rad) (* (sqrt 0.5) rad) 0.0) "_non" (list 0.0 rad 0.0) "l" "c")   )   ((or (and (< rad (/ len 2.0)) (< rad (/ wid 2.0))) (and (equal rad (/ len 2.0) 1e- (< rad (/ wid 2.0))) (and (< rad (/ len 2.0)) (equal rad (/ wid 2.0) 1e-))   (vl-cmdf "_.rectangle" "_non" '(0.0 0.0 0.0) "_non" (list (/ len 2.0) (/ wid 2.0) 0.0))   (if (> (getvar 'cmdactive) 0) (vl-cmdf ""))   )   ((and (> rad (/ len 2.0)) (< rad (/ wid 2.0)))   (vl-cmdf "_.rectangle" "_non" '(0.0 0.0 0.0) "_non" (list rad (/ wid 2.0) 0.0))   (if (> (getvar 'cmdactive) 0) (vl-cmdf ""))   )   ((and (< rad (/ len 2.0)) (> rad (/ wid 2.0)))   (vl-cmdf "_.rectangle" "_non" '(0.0 0.0 0.0) "_non" (list (/ len 2.0) rad 0.0))   (if (> (getvar 'cmdactive) 0) (vl-cmdf ""))   ) ) (vl-cmdf "_.extrude" (entlast) "" hig) (setq sol (entlast)) (vl-cmdf "_.slice" sol "" "3" "_non" (list (/ len 2.0) 0.0 0.0) "_non" (list (/ len 2.0) (/ wid 2.0) 0.0) "_non" (car ptlst) "_non" '(0.0 0.0 0.0)) (setq k -1) (repeat seg   (vl-cmdf "_.slice" sol "" "3" "_non" (nth (setq k (1+ k)) ptlst) "_non" (nth (+ k 1) ptlst) "_non" (list (/ len 2.0) (/ wid 2.0) 0.0) "_non" '(0.0 0.0 0.0)) )   (vl-cmdf "_.slice" sol "" "3" "_non" (list 0.0 (/ wid 2.0) 0.0) "_non" (list (/ len 2.0) (/ wid 2.0) 0.0) "_non" (last ptlst) "_non" '(0.0 0.0 0.0)) (vl-cmdf "_.mirror" sol "" "_non" '(0.0 0.0 0.0) "_non" '(0.0 1.0 0.0) "") (setq ss (ssadd)) (ssadd sol ss) (ssadd (entlast) ss) (vl-cmdf "_.union" ss "") (setq sol (entlast)) (vl-cmdf "_.mirror" sol "" "_non" '(1.0 0.0 0.0) "_non" '(0.0 0.0 0.0) "") (setq ss (ssadd)) (ssadd sol ss) (ssadd (entlast) ss) (vl-cmdf "_.union" ss "") (entdel arcent) (vl-cmdf "_.copybase" '(0.0 0.0 0.0) (entlast) "") (vl-cmdf "_.erase" (entlast) "") (vl-cmdf "_.vpoint" "-1.0,-1.0,1.0") (setq pt (list 0.0 (+ (/ wid 2.0) (distance (list 0.0 (/ wid 2.0) 0.0) (list 0.0 rad hig))) 0.0)) (entmake (list '(0 . "3DFACE") (cons 10 (list 0.0 (/ wid 2.0) 0.0)) (cons 11 (list (/ len 2.0) (/ wid 2.0) 0.0)) (cons 12 pt) (cons 13 pt))) (setq k -1) (setq ptlst (reverse ptlst)) (setq d (distance (nth 0 ptlst) (nth 1 ptlst))) (repeat seg   (setq dd (distance (list (/ len 2.0) (/ wid 2.0) 0.0) (nth (+ (setq k (1+ k)) 1) ptlst)))   (setq pto pt)   (setq pt (car (LM:Inters2Circle (list (/ len 2.0) (/ wid 2.0) 0.0) dd pto d)))   (setq pt (list (car pt) (cadr pt) 0.0))   (entmake (list '(0 . "3DFACE") (cons 10 (list (/ len 2.0) (/ wid 2.0) 0.0)) (cons 11 pto) (cons 12 pt) (cons 13 pt))) ) (setq ptm (mid (list (/ len 2.0) (/ wid 2.0) 0.0) pt)) (setq pte (cadr (LM:Inters2Circle ptm (distance ptm pt) (list (/ len 2.0) (/ wid 2.0) 0.0) (/ len 2.0)))) (if (eq pte nil) (setq pte (cadr (LM:Inters2Circle pt (distance (list (/ len 2.0) 0.0 0.0) (last ptlst)) (list (/ len 2.0) (/ wid 2.0) 0.0) (/ len 2.0))))) (setq pte (list (car pte) (cadr pte) 0.0)) (entmake (list '(0 . "3DFACE") (cons 10 (list (/ len 2.0) (/ wid 2.0) 0.0)) (cons 11 pt) (cons 12 pte) (cons 13 pte))) (vl-cmdf "_.plan" "") (vl-cmdf "_.regen") (vl-cmdf "_.zoom" "v") (setq ss (ssget "_X" '((0 . "3DFACE")))) (vl-cmdf "_.region" ss "") (setq ss (ssget "_X" '((0 . "REGION")))) (vl-cmdf "_.mirror" ss "" "_end" pte "_end" pt "") (setq ss (ssget "_X" '((0 . "REGION")))) (vl-cmdf "_.mirror" ss "" '(0.0 0.0 0.0) '(0.0 1.0 0.0) "") (vl-cmdf "_.pasteclip" '(0.0 0.0 0.0)) (setvar 'aperture ap) (setvar 'cmdecho cmde) (setvar 'osmode osm) (princ))
M.R.
回复

使用道具 举报

77

主题

298

帖子

232

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
394
发表于 2022-7-5 23:49:05 | 显示全部楼层
Hi Marko,
 
Thanks again for the effort - we've been really busy at work lately so I havent had a chance to check the routine out.
 
I will let you know.
回复

使用道具 举报

0

主题

1

帖子

1

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-5 23:51:04 | 显示全部楼层
I'm looking for two routines in LISP for AutoCAD to run on two types of transitions:
-square to round planning
-tube planning to cut at an angle
Please make sure you do not have and can send me to test.
Thank you.
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 02:57 , Processed in 0.622617 second(s), 66 queries .

© 2020-2025 乐筑天下

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