乐筑天下

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

3DPOLY

[复制链接]

93

主题

353

帖子

3

银币

中流砥柱

Rank: 25

铜币
725
发表于 2012-10-29 15:42:25 | 显示全部楼层 |阅读模式
Hi guys,
Anybody knows how to join 3DPOLY?
  PEDIT command doesn't work.
Best Regards
回复

使用道具 举报

14

主题

275

帖子

6

银币

后起之秀

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

铜币
331
发表于 2012-10-29 15:52:45 | 显示全部楼层
Command JOIN.
回复

使用道具 举报

93

主题

353

帖子

3

银币

中流砥柱

Rank: 25

铜币
725
发表于 2012-10-29 15:54:21 | 显示全部楼层
I've already tried join command but didn't work.
Is there other way?
Regards.
回复

使用道具 举报

1

主题

12

帖子

3

银币

初来乍到

Rank: 1

铜币
16
发表于 2012-10-29 23:48:14 | 显示全部楼层
Try my PEDIT3D
(free version download from www.black-cad.de)
Regards
Jochen
回复

使用道具 举报

93

主题

353

帖子

3

银币

中流砥柱

Rank: 25

铜币
725
发表于 2012-10-30 06:34:19 | 显示全部楼层
Hi  Jochen,
I'll try and I let you know if it worked.
Thank you very much.
Regards
回复

使用道具 举报

CAB

29

主题

781

帖子

430

银币

中流砥柱

Rank: 25

