马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
本帖最后由 st788796 于 2017-8-4 11:01 编辑
OCS 的坐标原点和 WCS 原点 重合,LWpolyline 的节点坐标为 OCS,转换时要加上 38 组码(elevation)
- (defun c:tt (/ ss e obj el i z nor ptocs ptwcs)
- (setvar "dimzin" 0)
- (if (setq ss (ssget "+.:S" '((0 . "lwpolyline"))))
- (progn
- (setq e (ssname ss 0)
- el (entget e)
- obj (vlax-ename->vla-object e)
- z (cdr (assoc 38 el))
- nor (cdr (assoc 210 el))
- )
- (princ "\n节点数 = ")
- (princ (cdr (assoc 90 el)))
- (while (and (setq i (getint "\n索引: "))
- (< i (cdr (assoc 90 el)))
- )
- (setq ptocs (safearray-value (variant-value (vla-get-coordinate obj i)))
- ptwcs (trans (append ptocs (list z)) nor 0)
- )
- (princ (strcat "\nOCS = "
- (rtos (car ptocs) 2 3)
- ","
- (rtos (cadr ptocs) 2 3)
- )
- )
- (princ (strcat "\nWCS = "
- (rtos (car ptwcs) 2 3)
- ","
- (rtos (cadr ptwcs) 2 3)
- ","
- (rtos (last ptwcs) 2 3)
- )
- )
- )
- )
- )
- (princ)
- )
转换结果可以使用 vlax-curve-getpointatparam 验证,同样 AddVertex 时也要将 WCS 转换到 OCS
这个 OCS 是什么一个 UCS 呢?
可以使用 UCS 命令的 ZA 选项建立,原点为 (0 0 0) ZAxis 为 组码 210 的值
|