timmy521 发表于 2021-7-6 00:19:29

知道椭圆信息 求椭圆上一点的41 42码

本帖最后由 timmy521 于 2021-7-6 09:43 编辑

如题 ,可以通过lisp获取椭圆上的所有参数 ,现在知道 椭圆上任意一点   怎么求该点的绘图参数啊我用endpoint进行测试,结果得不到
(defun c:t1()
   (vl-load-com)
   (setq name (car (entsel)))
   (Setq cen (Vlax-Get (Vlax-Ename->Vla-Object name) 'Center ))
   (Setq pt(Vlax-Get (Vlax-Ename->Vla-Object name) 'EndPoint ))

   (Setq axis (Vlax-Get (Vlax-Ename->Vla-Object name) 'MajorAxis ))
   (Setq ratio (Vlax-Get (Vlax-Ename->Vla-Object name) 'RadiusRatio ))
(setq endparam (Vlax-Get (Vlax-Ename->Vla-Object name) 'EndParameter)
(pt2ep ptendcen axis ratio)


)
(princ "\n程序加载完成")
(princ "\n")

(defun pt2ep (pt cen axis ratio / ang param)
(setq ang (- (angle cen pt) (angle '(0. 0. 0.) axis)))
(setq param (atan (sin ang) (* (cos ang) ratio)))
(if (< (cos ang) 0.0)
(setq param (+ pi param))
)
param
)


xj6019 发表于 2021-7-6 08:02:08

不懂这是个什么玩法

timmy521 发表于 2021-7-6 09:57:37

(princ (vlax-curve-getParamAtPoint obj1 pt ))
页: [1]
查看完整版本: 知道椭圆信息 求椭圆上一点的41 42码