krkec 发表于 2022-7-6 08:39:04

横截面到3d

你好
 
我想创建一个程序,将2d横截面转换为3dpoint Entytes,将其放置在平面上的横截面轴上。
 
首先,我创建新的ucs原点,使顶点x=3dpoint xvalue;y=3点Z值;
 
现在我开始编程:
 
 
 
;;a) First I get 2d cross section polyline vertex points from polyline.
(vl-load-com)
(setq acadObject (vlax-get-acad-object))
(and
(setq theobj (car (entsel "\nSelect a Polyline: ")))
(setq theobj (vlax-ename->vla-object theobj))
(eq (vlax-get-property theobj 'ObjectName) "AcDbPolyline")
(setq thelist (vlax-get theobj 'coordinates))
;;b) converting point coordinates from wsc to currentucs
(setq n 0)
(while (/= (nth n thelist) nil)
   (setq thelist1
      (cons
      (trans
          (list (nth n thelist) (nth (setq n (1+ n)) thelist))
          0
          1
      )                ;end trans
      thelist1
      )                ;end cons
   )                  ;end setq
   (setq n (1+ n))
)                  ;end while
)
;;c) Rotateing ucs - determinig crosssecton axe
(setq t1 (getpoint "\nOdaberite ishosište koordinatnog sustava"))
(setq t2 (getpoint "\nKliknite na točku na pozitivnoj strani"))
                   ;(vl-cmdf -.UCS "w")
(setq ms (vla-get-modelspace
      (vla-get-ActiveDocument
      (vlax-get-acad-object)
      )
    )
)
(setq lin1 (vla-addline
      ms
      (vlax-3d-point (trans t1 1 0))
      (vlax-3d-point (trans t2 1 0))
      )
)
(setq lin (vlax-vla-object->ename lin1))
(princ)
                   ;(command "._UCS" "e" lin)
(vl-cmdf "._UCS" "e" lin)
(entdel lin)
;;d) drawing points
(setq n 0)
(while (/= (nth n thelist1) nil)
(setq    toc
    (trans
      (list (nth n thelist1) (nth (setq n (1+ n)) thelist1))
      1
      0
    )                ;end trans
)                  ;end setq
(vla-addpoint ms
   (vlax-3d-point (list (nth 0 toc) 0.0 (nth 1 toc)))
)
)
(setq toc nil)

(setq n (1+ n))
)                  ;end while

Tharwat 发表于 2022-7-6 09:06:17

修改您的帖子。。。阅读此

krkec 发表于 2022-7-6 09:10:51

对不起,我修改了。
 

BIGAL 发表于 2022-7-6 09:36:11

有一种更简单的方法可以做到这一点,如果你阻止pline,将其重新缩放到1:1,然后分解并使用rotate3d垂直站立,那么xyz一次就正确了。

krkec 发表于 2022-7-6 09:52:50

是的,但我在Autolisp中是如何做到的???
 
页: [1]
查看完整版本: 横截面到3d