铜币
526
发表于 2012-10-30 08:46:40 | 显示全部楼层
I miss understood.  
Not sure where I picked this up:
  1. ; 3D Utility             3Pedit.LSP          Ver 1.3           E Batson
  2. ; Convert 2d polyline, 3dface, line, arc, & circle to 3d polyline
  3. ; 1. Join 3Dpoly's (ends should meet).
  4. ; 2. If you accidently pick a 3DPoly, it is just drawn over again.
  5. ; 3. The Join function will replace the two 3DPolys with a single 3dPoly.
  6. ; 4. The Change function will just draw over the existing entity.
  7. ; 5. For a mesh , first explode it into faces, then change to 3dpoly(s).
  8. ; 6. Resolution will control smoothnes of curves, also make various shapes
  9. ;    such as... 6 = hex,  3 = triangle,  4 = square,  etc....
  10. ;*****************************************************************************
  11. (princ "\nLoading...")
  12. ;..............................................................................
  13. ; Join two 3dpoly lines
  14. (defun join3d
  15. (/ en flag1 flag2 en1 list1 list2 p1a p1b p2a p2b)
  16. (princ "\nJoin two 3DPolys.")
  17. (setq ss1 (entsel "\nSelect first 3dPoly.."))
  18. (redraw (car ss1) 3)
  19. (setq ss2 (entsel "....select second 3dPoly.."))
  20. (redraw (car ss2) 3)
  21. (setvar "blipmode" 0)
  22. (setq en1 (car ss1)
  23.      poly1 (entget en1)
  24.      flag1 (cdr(assoc 70 poly1))
  25.        en2 (car ss2)
  26.      poly2 (entget en2)
  27.      flag2 (cdr(assoc 70 poly2))
  28. )
  29. (if (and (= (logand flag1 8) 8)(= (logand flag2 8) 8))  ; both 3D Polys ?
  30.   (progn
  31.     (setq lyr    (cdr(assoc 8 (entget en1)))             ; get first 3dpoly
  32.           en     (entnext en1)                           ; stuff.
  33.           list1 (cdr(assoc 10 (entget en)))
  34.           chk1   (cdr(assoc 10 (entget en)))
  35.           p1a    list1
  36.     )
  37.     (setq list1 (list list1))
  38.     (while (= (cdr(assoc 0(entget(setq en(entnext en)))))"VERTEX")
  39.        (setq list1 (append list1 (list(cdr(assoc 10(entget en))))))
  40.        (setq p1b (cdr(assoc 10(entget en))))
  41.     )
  42.     (setq en     (entnext en2)                           ; get second 3dpoly
  43.           list2 (cdr(assoc 10 (entget en)))              ; stuff.
  44.           p2a list2
  45.           chk2   (cdr(assoc 10 (entget en)))
  46.     )
  47.     (setq list2 (list list2))
  48.     (while (= (cdr(assoc 0(entget(setq en(entnext en)))))"VERTEX")
  49.       (setq list2 (append list2 (list(cdr(assoc 10(entget en))))))
  50.       (setq p2b (cdr(assoc 10(entget en))))
  51.     )
  52. ;-check for alignment of endpoints
  53.     (cond
  54.      ((equal p1b p2b 0.0001)                    ;if ---1---->
  55.       (setq list1 (reverse list1)))             ; reverse #1.
  56.      ((equal p1a p2b 0.0001)                    ;if ----2---> ---1---->
  57.         (setq tmp list1 list1 list2 list2 tmp)) ; swap them.
  58.     );end cond
  59.     ;---------- do the ends meet ? ---------------------------
  60.     (if (or                                     ; Check to see if the two
  61.          (equal p1a p2a 0.0001)                 ; 3Dpolys meet.
  62.          (equal p1b p2b 0.0001)
  63.          (equal p1a p2b 0.0001)
  64.          (equal p1b p2a 0.0001)
  65.          )
  66.      (progn                                      ; ok, they meet.
  67.    ;-erase old stuff
  68.        (entdel en1);: ")))
  69. (if(boundp 'res)(setq #res res))
  70. (setq cnt -1)
  71. (setq ss (ssget))                                      ; get the stuff
  72. (princ "\nChanging..")
  73. (setq ssl (sslength ss))
  74. (repeat ssl                                            ; do 'em all.
  75.   (setq e (ssname ss (setq cnt (1+ cnt))))
  76.   (cond
  77.    ((= (name e) "POLYLINE")(poly e))                    ; choices
  78.    ((= (name e) "CIRCLE")(cir e))
  79.    ((= (name e) "LINE")(lin e))
  80.    ((= (name e) "ARC")                                  ; If its an ARC,
  81.      (progn(command "pedit" e "y" "")(poly (entlast)))) ; change to polyline.
  82.    ((= (name e) "3DFACE")(3df e))
  83.   )
  84. )
  85. )
  86. ;..........Main function....................
  87. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  88. ; Global variable = #res  (curve resolution)
  89. ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  90. (defun c:3pedit (/ choice)
  91. (initget "C J")
  92. (setq choice (getkword "\nChange/Join : "))
  93. (cond
  94.   ((= choice "C")
  95.     (change_to_3d))
  96.   (T
  97.     (join3d))
  98. )
  99. (setvar "blipmode" 0)
  100. (command "ucs" "w")
  101. (princ)
  102. );end c:3pedit
  103. (princ "\n3Pedit.LSP    - Ver 1.3 -     Compliments of Batson Tool Corp.")
  104. (princ "\nUsage -> Command: 3Pedit ")
  105. (prin1)
回复

使用道具 举报

93

主题

353

帖子

3

银币

中流砥柱

Rank: 25

铜币
725
发表于 2012-10-30 14:05:36 | 显示全部楼层
Thank you guys,
Problem solved!

Best Regards
回复

使用道具 举报

93

主题

353

帖子

3

银币

中流砥柱

Rank: 25

铜币
725
发表于 2012-10-30 19:25:39 | 显示全部楼层
Here is an alternative solution:
  1. ;;------------------=={ Join 3D Polylines }==-----------------;;
  2. ;;                                                            ;;
  3. ;;  Constructs a 3D Polyline spanning all polylines with      ;;
  4. ;;  coincident endpoints in a selection.                      ;;
  5. ;;  Note: properties of 3D Polylines are not retained.        ;;
  6. ;;------------------------------------------------------------;;
  7. ;;  Author: Lee Mac, Copyright © 2012 - www.lee-mac.com       ;;
  8. ;;------------------------------------------------------------;;
  9. (defun c:3dpj ( / assocf grouppoints ent enx inc lst sel sub )
  10.     (defun assocf ( x l f )
  11.         (vl-some '(lambda ( a ) (if (equal x (car a) f) a)) l)
  12.     )
  13.     (defun grouppoints ( l / a r x x1 x2 )
  14.         (while (setq x (car l))
  15.             (setq l (cdr l))
  16.             (while
  17.                 (cond
  18.                     (   (setq a (assocf (setq x1 (car x)) l 1e-8))
  19.                         (setq x (append (reverse a) (cdr x))
  20.                               l (vl-remove a l)
  21.                         )
  22.                     )
  23.                     (   (setq a (assocf (setq x2 (last x)) l 1e-8))
  24.                         (setq x (append x (cdr a))
  25.                               l (vl-remove a l)
  26.                         )
  27.                     )
  28.                     (   (setq a (assocf x1 (setq l (mapcar 'reverse l)) 1e-8))
  29.                         (setq x (append (reverse a) (cdr x))
  30.                               l (vl-remove a l)
  31.                         )
  32.                     )
  33.                     (   (setq a (assocf x2 l 1e-8))
  34.                         (setq x (append x (cdr a))
  35.                               l (vl-remove a l)
  36.                         )
  37.                     )
  38.                 )
  39.             )
  40.             (setq r (cons x r))
  41.         )
  42.     )
  43.    
  44.     (if (setq sel
  45.             (ssget "_:L"
  46.                '(   (0 . "POLYLINE")
  47.                     (-4 . "
  48.                         (-4 . "&=")
  49.                         (70 . 8)
  50.                         (-4 . "
  51.                             (-4 . "&")
  52.                             (70 . 7)
  53.                         (-4 . "NOT>")
  54.                     (-4 . "AND>")
  55.                 )
  56.             )
  57.         )
  58.         (progn
  59.             (repeat (setq inc (sslength sel))
  60.                 (setq ent (entnext (ssname sel (setq inc (1- inc))))
  61.                       enx (entget ent)
  62.                 )
  63.                 (while (= "VERTEX" (cdr (assoc 0 enx)))
  64.                     (setq sub (cons (cdr (assoc 10 enx)) sub)
  65.                           ent (entnext ent)
  66.                           enx (entget  ent)
  67.                     )
  68.                 )
  69.                 (setq lst (cons (reverse sub) lst)
  70.                       sub nil
  71.                 )
  72.                 (entdel (cdr (assoc -2 enx)))
  73.             )
  74.             (foreach lst (grouppoints lst)
  75.                 (entmake'((0 . "POLYLINE") (70 . 8)))
  76.                 (foreach pt lst
  77.                     (entmake (list '(0 . "VERTEX") '(70 . 32) (cons 10 pt)))
  78.                 )
  79.                 (entmake '((0 . "SEQEND")))
  80.             )
  81.         )
  82.     )
  83.     (princ)
  84. )
回复

使用道具 举报

14

主题

275

帖子

6

银币

后起之秀

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

铜币
331
发表于 2012-11-2 20:43:06 | 显示全部楼层

Thank you, Lee Mac
You always have an excellent alternative solution.
Regards
回复

使用道具 举报

CAB

29

主题

781

帖子

430

银币

中流砥柱

Rank: 25

铜币
526
发表于 2012-11-2 20:53:19 | 显示全部楼层
Thank you
回复

使用道具 举报

发表回复

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

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

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

GMT+8, 2025-3-11 11:24 , Processed in 0.357587 second(s), 72 queries .

© 2020-2025 乐筑天下

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